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