Before:
int c = []()->int { return 2; }();
After:
int c = []() -> int { return 2; }();
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203452
91177308-0d34-0410-b5e6-
96231b3b80d8
// recovered from an error (e.g. failure to find the matching >).
if (CurrentToken->Type != TT_LambdaLSquare &&
CurrentToken->Type != TT_FunctionLBrace &&
- CurrentToken->Type != TT_ImplicitStringLiteral)
+ CurrentToken->Type != TT_ImplicitStringLiteral &&
+ CurrentToken->Type != TT_TrailingReturnArrow)
CurrentToken->Type = TT_Unknown;
if (CurrentToken->Role)
CurrentToken->Role.reset(NULL);
case tok::identifier:
case tok::coloncolon:
case tok::kw_mutable:
+ nextToken();
+ break;
case tok::arrow:
+ FormatTok->Type = TT_TrailingReturnArrow;
nextToken();
break;
default:
"}\n");
// Lambdas with return types.
- verifyFormat("int c = []()->int { return 2; }();\n");
- verifyFormat("int c = []()->vector<int> { return {2}; }();\n");
- verifyFormat("Foo([]()->std::vector<int> { return {2}; }());");
+ verifyFormat("int c = []() -> int { return 2; }();\n");
+ verifyFormat("int c = []() -> vector<int> { return {2}; }();\n");
+ verifyFormat("Foo([]() -> std::vector<int> { return {2}; }());");
// Not lambdas.
verifyFormat("constexpr char hello[]{\"hello\"};");