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