Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion clang/lib/Format/TokenAnnotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5569,7 +5569,8 @@ static bool isAllmanBrace(const FormatToken &Tok) {
// Returns 'true' if 'Tok' is a function argument.
static bool IsFunctionArgument(const FormatToken &Tok) {
return Tok.MatchingParen && Tok.MatchingParen->Next &&
Tok.MatchingParen->Next->isOneOf(tok::comma, tok::r_paren);
Tok.MatchingParen->Next->isOneOf(tok::comma, tok::r_paren,
tok::r_brace);
}

static bool
Expand Down
1 change: 1 addition & 0 deletions clang/unittests/Format/FormatTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23712,6 +23712,7 @@ TEST_F(FormatTest, FormatsLambdas) {
verifyFormat("function([]() { return b; })", MergeInline);
verifyFormat("function([]() { return b; }, a)", MergeInline);
verifyFormat("function(a, []() { return b; })", MergeInline);
verifyFormat("auto guard = foo{[&] { exit_status = true; }};", MergeInline);

// Check option "BraceWrapping.BeforeLambdaBody" and different state of
// AllowShortLambdasOnASingleLine
Expand Down