xref: /minix3/external/bsd/llvm/dist/clang/test/CodeCompletion/macros.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc enum Color {
2*f4a2713aSLionel Sambuc   Red, Green, Blue
3*f4a2713aSLionel Sambuc };
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc struct Point {
6*f4a2713aSLionel Sambuc   float x, y, z;
7*f4a2713aSLionel Sambuc   enum Color color;
8*f4a2713aSLionel Sambuc };
9*f4a2713aSLionel Sambuc 
test(struct Point * p)10*f4a2713aSLionel Sambuc void test(struct Point *p) {
11*f4a2713aSLionel Sambuc   // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s
12*f4a2713aSLionel Sambuc   switch (p->IDENTITY(color)) {
13*f4a2713aSLionel Sambuc   // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:14:9 %s -o - | FileCheck -check-prefix=CC2 %s
14*f4a2713aSLionel Sambuc     case
15*f4a2713aSLionel Sambuc   }
16*f4a2713aSLionel Sambuc   // RUN: %clang_cc1 -include %S/Inputs/macros.h -fsyntax-only -code-completion-macros -code-completion-at=%s:17:7 %s -o - | FileCheck -check-prefix=CC3 %s
17*f4a2713aSLionel Sambuc #ifdef Q
18*f4a2713aSLionel Sambuc #endif
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc   // Run the same tests, this time with macros loaded from the PCH file.
21*f4a2713aSLionel Sambuc   // RUN: %clang_cc1 -emit-pch -o %t %S/Inputs/macros.h
22*f4a2713aSLionel Sambuc   // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s
23*f4a2713aSLionel Sambuc   // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:14:9 %s -o - | FileCheck -check-prefix=CC2 %s
24*f4a2713aSLionel Sambuc   // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:17:7 %s -o - | FileCheck -check-prefix=CC3 %s
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc   // CC1: color
27*f4a2713aSLionel Sambuc   // CC1: x
28*f4a2713aSLionel Sambuc   // CC1: y
29*f4a2713aSLionel Sambuc   // CC1: z
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc   // CC2: BAR(<#X#>, <#Y#>)
32*f4a2713aSLionel Sambuc   // CC2: Blue
33*f4a2713aSLionel Sambuc   // CC2: FOO
34*f4a2713aSLionel Sambuc   // CC2: Green
35*f4a2713aSLionel Sambuc   // CC2: IDENTITY(<#X#>)
36*f4a2713aSLionel Sambuc   // CC2: MACRO_WITH_HISTORY(<#X#>, <#Y#>)
37*f4a2713aSLionel Sambuc   // CC2: Red
38*f4a2713aSLionel Sambuc   // CC2: WIBBLE
39*f4a2713aSLionel Sambuc 
40*f4a2713aSLionel Sambuc   // CC3: BAR
41*f4a2713aSLionel Sambuc   // CC3: DEAD_MACRO
42*f4a2713aSLionel Sambuc   // CC3: FOO
43*f4a2713aSLionel Sambuc   // CC3: IDENTITY
44*f4a2713aSLionel Sambuc   // CC3: MACRO_WITH_HISTORY
45*f4a2713aSLionel Sambuc   // CC3: WIBBLE
46*f4a2713aSLionel Sambuc }
47