blob: 0758bbf768876be54dc1f57a5125b81c9114aec2 [file] [log] [blame]
Douglas Gregor3f7c7f42009-10-30 16:50:04 +00001enum Color {
2 Red, Green, Blue
3};
4
5struct Point {
6 float x, y, z;
7 enum Color color;
8};
9
10void test(struct Point *p) {
Douglas Gregor88a35862010-01-04 19:18:44 +000011 // 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
Douglas Gregor3f7c7f42009-10-30 16:50:04 +000012 switch (p->IDENTITY(color)) {
Douglas Gregor88a35862010-01-04 19:18:44 +000013 // 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
Douglas Gregor3f7c7f42009-10-30 16:50:04 +000014 case
15 }
Douglas Gregor88a35862010-01-04 19:18:44 +000016
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
Douglas Gregorab0b4f12010-01-13 23:24:38 +000022 // CC1: color
Douglas Gregorab0b4f12010-01-13 23:24:38 +000023 // CC1: x
24 // CC1: y
25 // CC1: z
26
Douglas Gregor3f7c7f42009-10-30 16:50:04 +000027 // CC2: BAR(<#X#>, <#Y#>)
Douglas Gregorab0b4f12010-01-13 23:24:38 +000028 // CC2: Blue
Douglas Gregor3f7c7f42009-10-30 16:50:04 +000029 // CC2: FOO
Douglas Gregorab0b4f12010-01-13 23:24:38 +000030 // CC2: Green
Douglas Gregor3f7c7f42009-10-30 16:50:04 +000031 // CC2: IDENTITY(<#X#>)
Douglas Gregorab0b4f12010-01-13 23:24:38 +000032 // CC2: Red
Douglas Gregor3f7c7f42009-10-30 16:50:04 +000033 // CC2: WIBBLE
Douglas Gregor3f7c7f42009-10-30 16:50:04 +000034}