summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeCompletion
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-04-25 15:13:34 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-04-25 15:13:34 +0000
commitef4ece75fdb48b06ab4b8cd087a6fc64b44d5978 (patch)
tree28f8dd79f2318936707e3ae88382e5a485ba013a /clang/test/CodeCompletion
parent5559cc3b75bd2c3bfdffd7ef752d899e085e4a39 (diff)
downloadbcm5719-llvm-ef4ece75fdb48b06ab4b8cd087a6fc64b44d5978.tar.gz
bcm5719-llvm-ef4ece75fdb48b06ab4b8cd087a6fc64b44d5978.zip
[CodeComplete] Fix completion in the middle of ident in ctor lists.
Summary: The example that was broken before (^ designates completion points): class Foo { Foo() : fie^ld^() {} // no completions were provided here. int field; }; To fix it we don't cut off lexing after an identifier followed by code completion token is lexed. Instead we skip the rest of identifier and continue lexing. This is consistent with behavior of completion when completion token is right before the identifier. Reviewers: sammccall, aaron.ballman, bkramer, sepavloff, arphaman, rsmith Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44932 llvm-svn: 330833
Diffstat (limited to 'clang/test/CodeCompletion')
-rw-r--r--clang/test/CodeCompletion/ctor-initializer.cpp4
-rw-r--r--clang/test/CodeCompletion/end-of-file.cpp7
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/CodeCompletion/ctor-initializer.cpp b/clang/test/CodeCompletion/ctor-initializer.cpp
index e54b347f9fa..e1a0d143687 100644
--- a/clang/test/CodeCompletion/ctor-initializer.cpp
+++ b/clang/test/CodeCompletion/ctor-initializer.cpp
@@ -58,5 +58,9 @@ struct B {
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:57:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
// RUN: %clang_cc1 -fsyntax-only -std=c++14 -code-completion-at=%s:57:9 %s -o - | FileCheck -check-prefix=CHECK-CC7 %s
// CHECK-CC7: COMPLETION: Pattern : member1(<#args#>
+ // Check in the middle and at the end of identifier too.
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:57:13 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
+ // RUN: %clang_cc1 -fsyntax-only -std=c++98 -code-completion-at=%s:57:16 %s -o - | FileCheck -check-prefix=CHECK-CC8 %s
+ // CHECK-CC8: COMPLETION: Pattern : member2(<#args#>
int member1, member2;
};
diff --git a/clang/test/CodeCompletion/end-of-file.cpp b/clang/test/CodeCompletion/end-of-file.cpp
new file mode 100644
index 00000000000..178ef4561f5
--- /dev/null
+++ b/clang/test/CodeCompletion/end-of-file.cpp
@@ -0,0 +1,7 @@
+// Check that clang does not crash when completing at the last char in the
+// buffer.
+// NOTE: This file must *NOT* have newline at the end.
+// RUN: %clang_cc1 -code-completion-at=%s:7:2 %s | FileCheck %s
+// CHECK: COMPLETION: foo
+using foo = int***;
+f \ No newline at end of file
OpenPOWER on IntegriCloud