[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Index / complete-macros.c
bloba0b1f4ae9e13da7fc6097bd876d6255eccc71b35
1 #include "complete-macros.h"
2 // Note: the run lines follow their respective tests, since line/column matter in this test.
3 #define FOO(Arg1,Arg2) foobar
4 #define nil 0
5 #undef FOO
6 void f() {
10 void g(int);
12 void f2() {
13 int *ip = nil;
14 ip = nil;
15 g(nil);
18 #define variadic1(...)
19 #define variadic2(args...)
20 #define variadic3(args, ...)
21 #define variadic4(first, second, args, ...)
22 #define variadic5(first, second, args ...)
24 void test_variadic() {
28 // RUN: c-index-test -code-completion-at=%s:7:1 %s -I%S | FileCheck -check-prefix=CHECK-CC0 %s
29 // CHECK-CC0-NOT: FOO
30 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:1 %s -I%S | FileCheck -check-prefix=CHECK-CC1 %s
31 // (we had a regression that only occurred when parsing as C++, so check that too)
32 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:1 -x c++ %s -I%S | FileCheck -check-prefix=CHECK-CC1 %s
33 // CHECK-CC1: macro definition:{TypedText FOO} (70)
34 // CHECK-CC1: macro definition:{TypedText MACRO_IN_HEADER} (70)
35 // RUN: c-index-test -code-completion-at=%s:13:13 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
36 // RUN: c-index-test -code-completion-at=%s:14:8 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
37 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:8 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
38 // CHECK-CC2: macro definition:{TypedText nil} (32)
39 // RUN: c-index-test -code-completion-at=%s:15:5 %s -I%S | FileCheck -check-prefix=CHECK-CC3 %s
40 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:5 %s -I%S | FileCheck -check-prefix=CHECK-CC3 %s
41 // CHECK-CC3: macro definition:{TypedText nil} (65)
42 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:25:2 %s -I%S | FileCheck -check-prefix=CHECK-VARIADIC %s
43 // CHECK-VARIADIC: macro definition:{TypedText variadic1}{LeftParen (}{Placeholder ...}{RightParen )} (70)
44 // CHECK-VARIADIC: macro definition:{TypedText variadic2}{LeftParen (}{Placeholder args...}{RightParen )} (70)
45 // CHECK-VARIADIC: macro definition:{TypedText variadic3}{LeftParen (}{Placeholder args, ...}{RightParen )} (70)
46 // CHECK-VARIADIC: macro definition:{TypedText variadic4}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args, ...}{RightParen )} (70)
47 // CHECK-VARIADIC: macro definition:{TypedText variadic5}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args...}{RightParen )} (70)
49 // RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:15:5 %s -I%S | FileCheck -check-prefix=CHECK-CC4 %s
50 // CHECK-CC4-NOT: COMPLETE_MACROS_H_GUARD