[CompilerInstance] Fix weird condition on `createCodeCompletionConsumer`

Fixes llvm#53545

Differential Revision: https://reviews.llvm.org/D126524
This commit is contained in:
Yuki Okushi 2022-05-27 17:42:49 +09:00
parent 3b4500014a
commit d3d3e2528e
No known key found for this signature in database
GPG Key ID: 379CEEFDD63E5DD7
1 changed files with 4 additions and 7 deletions

View File

@ -710,13 +710,10 @@ static bool EnableCodeCompletion(Preprocessor &PP,
void CompilerInstance::createCodeCompletionConsumer() { void CompilerInstance::createCodeCompletionConsumer() {
const ParsedSourceLocation &Loc = getFrontendOpts().CodeCompletionAt; const ParsedSourceLocation &Loc = getFrontendOpts().CodeCompletionAt;
if (!CompletionConsumer) { if (!CompletionConsumer) {
setCodeCompletionConsumer( setCodeCompletionConsumer(createCodeCompletionConsumer(
createCodeCompletionConsumer(getPreprocessor(), getPreprocessor(), Loc.FileName, Loc.Line, Loc.Column,
Loc.FileName, Loc.Line, Loc.Column, getFrontendOpts().CodeCompleteOpts, llvm::outs()));
getFrontendOpts().CodeCompleteOpts, return;
llvm::outs()));
if (!CompletionConsumer)
return;
} else if (EnableCodeCompletion(getPreprocessor(), Loc.FileName, } else if (EnableCodeCompletion(getPreprocessor(), Loc.FileName,
Loc.Line, Loc.Column)) { Loc.Line, Loc.Column)) {
setCodeCompletionConsumer(nullptr); setCodeCompletionConsumer(nullptr);