18b14f8fdSDouglas Gregor // Code-completion through the C interface 2*022d3c2fSDouglas Gregor #include "nonexistent_header.h" 38b14f8fdSDouglas Gregor struct X { 48b14f8fdSDouglas Gregor int member; 58b14f8fdSDouglas Gregor }; 68b14f8fdSDouglas Gregor 78b14f8fdSDouglas Gregor struct Y { 88b14f8fdSDouglas Gregor float member; 98b14f8fdSDouglas Gregor void memfunc(int i = 17); 108b14f8fdSDouglas Gregor }; 118b14f8fdSDouglas Gregor 128b14f8fdSDouglas Gregor struct Z : X, Y { 138b14f8fdSDouglas Gregor double member; 148b14f8fdSDouglas Gregor operator int() const; 158b14f8fdSDouglas Gregor }; 168b14f8fdSDouglas Gregor 178b14f8fdSDouglas Gregor struct Z get_Z(); 188b14f8fdSDouglas Gregor 198b14f8fdSDouglas Gregor void test_Z() { 208b14f8fdSDouglas Gregor // RUN: c-index-test -code-completion-at=%s:21:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s 218b14f8fdSDouglas Gregor get_Z().member = 17; 228b14f8fdSDouglas Gregor } 238b14f8fdSDouglas Gregor 248b14f8fdSDouglas Gregor 258b14f8fdSDouglas Gregor float& overloaded(int i, long second); 268b14f8fdSDouglas Gregor double& overloaded(float f, int second); 278b14f8fdSDouglas Gregor int& overloaded(Z z, int second); 288b14f8fdSDouglas Gregor 298b14f8fdSDouglas Gregor void test_overloaded() { 308b14f8fdSDouglas Gregor // RUN: c-index-test -code-completion-at=%s:31:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s 318b14f8fdSDouglas Gregor overloaded(Z(), 0); 328b14f8fdSDouglas Gregor } 338b14f8fdSDouglas Gregor 348b14f8fdSDouglas Gregor // CHECK-MEMBER: FieldDecl:{TypedText member} 358b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )} 368b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )} 378b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )} 388b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{TypedText ~Z}{LeftParen (}{RightParen )} 398b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )} 408b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )} 418b14f8fdSDouglas Gregor // CHECK-MEMBER: StructDecl:{TypedText X}{Text ::} 428b14f8fdSDouglas Gregor // CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::} 438b14f8fdSDouglas Gregor // CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::} 448b14f8fdSDouglas Gregor // CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member} 458b14f8fdSDouglas Gregor // CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member} 468b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )} 478b14f8fdSDouglas Gregor // CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )} 488b14f8fdSDouglas Gregor 498b14f8fdSDouglas Gregor // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )} 508b14f8fdSDouglas Gregor // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )} 518b14f8fdSDouglas Gregor // CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )} 52