diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-02-18 23:30:37 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-02-18 23:30:37 +0000 |
| commit | 3a69eafa8845e1f440cff77ecabd3daf1588adb5 (patch) | |
| tree | 528857142c7f79dae7113eb46a2390dca2759456 /clang/test/Index/complete-enums.c | |
| parent | 2d6390d47bdab125efce0e382e483e8eb74bf321 (diff) | |
| download | bcm5719-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.c | 23 |
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) |

