// BlockKind later if we parse a braced list (where all blocks
// inside are by default braced lists), or when we explicitly detect
// blocks (for example while parsing lambdas).
- //
- // We exclude + and - as they can be ObjC visibility modifiers.
ProbablyBracedList =
(Style.Language == FormatStyle::LK_JavaScript &&
NextTok->isOneOf(Keywords.kw_of, Keywords.kw_in,
NextTok->isOneOf(tok::comma, tok::period, tok::colon,
tok::r_paren, tok::r_square, tok::l_brace,
tok::l_square, tok::l_paren, tok::ellipsis) ||
+ (NextTok->is(tok::identifier) &&
+ !PrevTok->isOneOf(tok::semi, tok::r_brace, tok::l_brace)) ||
(NextTok->is(tok::semi) &&
(!ExpectClassBody || LBraceStack.size() != 1)) ||
(NextTok->isBinaryOperator() && !NextIsObjCMethod);
"};");
verifyFormat("#define A {a, a},");
+ // Cases where distinguising braced lists and blocks is hard.
+ verifyFormat("vector<int> v{12} GUARDED_BY(mutex);");
+ verifyFormat("void f() {\n"
+ " return; // comment\n"
+ "}\n"
+ "SomeType t;");
+ verifyFormat("void f() {\n"
+ " if (a) {\n"
+ " f();\n"
+ " }\n"
+ "}\n"
+ "SomeType t;");
+
// In combination with BinPackArguments = false.
FormatStyle NoBinPacking = getLLVMStyle();
NoBinPacking.BinPackArguments = false;