forked from OSchip/llvm-project
clang-format: Always add space before lambda-{
Before: int c = []() -> int *{ return 2; }(); After: int c = []() -> int * { return 2; }(); Based on patch by James Dennett (http://reviews.llvm.org/D10410), thank you! llvm-svn: 239600
This commit is contained in:
parent
d9e39d53b6
commit
60ba32d453
|
@ -1800,6 +1800,7 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
|
|||
return true;
|
||||
if (Left.is(TT_PointerOrReference))
|
||||
return Right.Tok.isLiteral() || Right.is(TT_BlockComment) ||
|
||||
(Right.is(tok::l_brace) && Right.BlockKind == BK_Block) ||
|
||||
(!Right.isOneOf(TT_PointerOrReference, TT_ArraySubscriptLSquare,
|
||||
tok::l_paren) &&
|
||||
(Style.PointerAlignment != FormatStyle::PAS_Right &&
|
||||
|
|
|
@ -10098,6 +10098,7 @@ TEST_F(FormatTest, FormatsLambdas) {
|
|||
|
||||
// Lambdas with return types.
|
||||
verifyFormat("int c = []() -> int { return 2; }();\n");
|
||||
verifyFormat("int c = []() -> int * { return 2; }();\n");
|
||||
verifyFormat("int c = []() -> vector<int> { return {2}; }();\n");
|
||||
verifyFormat("Foo([]() -> std::vector<int> { return {2}; }());");
|
||||
verifyGoogleFormat("auto a = [&b, c](D* d) -> D* {};");
|
||||
|
|
Loading…
Reference in New Issue