blob: c286c82d048008aeb23eb930d7c2f3a4d4485477 [file] [log] [blame]
Douglas Gregor8b14f8f2009-11-09 16:04:45 +00001// Code-completion through the C interface
Douglas Gregor022d3c22009-11-09 16:06:30 +00002#include "nonexistent_header.h"
Douglas Gregor8b14f8f2009-11-09 16:04:45 +00003struct X {
4 int member;
Douglas Gregor8caea942009-11-09 21:35:27 +00005
6 enum E { Val1 };
Douglas Gregor8b14f8f2009-11-09 16:04:45 +00007};
8
9struct Y {
10 float member;
11 void memfunc(int i = 17);
12};
13
14struct Z : X, Y {
15 double member;
16 operator int() const;
17};
18
19struct Z get_Z();
20
21void test_Z() {
Douglas Gregor8caea942009-11-09 21:35:27 +000022 // RUN: c-index-test -code-completion-at=%s:23:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s
Douglas Gregor8b14f8f2009-11-09 16:04:45 +000023 get_Z().member = 17;
24}
25
26
27float& overloaded(int i, long second);
28double& overloaded(float f, int second);
29int& overloaded(Z z, int second);
30
31void test_overloaded() {
Douglas Gregor8caea942009-11-09 21:35:27 +000032 // RUN: c-index-test -code-completion-at=%s:33:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s
Douglas Gregor8b14f8f2009-11-09 16:04:45 +000033 overloaded(Z(), 0);
34}
35
36// CHECK-MEMBER: FieldDecl:{TypedText member}
37// CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
Douglas Gregor8caea942009-11-09 21:35:27 +000038// CHECK-MEMBER: EnumConstantDecl:{Informative E::}{TypedText Val1}
Douglas Gregor8b14f8f2009-11-09 16:04:45 +000039// CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
Douglas Gregor8b14f8f2009-11-09 16:04:45 +000040// CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )}
41// CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
Douglas Gregor8b14f8f2009-11-09 16:04:45 +000042// CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member}
43// CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member}
44// CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
45// CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
Douglas Gregor99fe2ad2009-12-11 17:31:05 +000046// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
47// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
48// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
Douglas Gregor8b14f8f2009-11-09 16:04:45 +000049
50// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
51// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
52// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}