Douglas Gregor | 25270b6 | 2011-11-03 00:16:13 +0000 | [diff] [blame] | 1 | namespace { |
Argyrios Kyrtzidis | 7d10087 | 2011-09-04 03:32:15 +0000 | [diff] [blame] | 2 | class 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 | |
| 12 | void MyCls::out_foo() { |
| 13 | vec.x = 0; |
| 14 | } |
| 15 | |
Douglas Gregor | 3dd0f76 | 2011-11-02 23:39:56 +0000 | [diff] [blame] | 16 | class OtherClass : public MyCls { |
| 17 | public: |
| 18 | OtherClass(const OtherClass &other) : MyCls(other), value(value) { } |
| 19 | |
| 20 | private: |
| 21 | int value; |
| 22 | MyCls *object; |
| 23 | }; |
Douglas Gregor | 25270b6 | 2011-11-03 00:16:13 +0000 | [diff] [blame] | 24 | } |
Douglas Gregor | 3dd0f76 | 2011-11-02 23:39:56 +0000 | [diff] [blame] | 25 | |
Nico Weber | 50f88b9 | 2012-08-30 02:08:31 +0000 | [diff] [blame] | 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 |
Argyrios Kyrtzidis | 7d10087 | 2011-09-04 03:32:15 +0000 | [diff] [blame] | 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 |
Douglas Gregor | 3dd0f76 | 2011-11-02 23:39:56 +0000 | [diff] [blame] | 36 | |
Douglas Gregor | 25270b6 | 2011-11-03 00:16:13 +0000 | [diff] [blame] | 37 | // RUN: c-index-test -code-completion-at=%s:18:41 %s | FileCheck -check-prefix=CHECK-CTOR-INIT %s |
Douglas Gregor | 3dd0f76 | 2011-11-02 23:39:56 +0000 | [diff] [blame] | 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) |
Douglas Gregor | 25270b6 | 2011-11-03 00:16:13 +0000 | [diff] [blame] | 41 | // RUN: c-index-test -code-completion-at=%s:18:55 %s | FileCheck -check-prefix=CHECK-CTOR-INIT-2 %s |
Douglas Gregor | 3dd0f76 | 2011-11-02 23:39:56 +0000 | [diff] [blame] | 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) |