diff options
| author | Ilya Biryukov <ibiryukov@google.com> | 2018-11-07 10:02:31 +0000 |
|---|---|---|
| committer | Ilya Biryukov <ibiryukov@google.com> | 2018-11-07 10:02:31 +0000 |
| commit | ebf0a6d75dcb5715d5bf7097e749a4249d01e956 (patch) | |
| tree | 8de53754d6278f1ffac8aced98e3ba6546677362 /clang/test/CodeCompletion | |
| parent | ed4bb266c8531a28399b2fab8161ff67e4eaa650 (diff) | |
| download | bcm5719-llvm-ebf0a6d75dcb5715d5bf7097e749a4249d01e956.tar.gz bcm5719-llvm-ebf0a6d75dcb5715d5bf7097e749a4249d01e956.zip | |
[CodeComplete] Do not complete self-initializations
Summary:
Removes references to initialized variable from the following completions:
int x = ^;
Handles only the trivial cases where the variable name is completed
immediately at the start of initializer or assignment, more complicated
cases aren't covered, e.g. these completions still contain 'x':
// More complicated expressions.
int x = foo(^);
int x = 10 + ^;
// Other kinds of initialization.
int x{^};
int x(^);
// Constructor initializers.
struct Foo {
Foo() : x(^) {}
int x;
};
We should address those in the future, but they are outside of the scope of
this initial change.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D54156
llvm-svn: 346301
Diffstat (limited to 'clang/test/CodeCompletion')
| -rw-r--r-- | clang/test/CodeCompletion/ordinary-name-cxx11.cpp | 1 | ||||
| -rw-r--r-- | clang/test/CodeCompletion/ordinary-name.cpp | 1 | ||||
| -rw-r--r-- | clang/test/CodeCompletion/self-inits.cpp | 3 |
3 files changed, 3 insertions, 2 deletions
diff --git a/clang/test/CodeCompletion/ordinary-name-cxx11.cpp b/clang/test/CodeCompletion/ordinary-name-cxx11.cpp index 34c3bf96a9d..0125ffbbb3c 100644 --- a/clang/test/CodeCompletion/ordinary-name-cxx11.cpp +++ b/clang/test/CodeCompletion/ordinary-name-cxx11.cpp @@ -197,7 +197,6 @@ void foo() { // CHECK-CC4-NEXT: COMPLETION: volatile // CHECK-CC4-NEXT: COMPLETION: wchar_t // CHECK-CC4-NEXT: COMPLETION: X : X - // CHECK-CC4-NEXT: COMPLETION: y : [#int#]y // CHECK-CC4-NEXT: COMPLETION: z : [#void#]z(<#int#>) // RUN: %clang_cc1 -fsyntax-only -fno-rtti -code-completion-patterns -code-completion-at=%s:6:14 -std=gnu++11 %s -o - | FileCheck -check-prefix=CHECK-NO-RTTI %s diff --git a/clang/test/CodeCompletion/ordinary-name.cpp b/clang/test/CodeCompletion/ordinary-name.cpp index 03dbbcaf744..ba613bc9152 100644 --- a/clang/test/CodeCompletion/ordinary-name.cpp +++ b/clang/test/CodeCompletion/ordinary-name.cpp @@ -171,7 +171,6 @@ void foo() { // CHECK-CC4-NEXT: COMPLETION: volatile // CHECK-CC4-NEXT: COMPLETION: wchar_t // CHECK-CC4-NEXT: COMPLETION: X : X - // CHECK-CC4-NEXT: COMPLETION: y : [#int#]y // CHECK-CC4-NEXT: COMPLETION: z : [#void#]z(<#int#>) // RUN: %clang_cc1 -fsyntax-only -fno-rtti -code-completion-patterns -code-completion-at=%s:6:14 -std=gnu++98 %s -o - | FileCheck -check-prefix=CHECK-NO-RTTI %s diff --git a/clang/test/CodeCompletion/self-inits.cpp b/clang/test/CodeCompletion/self-inits.cpp new file mode 100644 index 00000000000..a64209534ae --- /dev/null +++ b/clang/test/CodeCompletion/self-inits.cpp @@ -0,0 +1,3 @@ +int foo = 10; +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:1:11 %s -o - | FileCheck --check-prefix=CC1 %s +// CC1-NOT: foo |

