These calls to ConsumeCodeCompletionToken() caused parsing to continue
needlessly when an immediate cutOffParsing() would do.
Document the function to clarify its correct usage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207823
91177308-0d34-0410-b5e6-
96231b3b80d8
/// \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();
!Intro.Captures.empty())) {
Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
/*AfterAmpersand=*/false);
- ConsumeCodeCompletionToken();
+ cutOffParsing();
break;
}
else
Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
/*AfterAmpersand=*/false);
- ConsumeCodeCompletionToken();
+ cutOffParsing();
break;
}
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro,
/*AfterAmpersand=*/true);
- ConsumeCodeCompletionToken();
+ cutOffParsing();
break;
}
}
if (!Tok.is(tok::identifier)) {
if (Tok.is(tok::code_completion)) {
Actions.CodeCompleteModuleImport(ImportLoc, Path);
- ConsumeCodeCompletionToken();
- SkipUntil(tok::semi);
+ cutOffParsing();
return DeclGroupPtrTy();
}