[PATCH] D64864: [CodeComplete] Fix ASTUnit cached completion of macros from preamble, broken in r342528
Sam McCall via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 00:21:32 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL366409: [CodeComplete] Fix ASTUnit cached completion of macros from preamble, broken in… (authored by sammccall, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D64864?vs=210307&id=210491#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64864/new/
https://reviews.llvm.org/D64864
Files:
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/test/Index/complete-macros.c
cfe/trunk/test/Index/complete-macros.h
Index: cfe/trunk/test/Index/complete-macros.h
===================================================================
--- cfe/trunk/test/Index/complete-macros.h
+++ cfe/trunk/test/Index/complete-macros.h
@@ -2,5 +2,6 @@
#define COMPLETE_MACROS_H_GUARD
void in_header(int);
+#define MACRO_IN_HEADER 1
#endif
Index: cfe/trunk/test/Index/complete-macros.c
===================================================================
--- cfe/trunk/test/Index/complete-macros.c
+++ cfe/trunk/test/Index/complete-macros.c
@@ -28,7 +28,10 @@
// RUN: c-index-test -code-completion-at=%s:7:1 %s -I%S | FileCheck -check-prefix=CHECK-CC0 %s
// CHECK-CC0-NOT: FOO
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:1 %s -I%S | FileCheck -check-prefix=CHECK-CC1 %s
+// (we had a regression that only occurred when parsing as C++, so check that too)
+// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:7:1 -x c++ %s -I%S | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: macro definition:{TypedText FOO} (70)
+// CHECK-CC1: macro definition:{TypedText MACRO_IN_HEADER} (70)
// RUN: c-index-test -code-completion-at=%s:13:13 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
// RUN: c-index-test -code-completion-at=%s:14:8 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
// RUN: env CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_CACHING=1 c-index-test -code-completion-at=%s:14:8 %s -I%S | FileCheck -check-prefix=CHECK-CC2 %s
Index: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp
@@ -8603,8 +8603,7 @@
if (!CodeCompleter || CodeCompleter->includeMacros())
AddMacroResults(PP, Results,
- CodeCompleter ? CodeCompleter->loadExternal() : false,
- true);
+ !CodeCompleter || CodeCompleter->loadExternal(), true);
// defined (<macro>)
Results.EnterNewScope();
@@ -8801,8 +8800,7 @@
if (!CodeCompleter || CodeCompleter->includeMacros())
AddMacroResults(PP, Builder,
- CodeCompleter ? CodeCompleter->loadExternal() : false,
- true);
+ !CodeCompleter || CodeCompleter->loadExternal(), true);
Results.clear();
Results.insert(Results.end(), Builder.data(),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64864.210491.patch
Type: text/x-patch
Size: 2432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190718/7b6279e1/attachment.bin>
More information about the llvm-commits
mailing list