[PATCH] D126524: [CompilerInstance] Fix weird condition on `createCodeCompletionConsumer`

Yuki Okushi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 27 04:59:03 PDT 2022


JohnTitor updated this revision to Diff 432526.
JohnTitor added a comment.

[CompilerInstance] Tweak the condition on `createCodeCompletionConsumer`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126524/new/

https://reviews.llvm.org/D126524

Files:
  clang/lib/Frontend/CompilerInstance.cpp


Index: clang/lib/Frontend/CompilerInstance.cpp
===================================================================
--- clang/lib/Frontend/CompilerInstance.cpp
+++ clang/lib/Frontend/CompilerInstance.cpp
@@ -710,15 +710,12 @@
 void CompilerInstance::createCodeCompletionConsumer() {
   const ParsedSourceLocation &Loc = getFrontendOpts().CodeCompletionAt;
   if (!CompletionConsumer) {
-    setCodeCompletionConsumer(
-      createCodeCompletionConsumer(getPreprocessor(),
-                                   Loc.FileName, Loc.Line, Loc.Column,
-                                   getFrontendOpts().CodeCompleteOpts,
-                                   llvm::outs()));
-    if (!CompletionConsumer)
-      return;
-  } else if (EnableCodeCompletion(getPreprocessor(), Loc.FileName,
-                                  Loc.Line, Loc.Column)) {
+    setCodeCompletionConsumer(createCodeCompletionConsumer(
+        getPreprocessor(), Loc.FileName, Loc.Line, Loc.Column,
+        getFrontendOpts().CodeCompleteOpts, llvm::outs()));
+    return;
+  } else if (EnableCodeCompletion(getPreprocessor(), Loc.FileName, Loc.Line,
+                                  Loc.Column)) {
     setCodeCompletionConsumer(nullptr);
     return;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126524.432526.patch
Type: text/x-patch
Size: 1227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220527/195db7d8/attachment-0001.bin>


More information about the cfe-commits mailing list