xref: /llvm-project/clang/test/CodeCompletion/macros.c (revision 8b576979549184e73c6876ec4b494aacf7c87d2d)
1 #define FOO
2 #define BAR(X, Y) X, Y
3 #define IDENTITY(X) X
4 #define WIBBLE(...)
5 
6 enum Color {
7   Red, Green, Blue
8 };
9 
10 struct Point {
11   float x, y, z;
12   enum Color color;
13 };
14 
15 void test(struct Point *p) {
16   // RUN: clang-cc -fsyntax-only -code-completion-macros -code-completion-at=%s:17:14 %s -o - | FileCheck -check-prefix=CC1 %s
17   switch (p->IDENTITY(color)) {
18   // RUN: clang-cc -fsyntax-only -code-completion-macros -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC2 %s
19     case
20   }
21   // CC1: color
22   // CC1: x
23   // CC1: y
24   // CC1: z
25   // CC1: BAR(<#X#>, <#Y#>)
26   // CC1: FOO
27   // CC1: IDENTITY(<#X#>)
28   // CC1: WIBBLE
29   // CC2: Blue
30   // CC2: Green
31   // CC2: Red
32   // CC2: BAR(<#X#>, <#Y#>)
33   // CC2: FOO
34   // CC2: IDENTITY(<#X#>)
35   // CC2: WIBBLE
36   // RUN: true
37 }
38