1*f4a2713aSLionel Sambuc // Note: the run lines follow their respective tests, since line/column
2*f4a2713aSLionel Sambuc // matter in this test.
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuc int f(int) __attribute__((unavailable));
5*f4a2713aSLionel Sambuc
test(int i,int j,int k,int l)6*f4a2713aSLionel Sambuc int test(int i, int j, int k, int l) {
7*f4a2713aSLionel Sambuc return i | j | k & l;
8*f4a2713aSLionel Sambuc }
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc struct X __attribute__((deprecated)) f1 = { 17 };
f2()11*f4a2713aSLionel Sambuc void f2() { f1(17); }
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuc const char *str = "Hello, \nWorld";
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc void f3(const char*, ...) __attribute__((sentinel(0)));
16*f4a2713aSLionel Sambuc
17*f4a2713aSLionel Sambuc #define NULL __null
f4(const char * str)18*f4a2713aSLionel Sambuc void f4(const char* str) {
19*f4a2713aSLionel Sambuc f3(str, NULL);
20*f4a2713aSLionel Sambuc }
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambuc typedef int type;
f5(float f)23*f4a2713aSLionel Sambuc void f5(float f) {
24*f4a2713aSLionel Sambuc (type)f;
25*f4a2713aSLionel Sambuc }
26*f4a2713aSLionel Sambuc
27*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
28*f4a2713aSLionel Sambuc // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
29*f4a2713aSLionel Sambuc // CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (65)
30*f4a2713aSLionel Sambuc // CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
31*f4a2713aSLionel Sambuc // CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
32*f4a2713aSLionel Sambuc // CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
33*f4a2713aSLionel Sambuc // CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8)
34*f4a2713aSLionel Sambuc // CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
35*f4a2713aSLionel Sambuc // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
36*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
37*f4a2713aSLionel Sambuc // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
38*f4a2713aSLionel Sambuc // CHECK-CC3: macro definition:{TypedText __VERSION__} (70)
39*f4a2713aSLionel Sambuc // CHECK-CC3: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
40*f4a2713aSLionel Sambuc // CHECK-CC3-NOT: NotImplemented:{TypedText float}
41*f4a2713aSLionel Sambuc // CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (34)
42*f4a2713aSLionel Sambuc // CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expressio
43*f4a2713aSLionel Sambuc
44*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
45*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
46*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
47*f4a2713aSLionel Sambuc // CHECK-CC2: macro definition:{TypedText __VERSION__} (70)
48*f4a2713aSLionel Sambuc // CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
49*f4a2713aSLionel Sambuc // CHECK-CC2: NotImplemented:{TypedText float} (50)
50*f4a2713aSLionel Sambuc // CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (34)
51*f4a2713aSLionel Sambuc // CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
52*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
53*f4a2713aSLionel Sambuc // CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
54*f4a2713aSLionel Sambuc // CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
55*f4a2713aSLionel Sambuc
56*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:19:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
57*f4a2713aSLionel Sambuc // CHECK-CC6: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder const char *, ...}{Text , NULL}{RightParen )} (50)
58*f4a2713aSLionel Sambuc // CHECK-CC6: NotImplemented:{TypedText void} (50)
59*f4a2713aSLionel Sambuc // CHECK-CC6: NotImplemented:{TypedText volatile} (50)
60*f4a2713aSLionel Sambuc
61*f4a2713aSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:24:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
62*f4a2713aSLionel Sambuc // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:24:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
63*f4a2713aSLionel Sambuc // CHECK-CC7: ParmDecl:{ResultType float}{TypedText f} (34)
64*f4a2713aSLionel Sambuc // CHECK-CC7: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
65*f4a2713aSLionel Sambuc // CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f2}{LeftParen (}{RightParen )} (50)
66*f4a2713aSLionel Sambuc // CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder const char *, ...}{Text , NULL}{RightParen )} (50)
67*f4a2713aSLionel Sambuc // CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f4}{LeftParen (}{Placeholder const char *str}{RightParen )} (50)
68*f4a2713aSLionel Sambuc // CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f5}{LeftParen (}{Placeholder float f}{RightParen )} (50)
69*f4a2713aSLionel Sambuc // CHECK-CC7: TypedefDecl:{TypedText type} (50)
70