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