summaryrefslogtreecommitdiffstats
path: root/test/Index/complete-enums.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-01 05:02:47 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-01 05:02:47 +0000
commitb223d8c4266655fe7a9491a0aff0263597672823 (patch)
treebdc4e3242b73289bad16770ac851421bfcc643a6 /test/Index/complete-enums.cpp
parent8398cbfc73f7ff0a676232db9ea9160bb9dafd8d (diff)
When providing code completions for a switch over a scoped enumeration
type, be sure to add the qualifier for the enumeration type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/complete-enums.cpp')
-rw-r--r--test/Index/complete-enums.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/Index/complete-enums.cpp b/test/Index/complete-enums.cpp
new file mode 100644
index 0000000000..49a8932587
--- /dev/null
+++ b/test/Index/complete-enums.cpp
@@ -0,0 +1,25 @@
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+enum class Color {
+ Red = 17,
+ Green,
+ Blue
+};
+int Greeby();
+void f(Color color) {
+ switch (color) {
+ case Color::Green:
+ case Color::Red;
+ }
+}
+
+// RUN: c-index-test -code-completion-at=%s:12:8 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Blue} (7)
+// CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Green} (7)
+// CHECK-CC1: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Red} (7)
+
+// RUN: c-index-test -code-completion-at=%s:13:8 -std=c++11 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Blue} (7)
+// CHECK-CC2-NOT: Green
+// CHECK-CC2: EnumConstantDecl:{ResultType Color}{Text Color::}{TypedText Red} (7)