blob: 161969649416c1a51e0bee5cf09484378bed769f [file] [log] [blame]
Douglas Gregor64538cf2010-04-06 15:09:27 +00001// Note: the run lines follow their respective tests, since line/column
2// matter in this test.
3
Douglas Gregor58ddb602010-08-23 23:00:57 +00004int f(int) __attribute__((unavailable));
Douglas Gregor64538cf2010-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 Gregor58ddb602010-08-23 23:00:57 +000010struct X __attribute__((deprecated)) f1 = { 17 };
Douglas Gregorbd6c76f2010-05-30 22:23:08 +000011void f2() { f1(17); }
12
Douglas Gregor33611e02010-05-30 22:59:50 +000013const char *str = "Hello, \nWorld";
14
Douglas Gregoraaa107a2010-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 Gregor02688102010-09-14 23:59:36 +000021
22typedef int type;
23void f5(float f) {
24 (type)f;
25}
26
Douglas Gregord8e8a582010-05-25 21:41:55 +000027// RUN: c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
Douglas Gregor1abc6bc2010-08-04 16:47:14 +000028// 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 Gregord754d552010-09-16 16:21:35 +000029// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (65)
Douglas Gregor12e13132010-05-26 22:00:08 +000030// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
Douglas Gregor58ddb602010-08-23 23:00:57 +000031// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
Douglas Gregord43dd832010-08-24 23:40:45 +000032// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
Douglas Gregor5ac3bdb2010-05-30 01:49:25 +000033// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (2)
Douglas Gregor12e13132010-05-26 22:00:08 +000034// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
Douglas Gregor721f3592010-08-25 18:41:16 +000035// 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 Gregor5ac3bdb2010-05-30 01:49:25 +000036// RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
Douglas Gregor1abc6bc2010-08-04 16:47:14 +000037// 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 Gregor5ac3bdb2010-05-30 01:49:25 +000038// CHECK-CC3: macro definition:{TypedText __VERSION__} (70)
39// CHECK-CC3: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
Douglas Gregord754d552010-09-16 16:21:35 +000040// CHECK-CC3-NOT: NotImplemented:{TypedText float}
Douglas Gregor5ac3bdb2010-05-30 01:49:25 +000041// CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (8)
42// CHECK-CC3: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expressio
43
44// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
45// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
Douglas Gregor4710e5b2010-05-28 00:49:12 +000046// RUN: c-index-test -code-completion-at=%s:7:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
47// CHECK-CC2: macro definition:{TypedText __VERSION__} (70)
48// CHECK-CC2: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
Douglas Gregor08f43cd2010-09-20 23:11:55 +000049// CHECK-CC2: NotImplemented:{TypedText float} (50)
Douglas Gregor4710e5b2010-05-28 00:49:12 +000050// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (8)
51// CHECK-CC2: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
Douglas Gregorbd6c76f2010-05-30 22:23:08 +000052// RUN: c-index-test -code-completion-at=%s:11:16 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
53// CHECK-CC4: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (50)
Douglas Gregor58ddb602010-08-23 23:00:57 +000054// CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
Douglas Gregorbd6c76f2010-05-30 22:23:08 +000055
Douglas Gregoraaa107a2010-08-23 23:51:41 +000056// RUN: c-index-test -code-completion-at=%s:19:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
Douglas Gregord475aad2010-09-20 21:25:19 +000057// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder const char *, ...}{Text , NULL}{RightParen )} (50)
Douglas Gregor08f43cd2010-09-20 23:11:55 +000058// CHECK-CC6: NotImplemented:{TypedText void} (50)
59// CHECK-CC6: NotImplemented:{TypedText volatile} (50)
Douglas Gregor02688102010-09-14 23:59:36 +000060
61// RUN: c-index-test -code-completion-at=%s:24:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
62// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:24:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
63// CHECK-CC7: ParmDecl:{ResultType float}{TypedText f} (8)
64// CHECK-CC7: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
65// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f2}{LeftParen (}{RightParen )} (50)
66// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder const char *, ...}{Text , NULL}{RightParen )} (50)
67// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f4}{LeftParen (}{Placeholder const char *str}{RightParen )} (50)
68// CHECK-CC7: FunctionDecl:{ResultType void}{TypedText f5}{LeftParen (}{Placeholder float f}{RightParen )} (50)
69// CHECK-CC7: TypedefDecl:{TypedText type}