summaryrefslogtreecommitdiffstats
path: root/clang/test/Index/complete-enums.c
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-18 23:30:37 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-18 23:30:37 +0000
commit3a69eafa8845e1f440cff77ecabd3daf1588adb5 (patch)
tree528857142c7f79dae7113eb46a2390dca2759456 /clang/test/Index/complete-enums.c
parent2d6390d47bdab125efce0e382e483e8eb74bf321 (diff)
downloadbcm5719-llvm-3a69eafa8845e1f440cff77ecabd3daf1588adb5.tar.gz
bcm5719-llvm-3a69eafa8845e1f440cff77ecabd3daf1588adb5.zip
When code-completing a case statement for a switch on a value of
enumeration type, prioritize the enumeration constants and don't provide completions for any other expressions. Fixes <rdar://problem/7283668>. llvm-svn: 125991
Diffstat (limited to 'clang/test/Index/complete-enums.c')
-rw-r--r--clang/test/Index/complete-enums.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/clang/test/Index/complete-enums.c b/clang/test/Index/complete-enums.c
index 5e712a11227..33a4cd42811 100644
--- a/clang/test/Index/complete-enums.c
+++ b/clang/test/Index/complete-enums.c
@@ -1,15 +1,22 @@
// Note: the run lines follow their respective tests, since line/column
// matter in this test.
-enum {
- Red = 17,
- Green,
- Blue
+enum Color {
+ Color_Red = 17,
+ Color_Green,
+ Color_Blue
};
-
-void f() {
-
+int Greeby();
+void f(Color color) {
+ switch (color) {
+ case Red:
+ }
}
// RUN: c-index-test -code-completion-at=%s:11:1 %s | FileCheck -check-prefix=CHECK-CC1 %s
-// CHECK-CC1: EnumConstantDecl:{ResultType enum <anonymous>}{TypedText Red}
+// CHECK-CC1: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Red}
+
+// RUN: c-index-test -code-completion-at=%s:12:8 %s | FileCheck -check-prefix=CHECK-CC2 %s
+// CHECK-CC2: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Blue} (7)
+// CHECK-CC2-NEXT: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Green} (7)
+// CHECK-CC2-NEXT: EnumConstantDecl:{ResultType enum Color}{TypedText Color_Red} (7)
OpenPOWER on IntegriCloud