mirror of
https://github.com/intel/llvm.git
synced 2026-01-14 03:50:17 +08:00
[clang-format] Treat lambda in braced init as inline (#135520)
Fix #125430
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -23722,6 +23722,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
|
||||
|
||||
Reference in New Issue
Block a user