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
17 // Run the same tests, this time with macros loaded from the PCH file.
18 // RUN: %clang_cc1 -emit-pch -o %t %S/Inputs/macros.h
19 // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s
20 // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:14:9 %s -o - | FileCheck -check-prefix=CC2 %s
21
22 // CC1: color
23 // CC1: x
24 // CC1: y
25 // CC1: z
26
27 // CC2: BAR(<#X#>, <#Y#>)
28 // CC2: Blue
29 // CC2: FOO
30 // CC2: Green
31 // CC2: IDENTITY(<#X#>)
32 // CC2: Red
33 // CC2: WIBBLE
34 }
35