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