blob: 7fd4376735a04397ee842931ad6737a38dd1a248 [file] [log] [blame]
Shih-wei Liaof8fd82b2010-02-10 11:10:31 -08001// Code-completion through the C interface
2#include "nonexistent_header.h"
3struct X {
4 int member;
5
6 enum E { Val1 };
7};
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() {
22 // RUN: c-index-test -code-completion-at=%s:23:11 %s | FileCheck -check-prefix=CHECK-MEMBER %s
23 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() {
32 // RUN: c-index-test -code-completion-at=%s:33:18 %s | FileCheck -check-prefix=CHECK-OVERLOAD %s
33 overloaded(Z(), 0);
34}
35
36// CHECK-MEMBER: FieldDecl:{ResultType double}{TypedText member}
37// CHECK-MEMBER: FieldDecl:{ResultType int}{Text X::}{TypedText member}
38// CHECK-MEMBER: FieldDecl:{ResultType float}{Text Y::}{TypedText member}
39// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText memfunc}{LeftParen (}{Optional {Placeholder int i}}{RightParen )}
40// CHECK-MEMBER: FunctionDecl:{ResultType int}{TypedText operator int}{LeftParen (}{RightParen )}{Informative const}
41// CHECK-MEMBER: FunctionDecl:{ResultType struct Z &}{TypedText operator=}{LeftParen (}{Placeholder struct Z const &}{RightParen )}
42// CHECK-MEMBER: FunctionDecl:{ResultType struct X &}{Text X::}{TypedText operator=}{LeftParen (}{Placeholder struct X const &}{RightParen )}
43// CHECK-MEMBER: FunctionDecl:{ResultType struct Y &}{Text Y::}{TypedText operator=}{LeftParen (}{Placeholder struct Y const &}{RightParen )}
44// CHECK-MEMBER: EnumConstantDecl:{ResultType enum X::E}{Informative E::}{TypedText Val1}
45// CHECK-MEMBER: StructDecl:{TypedText X}{Text ::}
46// CHECK-MEMBER: StructDecl:{TypedText Y}{Text ::}
47// CHECK-MEMBER: StructDecl:{TypedText Z}{Text ::}
48// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative X::}{TypedText ~X}{LeftParen (}{RightParen )}
49// CHECK-MEMBER: FunctionDecl:{ResultType void}{Informative Y::}{TypedText ~Y}{LeftParen (}{RightParen )}
50// CHECK-MEMBER: FunctionDecl:{ResultType void}{TypedText ~Z}{LeftParen (}{RightParen )}
51
52// CHECK-OVERLOAD: NotImplemented:{ResultType int &}{Text overloaded}{LeftParen (}{Text struct Z z}{Comma , }{CurrentParameter int second}{RightParen )}
53// CHECK-OVERLOAD: NotImplemented:{ResultType float &}{Text overloaded}{LeftParen (}{Text int i}{Comma , }{CurrentParameter long second}{RightParen )}
54// CHECK-OVERLOAD: NotImplemented:{ResultType double &}{Text overloaded}{LeftParen (}{Text float f}{Comma , }{CurrentParameter int second}{RightParen )}