xref: /aosp_15_r20/external/clang/test/Index/complete-enums.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // Note: the run lines follow their respective tests, since line/column
2*67e74705SXin Li // matter in this test.
3*67e74705SXin Li struct X { X(); ~X(); };
4*67e74705SXin Li enum class Color {
5*67e74705SXin Li   Red = 17,
6*67e74705SXin Li   Green,
7*67e74705SXin Li   Blue
8*67e74705SXin Li };
9*67e74705SXin Li int Greeby();
f(Color color)10*67e74705SXin Li void f(Color color) {
11*67e74705SXin Li   switch (color) {
12*67e74705SXin Li   case Color::Green: { X x; }
13*67e74705SXin Li   case Color::Red;
14*67e74705SXin Li   }
15*67e74705SXin Li }
16*67e74705SXin Li 
17*67e74705SXin Li // RUN: c-index-test -code-completion-at=%s:12:8 -std=c++11  %s | FileCheck -check-prefix=CHECK-CC1 %s
18*67e74705SXin Li // CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Blue} (7)
19*67e74705SXin Li // CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Green} (7)
20*67e74705SXin Li // CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Red} (7)
21*67e74705SXin Li 
22*67e74705SXin Li // RUN: c-index-test -code-completion-at=%s:13:8 -std=c++11  %s | FileCheck -check-prefix=CHECK-CC2 %s
23*67e74705SXin Li // CHECK-CC2: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Blue} (7)
24*67e74705SXin Li // CHECK-CC2-NOT: Green
25*67e74705SXin Li // CHECK-CC2: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Red} (7)
26