blob: 2a7a1e2121220c420e9907d6959ba1fd770b5d25 [file] [log] [blame]
Douglas Gregorbe9ea80a2010-04-06 15:09:27 +00001// Note: the run lines follow their respective tests, since line/column
2// matter in this test.
3
Douglas Gregorf757a122010-08-23 23:00:57 +00004int f(int) __attribute__((unavailable));
Douglas Gregorbe9ea80a2010-04-06 15:09:27 +00005
6int test(int i, int j, int k, int l) {
7 return i | j | k & l;
8}
9
Douglas Gregorf757a122010-08-23 23:00:57 +000010struct X __attribute__((deprecated)) f1 = { 17 };
Douglas Gregor2683c282010-05-30 22:23:08 +000011void f2() { f1(17); }
12
Douglas Gregorfe4a4102010-05-30 22:59:50 +000013const char *str = "Hello, \nWorld";
14
Douglas Gregordbb71db2010-08-23 23:51:41 +000015void f3(const char*, ...) __attribute__((sentinel(0)));
16
17#define NULL __null
18void f4(const char* str) {
19 f3(str, NULL);
20}
Douglas Gregorf64acca2010-05-25 21:41:55 +000021// RUN: c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
Douglas Gregor8e984da2010-08-04 16:47:14 +000022// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
Douglas Gregorce0e8562010-08-23 21:54:33 +000023// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (60)
Douglas Gregora2db7932010-05-26 22:00:08 +000024// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
Douglas Gregorf757a122010-08-23 23:00:57 +000025// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
Douglas Gregor45140a92010-08-24 23:40:45 +000026// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
Douglas Gregor7aa6b222010-05-30 01:49:25 +000027// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (2)
Douglas Gregora2db7932010-05-26 22:00:08 +000028// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
Douglas Gregor0de55ce2010-08-25 18:41:16 +000029// 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
Douglas Gregor7aa6b222010-05-30 01:49:25 +000030// RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
Douglas Gregor8e984da2010-08-04 16:47:14 +000031// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
Douglas Gregor7aa6b222010-05-30 01:49:25 +000032// CHECK-CC3: macro definition:{TypedText __VERSION__} (70)
33// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
Douglas Gregor45140a92010-08-24 23:40:45 +000034// CHECK-CC3-NOT: NotImplemented:{TypedText float} (65)
Douglas Gregor7aa6b222010-05-30 01:49:25 +000035// CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (8)
36// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expressio
37
38// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
39// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
Douglas Gregor70febae2010-05-28 00:49:12 +000040// RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
41// CHECK-CC2: macro definition:{TypedText __VERSION__} (70)
42// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
Douglas Gregor45140a92010-08-24 23:40:45 +000043// CHECK-CC2: NotImplemented:{TypedText float} (65)
Douglas Gregor70febae2010-05-28 00:49:12 +000044// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (8)
45// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
Douglas Gregor2683c282010-05-30 22:23:08 +000046// RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
47// CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
Douglas Gregorf757a122010-08-23 23:00:57 +000048// CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
Douglas Gregor2683c282010-05-30 22:23:08 +000049
Douglas Gregordbb71db2010-08-23 23:51:41 +000050// RUN: c-index-test -code-completion-at=%s:19:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
Douglas Gregor400f5972010-08-31 05:13:43 +000051// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder char const *, ...}{Text , NULL}{RightParen )} (45)
Douglas Gregor45140a92010-08-24 23:40:45 +000052// CHECK-CC6: NotImplemented:{TypedText void} (65)
53// CHECK-CC6: NotImplemented:{TypedText volatile} (65)