complete-cxx-inline-methods.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. namespace {
  2. class MyCls {
  3. void in_foo() {
  4. vec.x = 0;
  5. }
  6. void out_foo();
  7. struct Vec { int x, y; };
  8. Vec vec;
  9. };
  10. void MyCls::out_foo() {
  11. vec.x = 0;
  12. }
  13. class OtherClass : public MyCls {
  14. public:
  15. OtherClass(const OtherClass &other) : MyCls(other), value(value) { }
  16. private:
  17. int value;
  18. MyCls *object;
  19. };
  20. }
  21. // RUN: c-index-test -code-completion-at=%s:4:9 -std=c++98 %s | FileCheck %s
  22. // RUN: c-index-test -code-completion-at=%s:13:7 -std=c++98 %s | FileCheck %s
  23. // CHECK: CXXMethod:{ResultType MyCls::Vec &}{TypedText operator=}{LeftParen (}{Placeholder const MyCls::Vec &}{RightParen )} (34)
  24. // CHECK-NEXT: StructDecl:{TypedText Vec}{Text ::} (75)
  25. // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText x} (35)
  26. // CHECK-NEXT: FieldDecl:{ResultType int}{TypedText y} (35)
  27. // CHECK-NEXT: CXXDestructor:{ResultType void}{TypedText ~Vec}{LeftParen (}{RightParen )} (34)
  28. // CHECK-NEXT: Completion contexts:
  29. // CHECK-NEXT: Dot member access
  30. // CHECK-NEXT: Container Kind: StructDecl
  31. // RUN: c-index-test -code-completion-at=%s:18:41 %s | FileCheck -check-prefix=CHECK-CTOR-INIT %s
  32. // CHECK-CTOR-INIT: NotImplemented:{TypedText MyCls}{LeftParen (}{Placeholder args}{RightParen )} (7)
  33. // CHECK-CTOR-INIT: MemberRef:{TypedText object}{LeftParen (}{Placeholder args}{RightParen )} (35)
  34. // CHECK-CTOR-INIT: MemberRef:{TypedText value}{LeftParen (}{Placeholder args}{RightParen )} (35)
  35. // RUN: c-index-test -code-completion-at=%s:18:55 %s | FileCheck -check-prefix=CHECK-CTOR-INIT-2 %s
  36. // CHECK-CTOR-INIT-2-NOT: NotImplemented:{TypedText MyCls}{LeftParen (}{Placeholder args}{RightParen )}
  37. // CHECK-CTOR-INIT-2: MemberRef:{TypedText object}{LeftParen (}{Placeholder args}{RightParen )} (35)
  38. // CHECK-CTOR-INIT-2: MemberRef:{TypedText value}{LeftParen (}{Placeholder args}{RightParen )} (7)