1*8b14f8fdSDouglas Gregor // Code-completion through the C interface
2*8b14f8fdSDouglas Gregor 
3*8b14f8fdSDouglas Gregor struct X {
4*8b14f8fdSDouglas Gregor   int member;
5*8b14f8fdSDouglas Gregor };
6*8b14f8fdSDouglas Gregor 
7*8b14f8fdSDouglas Gregor struct Y {
8*8b14f8fdSDouglas Gregor   float member;
9*8b14f8fdSDouglas Gregor   void memfunc(int i = 17);
10*8b14f8fdSDouglas Gregor };
11*8b14f8fdSDouglas Gregor 
12*8b14f8fdSDouglas Gregor struct Z : X, Y {
13*8b14f8fdSDouglas Gregor   double member;
14*8b14f8fdSDouglas Gregor   operator int() const;
15*8b14f8fdSDouglas Gregor };
16*8b14f8fdSDouglas Gregor 
17*8b14f8fdSDouglas Gregor struct Z get_Z();
18*8b14f8fdSDouglas Gregor 
19*8b14f8fdSDouglas Gregor void test_Z() {
20*8b14f8fdSDouglas Gregor   // RUN: c-index-test -code-completion-at=%s:21:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s
21*8b14f8fdSDouglas Gregor   get_Z().member = 17;
22*8b14f8fdSDouglas Gregor }
23*8b14f8fdSDouglas Gregor 
24*8b14f8fdSDouglas Gregor 
25*8b14f8fdSDouglas Gregor float& overloaded(int i, long second);
26*8b14f8fdSDouglas Gregor double& overloaded(float f, int second);
27*8b14f8fdSDouglas Gregor int& overloaded(Z z, int second);
28*8b14f8fdSDouglas Gregor 
29*8b14f8fdSDouglas Gregor void test_overloaded() {
30*8b14f8fdSDouglas Gregor   // RUN: c-index-test -code-completion-at=%s:31:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s
31*8b14f8fdSDouglas Gregor   overloaded(Z(), 0);
32*8b14f8fdSDouglas Gregor }
33*8b14f8fdSDouglas Gregor 
34*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FieldDecl:{TypedText member}
35*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
36*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
37*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )}
38*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{TypedText ~Z}{LeftParen (}{RightParen )}
39*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )}
40*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
41*8b14f8fdSDouglas Gregor // CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
42*8b14f8fdSDouglas Gregor // CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
43*8b14f8fdSDouglas Gregor // CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
44*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member}
45*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member}
46*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
47*8b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
48*8b14f8fdSDouglas Gregor 
49*8b14f8fdSDouglas Gregor // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
50*8b14f8fdSDouglas Gregor // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
51*8b14f8fdSDouglas Gregor // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}
52