1*0a6a1f1dSLionel Sambuc #include "complete-macros.h"
2*0a6a1f1dSLionel Sambuc // Note: the run lines follow their respective tests, since line/column matter in this test.
3f4a2713aSLionel Sambuc #define FOO(Arg1,Arg2) foobar
4f4a2713aSLionel Sambuc #define nil 0
5f4a2713aSLionel Sambuc #undef FOO
f()6f4a2713aSLionel Sambuc void f() {
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambuc }
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambuc void g(int);
11f4a2713aSLionel Sambuc
f2()12f4a2713aSLionel Sambuc void f2() {
13f4a2713aSLionel Sambuc int *ip = nil;
14f4a2713aSLionel Sambuc ip = nil;
15f4a2713aSLionel Sambuc g(nil);
16f4a2713aSLionel Sambuc }
17f4a2713aSLionel Sambuc
18f4a2713aSLionel Sambuc #define variadic1(...)
19f4a2713aSLionel Sambuc #define variadic2(args...)
20f4a2713aSLionel Sambuc #define variadic3(args, ...)
21f4a2713aSLionel Sambuc #define variadic4(first, second, args, ...)
22f4a2713aSLionel Sambuc #define variadic5(first, second, args ...)
23f4a2713aSLionel Sambuc
test_variadic()24f4a2713aSLionel Sambuc void test_variadic() {
25f4a2713aSLionel Sambuc
26f4a2713aSLionel Sambuc }
27f4a2713aSLionel Sambuc
28*0a6a1f1dSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:7:1 %s -I%S | FileCheck -check-prefix=CHECK-CC0 %s
29f4a2713aSLionel Sambuc // CHECK-CC0-NOT: FOO
30*0a6a1f1dSLionel Sambuc // 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
31f4a2713aSLionel Sambuc // CHECK-CC1: macro definition:{TypedText FOO}{LeftParen (}{Placeholder Arg1}{Comma , }{Placeholder Arg2}{RightParen )}
32*0a6a1f1dSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:13:13 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
33*0a6a1f1dSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:14:8 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
34*0a6a1f1dSLionel Sambuc // 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
35f4a2713aSLionel Sambuc // CHECK-CC2: macro definition:{TypedText nil} (32)
36*0a6a1f1dSLionel Sambuc // RUN: c-index-test -code-completion-at=%s:15:5 %s -I%S | FileCheck -check-prefix=CHECK-CC3 %s
37*0a6a1f1dSLionel Sambuc // 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
38f4a2713aSLionel Sambuc // CHECK-CC3: macro definition:{TypedText nil} (65)
39*0a6a1f1dSLionel Sambuc // 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
40f4a2713aSLionel Sambuc // CHECK-VARIADIC: macro definition:{TypedText variadic1}{LeftParen (}{Placeholder ...}{RightParen )} (70)
41f4a2713aSLionel Sambuc // CHECK-VARIADIC: macro definition:{TypedText variadic2}{LeftParen (}{Placeholder args...}{RightParen )} (70)
42f4a2713aSLionel Sambuc // CHECK-VARIADIC: macro definition:{TypedText variadic3}{LeftParen (}{Placeholder args, ...}{RightParen )} (70)
43f4a2713aSLionel Sambuc // CHECK-VARIADIC: macro definition:{TypedText variadic4}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args, ...}{RightParen )} (70)
44f4a2713aSLionel Sambuc // CHECK-VARIADIC: macro definition:{TypedText variadic5}{LeftParen (}{Placeholder first}{Comma , }{Placeholder second}{Comma , }{Placeholder args...}{RightParen )} (70)
45*0a6a1f1dSLionel Sambuc
46*0a6a1f1dSLionel Sambuc // 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
47*0a6a1f1dSLionel Sambuc // CHECK-CC4-NOT: COMPLETE_MACROS_H_GUARD
48