blob: ee359f75e4455e48094457d1f32fa82109f15ee0 [file] [log] [blame]
Douglas Gregor25270b62011-11-03 00:16:13 +00001namespace {
Argyrios Kyrtzidis7d100872011-09-04 03:32:15 +00002class MyCls {
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
12void MyCls::out_foo() {
13 vec.x = 0;
14}
15
Douglas Gregor3dd0f762011-11-02 23:39:56 +000016class OtherClass : public MyCls {
17public:
18 OtherClass(const OtherClass &other) : MyCls(other), value(value) { }
19
20private:
21 int value;
22 MyCls *object;
23};
Douglas Gregor25270b62011-11-03 00:16:13 +000024}
Douglas Gregor3dd0f762011-11-02 23:39:56 +000025
Nico Weber50f88b92012-08-30 02:08:31 +000026// 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
Argyrios Kyrtzidis7d100872011-09-04 03:32:15 +000028// 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
Douglas Gregor3dd0f762011-11-02 23:39:56 +000036
Douglas Gregor25270b62011-11-03 00:16:13 +000037// RUN: c-index-test -code-completion-at=%s:18:41 %s | FileCheck -check-prefix=CHECK-CTOR-INIT %s
Douglas Gregor3dd0f762011-11-02 23:39:56 +000038// 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)
Douglas Gregor25270b62011-11-03 00:16:13 +000041// RUN: c-index-test -code-completion-at=%s:18:55 %s | FileCheck -check-prefix=CHECK-CTOR-INIT-2 %s
Douglas Gregor3dd0f762011-11-02 23:39:56 +000042// 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)