blob: fd84d1c0e3947f8909fe26a69bbbf208d4b7c11f [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 Gregord8e8a582010-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 Gregor1abc6bc2010-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 Gregoraa5f77b2010-08-23 21:54:33 +000023// CHECK-CC1: NotImplemented:{TypedText __PRETTY_FUNCTION__} (60)
Douglas Gregor12e13132010-05-26 22:00:08 +000024// CHECK-CC1: macro definition:{TypedText __VERSION__} (70)
Douglas Gregor58ddb602010-08-23 23:00:57 +000025// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )} (12) (unavailable)
Douglas Gregord43dd832010-08-24 23:40:45 +000026// CHECK-CC1-NOT: NotImplemented:{TypedText float} (65)
Douglas Gregor5ac3bdb2010-05-30 01:49:25 +000027// CHECK-CC1: ParmDecl:{ResultType int}{TypedText j} (2)
Douglas Gregor12e13132010-05-26 22:00:08 +000028// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )} (30)
Douglas Gregor721f3592010-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 Gregor5ac3bdb2010-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 Gregor1abc6bc2010-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 Gregor5ac3bdb2010-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 Gregord43dd832010-08-24 23:40:45 +000034// CHECK-CC3-NOT: NotImplemented:{TypedText float} (65)
Douglas Gregor5ac3bdb2010-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 Gregor4710e5b2010-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 Gregord43dd832010-08-24 23:40:45 +000043// CHECK-CC2: NotImplemented:{TypedText float} (65)
Douglas Gregor4710e5b2010-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 Gregorbd6c76f2010-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 Gregor58ddb602010-08-23 23:00:57 +000048// CHECK-CC4: VarDecl:{ResultType struct X}{TypedText f1} (50) (deprecated)
Douglas Gregorbd6c76f2010-05-30 22:23:08 +000049
Douglas Gregoraaa107a2010-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
Chris Lattner58f9e132010-09-05 00:04:01 +000051// CHECK-CC6: FunctionDecl:{ResultType void}{TypedText f3}{LeftParen (}{Placeholder const char *, ...}{Text , NULL}{RightParen )} (45)
Douglas Gregord43dd832010-08-24 23:40:45 +000052// CHECK-CC6: NotImplemented:{TypedText void} (65)
53// CHECK-CC6: NotImplemented:{TypedText volatile} (65)