Douglas Gregor | 2e10cf9 | 2011-11-03 00:16:13 +0000 | [diff] [blame] | 1 | namespace { |
Argyrios Kyrtzidis | 5cec2ae | 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 | e7f0675 | 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 | 2e10cf9 | 2011-11-03 00:16:13 +0000 | [diff] [blame] | 24 | } |
Douglas Gregor | e7f0675 | 2011-11-02 23:39:56 +0000 | [diff] [blame] | 25 | |
Nico Weber | 723b4f0 | 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 |
Ilya Biryukov | b5da91c | 2017-11-08 10:39:09 +0000 | [diff] [blame] | 28 | // CHECK: CXXMethod:{ResultType Vec &}{TypedText operator=}{LeftParen (}{Placeholder const Vec &}{RightParen )} (79) |
Argyrios Kyrtzidis | 5cec2ae | 2011-09-04 03:32:15 +0000 | [diff] [blame] | 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) |
Ilya Biryukov | 4e7a6fe | 2017-09-22 19:07:37 +0000 | [diff] [blame] | 32 | // CHECK-NEXT: CXXDestructor:{ResultType void}{TypedText ~Vec}{LeftParen (}{RightParen )} (79) |
Argyrios Kyrtzidis | 5cec2ae | 2011-09-04 03:32:15 +0000 | [diff] [blame] | 33 | // CHECK-NEXT: Completion contexts: |
| 34 | // CHECK-NEXT: Dot member access |
| 35 | // CHECK-NEXT: Container Kind: StructDecl |
Douglas Gregor | e7f0675 | 2011-11-02 23:39:56 +0000 | [diff] [blame] | 36 | |
Douglas Gregor | 2e10cf9 | 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 | e7f0675 | 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 | 2e10cf9 | 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 | e7f0675 | 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) |