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