blob: afb6219ae303a85058606761edfdfdd4ea0fdc5c [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 Gregor6f942b22010-09-21 16:06:22 +000028// 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 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 Gregor8ec904c2010-10-19 00:03:23 +000033// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (8)
Douglas Gregor8ca72082011-10-18 21:20:17 +000034// CHECK-CC1: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
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 Gregor6f942b22010-09-21 16:06:22 +000037// 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
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 Gregor8ec904c2010-10-19 00:03:23 +000041// CHECK-CC3: ParmDecl:{ResultType int}{TypedText j} (34)
Douglas Gregor8ca72082011-10-18 21:20:17 +000042// CHECK-CC3: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expressio
Douglas Gregor5ac3bdb2010-05-30 01:49:25 +000043
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 Gregor8ec904c2010-10-19 00:03:23 +000050// CHECK-CC2: ParmDecl:{ResultType int}{TypedText j} (34)
Douglas Gregor8ca72082011-10-18 21:20:17 +000051// CHECK-CC2: NotImplemented:{ResultType size_t}{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (40)
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
Douglas Gregor6f942b22010-09-21 16:06:22 +000062// 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
Douglas Gregor8ec904c2010-10-19 00:03:23 +000063// CHECK-CC7: ParmDecl:{ResultType float}{TypedText f} (34)
Douglas Gregor02688102010-09-14 23:59:36 +000064// 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}