xref: /minix3/external/bsd/llvm/dist/clang/test/CodeCompletion/enum-switch-case.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc enum Color {
2*f4a2713aSLionel Sambuc   Red,
3*f4a2713aSLionel Sambuc   Orange,
4*f4a2713aSLionel Sambuc   Yellow,
5*f4a2713aSLionel Sambuc   Green,
6*f4a2713aSLionel Sambuc   Blue,
7*f4a2713aSLionel Sambuc   Indigo,
8*f4a2713aSLionel Sambuc   Violet
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc 
test(enum Color color)11*f4a2713aSLionel Sambuc void test(enum Color color) {
12*f4a2713aSLionel Sambuc   switch (color) {
13*f4a2713aSLionel Sambuc     case Red:
14*f4a2713aSLionel Sambuc       break;
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc     case Yellow:
17*f4a2713aSLionel Sambuc       break;
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc     case Green:
20*f4a2713aSLionel Sambuc       break;
21*f4a2713aSLionel Sambuc   }
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc   unsigned c2;
24*f4a2713aSLionel Sambuc   switch (c2) {
25*f4a2713aSLionel Sambuc     case
26*f4a2713aSLionel Sambuc   }
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:10 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
29*f4a2713aSLionel Sambuc     // CHECK-CC1: Blue
30*f4a2713aSLionel Sambuc     // CHECK-CC1-NEXT: Green
31*f4a2713aSLionel Sambuc     // CHECK-CC1-NEXT: Indigo
32*f4a2713aSLionel Sambuc     // CHECK-CC1-NEXT: Orange
33*f4a2713aSLionel Sambuc     // CHECK-CC1-NEXT: Violet
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc     // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:25:10 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
36*f4a2713aSLionel Sambuc   // CHECK-CC2: COMPLETION: Blue : [#enum Color#]Blue
37*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: c2 : [#unsigned int#]c2
38*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: color : [#enum Color#]color
39*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: Green : [#enum Color#]Green
40*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: Indigo : [#enum Color#]Indigo
41*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: Orange : [#enum Color#]Orange
42*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: Red : [#enum Color#]Red
43*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: Pattern : [#size_t#]sizeof(<#expression-or-type#>)
44*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: Violet : [#enum Color#]Violet
45*f4a2713aSLionel Sambuc   // CHECK-CC2-NEXT: COMPLETION: Yellow : [#enum Color#]Yellow
46