blob: 44bd9d28932e52e09700cb494deebb9090c750f5 [file] [log] [blame]
Douglas Gregor3ac73852009-11-09 16:04:45 +00001// Code-completion through the C interface
Douglas Gregorac06a7c2009-11-09 16:06:30 +00002#include "nonexistent_header.h"
Douglas Gregor3ac73852009-11-09 16:04:45 +00003struct X {
4 int member;
Douglas Gregorff4393c2009-11-09 21:35:27 +00005
6 enum E { Val1 };
Douglas Gregor3ac73852009-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 Gregorff4393c2009-11-09 21:35:27 +000022 // RUN: c-index-test -code-completion-at=%s:23:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s
Douglas Gregor3ac73852009-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 Gregorff4393c2009-11-09 21:35:27 +000032 // RUN: c-index-test -code-completion-at=%s:33:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s
Douglas Gregor3ac73852009-11-09 16:04:45 +000033 overloaded(Z(), 0);
34}
35
Douglas Gregorff4393c2009-11-09 21:35:27 +000036// CHECK-MEMBER: EnumDecl:{Informative X::}{TypedText E}
Douglas Gregor3ac73852009-11-09 16:04:45 +000037// CHECK-MEMBER: FieldDecl:{TypedText member}
38// CHECK-MEMBER: FunctionDecl:{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
Douglas Gregorff4393c2009-11-09 21:35:27 +000039// CHECK-MEMBER: EnumConstantDecl:{Informative E::}{TypedText Val1}
Douglas Gregor3ac73852009-11-09 16:04:45 +000040// CHECK-MEMBER: FunctionDecl:{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
Douglas Gregor3ac73852009-11-09 16:04:45 +000041// CHECK-MEMBER: FunctionDecl:{TypedText operator int}{LeftParen (}{RightParen )}
42// CHECK-MEMBER: FunctionDecl:{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
43// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
44// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
45// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
46// CHECK-MEMBER: FieldDecl:{Text X::}{TypedText member}
47// CHECK-MEMBER: FieldDecl:{Text Y::}{TypedText member}
48// CHECK-MEMBER: FunctionDecl:{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
49// CHECK-MEMBER: FunctionDecl:{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
50
51// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
52// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
53// CHECK-OVERLOAD: NotImplemented:{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}