1 enum Color {
2 Red, Green, Blue
3 };
4
5 struct Point {
6 float x, y, z;
7 enum Color color;
8 };
9
test(struct Point * p)10 void test(struct Point *p) {
11 // 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 switch (p->IDENTITY(color)) {
13 // 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 case
15 }
16 // 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 #ifdef Q
18 #endif
19
20 // Run the same tests, this time with macros loaded from the PCH file.
21 // RUN: %clang_cc1 -emit-pch -o %t %S/Inputs/macros.h
22 // 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 // 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 // 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
26 // CC1: color
27 // CC1: x
28 // CC1: y
29 // CC1: z
30
31 // CC2: BAR(<#X#>, <#Y#>)
32 // CC2: Blue
33 // CC2: FOO
34 // CC2: Green
35 // CC2: IDENTITY(<#X#>)
36 // CC2: MACRO_WITH_HISTORY(<#X#>, <#Y#>)
37 // CC2: Red
38 // CC2: WIBBLE
39
40 // CC3: BAR
41 // CC3: DEAD_MACRO
42 // CC3: FOO
43 // CC3: IDENTITY
44 // CC3: MACRO_WITH_HISTORY
45 // CC3: WIBBLE
46 }
47