1*f4a2713aSLionel Sambuc // Code-completion through the C interface
2*f4a2713aSLionel Sambuc #include "nonexistent_header.h"
3*f4a2713aSLionel Sambuc struct X {
4*f4a2713aSLionel Sambuc int member;
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc enum E { Val1 };
7*f4a2713aSLionel Sambuc };
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc struct Y {
10*f4a2713aSLionel Sambuc float member;
11*f4a2713aSLionel Sambuc void memfunc(int i = 17);
12*f4a2713aSLionel Sambuc };
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc struct Z : X, Y {
15*f4a2713aSLionel Sambuc double member;
16*f4a2713aSLionel Sambuc operator int() const;
17*f4a2713aSLionel Sambuc };
18*f4a2713aSLionel Sambuc struct W { };
19*f4a2713aSLionel Sambuc struct Z get_Z();
20*f4a2713aSLionel Sambuc namespace N { }
test_Z()21*f4a2713aSLionel Sambuc void test_Z() {
22*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:23:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s
23*f4a2713aSLionel Sambuc get_Z().member = 17;
24*f4a2713aSLionel Sambuc }
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc float& overloaded(int i, long second);
28*f4a2713aSLionel Sambuc double& overloaded(float f, int second);
29*f4a2713aSLionel Sambuc int& overloaded(Z z, int second);
30*f4a2713aSLionel Sambuc
test_overloaded()31*f4a2713aSLionel Sambuc void test_overloaded() {
32*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:33:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s
33*f4a2713aSLionel Sambuc overloaded(Z(), 0);
34*f4a2713aSLionel Sambuc }
35*f4a2713aSLionel Sambuc
operator int() const36*f4a2713aSLionel Sambuc Z::operator int() const {
37*f4a2713aSLionel Sambuc return 0;
38*f4a2713aSLionel Sambuc }
39*f4a2713aSLionel Sambuc
40*f4a2713aSLionel Sambuc // CHECK-MEMBER: FieldDecl:{ResultType double}{TypedText member}
41*f4a2713aSLionel Sambuc // CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member}
42*f4a2713aSLionel Sambuc // CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member}
43*f4a2713aSLionel Sambuc // CHECK-MEMBER: CXXMethod:{ResultType void}{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
44*f4a2713aSLionel Sambuc // CHECK-MEMBER: CXXConversion:{TypedText operator int}{LeftParen (}{RightParen )}{Informative const}
45*f4a2713aSLionel Sambuc // CHECK-MEMBER: CXXMethod:{ResultType Z &}{TypedText operator=}{LeftParen (}{Placeholder const Z &}{RightParen )}
46*f4a2713aSLionel Sambuc // CHECK-MEMBER: CXXMethod:{ResultType X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder const X &}{RightParen )}
47*f4a2713aSLionel Sambuc // CHECK-MEMBER: CXXMethod:{ResultType Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder const Y &}{RightParen )}
48*f4a2713aSLionel Sambuc // CHECK-MEMBER: EnumConstantDecl:{ResultType X::E}{Informative E::}{TypedText Val1}
49*f4a2713aSLionel Sambuc // CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
50*f4a2713aSLionel Sambuc // CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
51*f4a2713aSLionel Sambuc // CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
52*f4a2713aSLionel Sambuc // CHECK-MEMBER: CXXDestructor:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
53*f4a2713aSLionel Sambuc // CHECK-MEMBER: CXXDestructor:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )}
54*f4a2713aSLionel Sambuc // CHECK-MEMBER: CXXDestructor:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )}
55*f4a2713aSLionel Sambuc // CHECK-MEMBER: Completion contexts:
56*f4a2713aSLionel Sambuc // CHECK-MEMBER-NEXT: Dot member access
57*f4a2713aSLionel Sambuc // CHECK-MEMBER-NEXT: Container Kind: StructDecl
58*f4a2713aSLionel Sambuc // CHECK-MEMBER-NEXT: Container is complete
59*f4a2713aSLionel Sambuc // CHECK-MEMBER-NEXT: Container USR: c:@S@Z
60*f4a2713aSLionel Sambuc
61*f4a2713aSLionel Sambuc // CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text Z z}{Comma , }{CurrentParameter int second}{RightParen )}
62*f4a2713aSLionel Sambuc // CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
63*f4a2713aSLionel Sambuc // CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
64*f4a2713aSLionel Sambuc // CHECK-OVERLOAD: Completion contexts:
65*f4a2713aSLionel Sambuc // CHECK-OVERLOAD-NEXT: Any type
66*f4a2713aSLionel Sambuc // CHECK-OVERLOAD-NEXT: Any value
67*f4a2713aSLionel Sambuc // CHECK-OVERLOAD-NEXT: Enum tag
68*f4a2713aSLionel Sambuc // CHECK-OVERLOAD-NEXT: Union tag
69*f4a2713aSLionel Sambuc // CHECK-OVERLOAD-NEXT: Struct tag
70*f4a2713aSLionel Sambuc // CHECK-OVERLOAD-NEXT: Class name
71*f4a2713aSLionel Sambuc // CHECK-OVERLOAD-NEXT: Nested name specifier
72*f4a2713aSLionel Sambuc // CHECK-OVERLOAD-NEXT: Objective-C interface
73*f4a2713aSLionel Sambuc
74*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:37:10 %s | FileCheck -check-prefix=CHECK-EXPR %s
75*f4a2713aSLionel Sambuc // CHECK-EXPR: NotImplemented:{TypedText int} (50)
76*f4a2713aSLionel Sambuc // CHECK-EXPR: NotImplemented:{TypedText long} (50)
77*f4a2713aSLionel Sambuc // CHECK-EXPR: FieldDecl:{ResultType double}{TypedText member} (17)
78*f4a2713aSLionel Sambuc // CHECK-EXPR: FieldDecl:{ResultType int}{Text X::}{TypedText member} (9)
79*f4a2713aSLionel Sambuc // CHECK-EXPR: FieldDecl:{ResultType float}{Text Y::}{TypedText member} (18)
80*f4a2713aSLionel Sambuc // CHECK-EXPR: CXXMethod:{ResultType void}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} (37)
81*f4a2713aSLionel Sambuc // CHECK-EXPR: Namespace:{TypedText N}{Text ::} (75)
82*f4a2713aSLionel Sambuc // CHECK-EXPR: Completion contexts:
83*f4a2713aSLionel Sambuc // CHECK-EXPR-NEXT: Any type
84*f4a2713aSLionel Sambuc // CHECK-EXPR-NEXT: Any value
85*f4a2713aSLionel Sambuc // CHECK-EXPR-NEXT: Enum tag
86*f4a2713aSLionel Sambuc // CHECK-EXPR-NEXT: Union tag
87*f4a2713aSLionel Sambuc // CHECK-EXPR-NEXT: Struct tag
88*f4a2713aSLionel Sambuc // CHECK-EXPR-NEXT: Class name
89*f4a2713aSLionel Sambuc // CHECK-EXPR-NEXT: Nested name specifier
90*f4a2713aSLionel Sambuc // CHECK-EXPR-NEXT: Objective-C interface
91