forked from OSchip/llvm-project
Cut off parsing early during code completion
These calls to ConsumeCodeCompletionToken() caused parsing to continue needlessly when an immediate cutOffParsing() would do. Document the function to clarify its correct usage. llvm-svn: 207823
This commit is contained in:
parent
b6d4e8cd4e
commit
1c583cc668
|
@ -419,8 +419,9 @@ private:
|
|||
|
||||
/// \brief Consume the current code-completion token.
|
||||
///
|
||||
/// This routine should be called to consume the code-completion token once
|
||||
/// a code-completion action has already been invoked.
|
||||
/// This routine can be called to consume the code-completion token and
|
||||
/// continue processing in special cases where \c cutOffParsing() isn't
|
||||
/// desired, such as token caching or completion with lookahead.
|
||||
SourceLocation ConsumeCodeCompletionToken() {
|
||||
assert(Tok.is(tok::code_completion));
|
||||
PrevTokLocation = Tok.getLocation();
|
||||
|
|
|
@ -767,7 +767,7 @@ Optional<unsigned> Parser::ParseLambdaIntroducer(LambdaIntroducer &Intro,
|
|||
!Intro.Captures.empty())) {
|
||||
Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
|
||||
/*AfterAmpersand=*/false);
|
||||
ConsumeCodeCompletionToken();
|
||||
cutOffParsing();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -784,7 +784,7 @@ Optional<unsigned> Parser::ParseLambdaIntroducer(LambdaIntroducer &Intro,
|
|||
else
|
||||
Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
|
||||
/*AfterAmpersand=*/false);
|
||||
ConsumeCodeCompletionToken();
|
||||
cutOffParsing();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -808,7 +808,7 @@ Optional<unsigned> Parser::ParseLambdaIntroducer(LambdaIntroducer &Intro,
|
|||
if (Tok.is(tok::code_completion)) {
|
||||
Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
|
||||
/*AfterAmpersand=*/true);
|
||||
ConsumeCodeCompletionToken();
|
||||
cutOffParsing();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1896,8 +1896,7 @@ Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) {
|
|||
if (!Tok.is(tok::identifier)) {
|
||||
if (Tok.is(tok::code_completion)) {
|
||||
Actions.CodeCompleteModuleImport(ImportLoc, Path);
|
||||
ConsumeCodeCompletionToken();
|
||||
SkipUntil(tok::semi);
|
||||
cutOffParsing();
|
||||
return DeclGroupPtrTy();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue