Skip to content

Commit

Permalink
[clang-format][NFC] Clean up tryToParseLambdaIntroducer()
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D124818
  • Loading branch information
owenca committed May 3, 2022
1 parent 88962f5 commit 3971880
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clang/lib/Format/UnwrappedLineParser.cpp
Expand Up @@ -1931,11 +1931,11 @@ bool UnwrappedLineParser::tryToParsePropertyAccessor() {
}

bool UnwrappedLineParser::tryToParseLambda() {
assert(FormatTok->is(tok::l_square));
if (!Style.isCpp()) {
nextToken();
return false;
}
assert(FormatTok->is(tok::l_square));
FormatToken &LSquare = *FormatTok;
if (!tryToParseLambdaIntroducer())
return false;
Expand Down Expand Up @@ -2037,20 +2037,20 @@ bool UnwrappedLineParser::tryToParseLambda() {

bool UnwrappedLineParser::tryToParseLambdaIntroducer() {
const FormatToken *Previous = FormatTok->Previous;
const FormatToken *LeftSquare = FormatTok;
nextToken();
if (Previous &&
(Previous->isOneOf(tok::identifier, tok::kw_operator, tok::kw_new,
tok::kw_delete, tok::l_square) ||
FormatTok->isCppStructuredBinding(Style) || Previous->closesScope() ||
LeftSquare->isCppStructuredBinding(Style) || Previous->closesScope() ||
Previous->isSimpleTypeSpecifier())) {
nextToken();
return false;
}
nextToken();
if (FormatTok->is(tok::l_square))
return false;
if (FormatTok->is(tok::r_square)) {
const FormatToken *Next = Tokens->peekNextToken();
if (Next && Next->is(tok::greater))
if (Next->is(tok::greater))
return false;
}
parseSquare(/*LambdaIntroducer=*/true);
Expand Down

0 comments on commit 3971880

Please sign in to comment.