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