blob: 0f78e8caa748c51484354daa98925939967bd130 [file] [log] [blame]
Douglas Gregor2e10cf92011-11-03 00:16:13 +00001namespace {
Argyrios Kyrtzidis5cec2ae2011-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 Gregore7f06752011-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 Gregor2e10cf92011-11-03 00:16:13 +000024}
Douglas Gregore7f06752011-11-02 23:39:56 +000025
Nico Weber723b4f02012-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
Ilya Biryukovb5da91c2017-11-08 10:39:09 +000028// CHECK: CXXMethod:{ResultType Vec &}{TypedText operator=}{LeftParen (}{Placeholder const Vec &}{RightParen )} (79)
Argyrios Kyrtzidis5cec2ae2011-09-04 03:32:15 +000029// 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)
Ilya Biryukov4e7a6fe2017-09-22 19:07:37 +000032// CHECK-NEXT: CXXDestructor:{ResultType void}{TypedText ~Vec}{LeftParen (}{RightParen )} (79)
Argyrios Kyrtzidis5cec2ae2011-09-04 03:32:15 +000033// CHECK-NEXT: Completion contexts:
34// CHECK-NEXT: Dot member access
35// CHECK-NEXT: Container Kind: StructDecl
Douglas Gregore7f06752011-11-02 23:39:56 +000036
Douglas Gregor2e10cf92011-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 Gregore7f06752011-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 Gregor2e10cf92011-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 Gregore7f06752011-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)