summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeCompletion/inside-macros.cpp
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2018-01-22 17:18:28 +0000
committerIlya Biryukov <ibiryukov@google.com>2018-01-22 17:18:28 +0000
commitb8f231a42cbe8deb4113811a0b8bada39be54ecc (patch)
tree60c155aab095c475b21a66b739c352bc932e9c4f /clang/test/CodeCompletion/inside-macros.cpp
parent29aced1baed029fa3f68c103ca203546033d0b6f (diff)
downloadbcm5719-llvm-b8f231a42cbe8deb4113811a0b8bada39be54ecc.tar.gz
bcm5719-llvm-b8f231a42cbe8deb4113811a0b8bada39be54ecc.zip
[CodeComplete] Fix completion in the middle of idents in macro calls
Summary: This patch removes IdentifierInfo from completion token after remembering the identifier in the preprocessor. Prior to this patch, completion token had the IdentifierInfo set to null when completing at the start of identifier and to the II for completion prefix when in the middle of identifier. This patch unifies how code completion token is handled when it is insterted before the identifier and in the middle of the identifier. The actual IdentifierInfo can still be obtained from the Preprocessor. Reviewers: bkramer, arphaman Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42241 llvm-svn: 323133
Diffstat (limited to 'clang/test/CodeCompletion/inside-macros.cpp')
-rw-r--r--clang/test/CodeCompletion/inside-macros.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/CodeCompletion/inside-macros.cpp b/clang/test/CodeCompletion/inside-macros.cpp
new file mode 100644
index 00000000000..dc40c6ad318
--- /dev/null
+++ b/clang/test/CodeCompletion/inside-macros.cpp
@@ -0,0 +1,13 @@
+#define ID(X) X
+
+void test(bool input_var) {
+ ID(input_var) = true;
+ // Check that input_var shows up when completing at the start, in the middle
+ // and at the end of the identifier.
+ //
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:6 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:8 %s -o - | FileCheck %s
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:15 %s -o - | FileCheck %s
+
+ // CHECK: input_var
+}
OpenPOWER on IntegriCloud