summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeCompletion
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-05-16 16:06:57 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-05-16 16:06:57 +0000
commit600ec01b7e27e4c815e1968db4a600e63491ed19 (patch)
treec1a06dd6846e683975aee2d0ecefad2ae86ec9b3 /clang/test/CodeCompletion
parent402ca78c436bcd1973136a23c7dfa85f1e1c584f (diff)
downloadbcm5719-llvm-600ec01b7e27e4c815e1968db4a600e63491ed19.tar.gz
bcm5719-llvm-600ec01b7e27e4c815e1968db4a600e63491ed19.zip
[CodeComplete] Complete enumerators when preferred type is an enum
Reviewers: kadircet Reviewed By: kadircet Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62010 llvm-svn: 360912
Diffstat (limited to 'clang/test/CodeCompletion')
-rw-r--r--clang/test/CodeCompletion/enum-preferred-type.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/test/CodeCompletion/enum-preferred-type.cpp b/clang/test/CodeCompletion/enum-preferred-type.cpp
new file mode 100644
index 00000000000..7ff4be9048b
--- /dev/null
+++ b/clang/test/CodeCompletion/enum-preferred-type.cpp
@@ -0,0 +1,24 @@
+namespace N {
+ enum Color {
+ Red,
+ Blue,
+ Orange,
+ };
+}
+
+void test(N::Color color) {
+ color = N::Color::Red;
+ test(N::Color::Red);
+ if (color == N::Color::Red) {}
+ // FIXME: ideally, we should not show 'Red' on the next line.
+ else if (color == N::Color::Blue) {}
+
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:10:11 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:11:8 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:12:16 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:14:21 %s -o - | FileCheck %s
+ // CHECK: Blue : [#N::Color#]N::Blue
+ // CHECK: color : [#N::Color#]color
+ // CHECK: Orange : [#N::Color#]N::Orange
+ // CHECK: Red : [#N::Color#]N::Red
+}
OpenPOWER on IntegriCloud