clang-format: Fix another false positive in the lambda detection.

Before:
  int i = (*b)[a] -> f();

After:
  int i = (*b)[a]->f();

llvm-svn: 203557
This commit is contained in:
Daniel Jasper 2014-03-11 10:03:33 +00:00
parent d3c7ab975f
commit a58dd5db29
2 changed files with 3 additions and 2 deletions

View File

@ -758,8 +758,8 @@ bool UnwrappedLineParser::tryToParseLambda() {
// FIXME: This is a dirty way to access the previous token. Find a better // FIXME: This is a dirty way to access the previous token. Find a better
// solution. // solution.
if (!Line->Tokens.empty() && if (!Line->Tokens.empty() &&
(Line->Tokens.back().Tok->isOneOf(tok::identifier, tok::kw_operator, (Line->Tokens.back().Tok->isOneOf(tok::identifier, tok::kw_operator) ||
tok::r_square) || Line->Tokens.back().Tok->closesScope() ||
Line->Tokens.back().Tok->isSimpleTypeSpecifier())) { Line->Tokens.back().Tok->isSimpleTypeSpecifier())) {
nextToken(); nextToken();
return false; return false;

View File

@ -7981,6 +7981,7 @@ TEST_F(FormatTest, FormatsLambdas) {
"int i;"); "int i;");
verifyFormat("std::unique_ptr<int[]> foo() {}"); verifyFormat("std::unique_ptr<int[]> foo() {}");
verifyFormat("int i = a[a][a]->f();"); verifyFormat("int i = a[a][a]->f();");
verifyFormat("int i = (*b)[a]->f();");
// Other corner cases. // Other corner cases.
verifyFormat("void f() {\n" verifyFormat("void f() {\n"