xref: /llvm-project/clang/test/CodeCompletion/enum-preferred-type.cpp (revision cf9b25e0adc42546e4dc5ff51ee8674d45bac26b)
1 namespace N {
2   enum Color {
3     Red,
4     Blue,
5     Orange,
6   };
7 }
8 
test(N::Color color)9 void test(N::Color color) {
10   color = N::Color::Red;
11   test(N::Color::Red);
12   if (color == N::Color::Red) {}
13   // FIXME: ideally, we should not show 'Red' on the next line.
14   else if (color == N::Color::Blue) {}
15 
16   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):11 %s -o - | FileCheck %s
17   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):8 %s -o - | FileCheck %s
18   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-6):16 %s -o - | FileCheck %s
19   // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-5):21 %s -o - | FileCheck %s
20   // CHECK: Blue : [#N::Color#]N::Blue
21   // CHECK: color : [#N::Color#]color
22   // CHECK: Orange : [#N::Color#]N::Orange
23   // CHECK: Red : [#N::Color#]N::Red
24 }
25