clang-format: Quickfix for braced init lists detected as lambdas.
Before:
constexpr char hello [] { "hello" };
After:
constexpr char hello[]{ "hello" };
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190046 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index 13b9847..5029bd6 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -674,6 +674,12 @@
}
void UnwrappedLineParser::tryToParseLambda() {
+ // FIXME: This is a dirty way to access the previous token. Find a better
+ // solution.
+ if (!Line->Tokens.empty() && Line->Tokens.back().Tok->is(tok::identifier)) {
+ nextToken();
+ return;
+ }
assert(FormatTok->is(tok::l_square));
FormatToken &LSquare = *FormatTok;
if (!tryToParseLambdaIntroducer())