]> granicus.if.org Git - clang/commitdiff
clang-format: Fix incorrect lambda-detection.
authorDaniel Jasper <djasper@google.com>
Thu, 13 Aug 2015 13:37:08 +0000 (13:37 +0000)
committerDaniel Jasper <djasper@google.com>
Thu, 13 Aug 2015 13:37:08 +0000 (13:37 +0000)
Before:
  [ a, a ]() -> a<1>{};

After:
  [a, a]() -> a<1> {};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@244890 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTest.cpp

index e705c98c67b661078efebf17e94a868c49b8891e..1bea7a9500e3af3fe55b3c0cc98c77626266f8ba 100644 (file)
@@ -1000,6 +1000,7 @@ bool UnwrappedLineParser::tryToParseLambda() {
     case tok::less:
     case tok::greater:
     case tok::identifier:
+    case tok::numeric_constant:
     case tok::coloncolon:
     case tok::kw_mutable:
       nextToken();
index 6eee541d0ba7e4c8c0466a31e268487a94fd7f07..6fd07b9a445d098aca58b41f4ae63ab5d9f0419b 100644 (file)
@@ -10003,6 +10003,7 @@ TEST_F(FormatTest, FormatsLambdas) {
   verifyGoogleFormat("auto a = [&b, c](D* d) -> pair<D*, D*> {};");
   verifyGoogleFormat("auto a = [&b, c](D* d) -> D& {};");
   verifyGoogleFormat("auto a = [&b, c](D* d) -> const D* {};");
+  verifyFormat("[a, a]() -> a<1> {};");
   verifyFormat("auto aaaaaaaa = [](int i, // break for some reason\n"
                "                   int j) -> int {\n"
                "  return ffffffffffffffffffffffffffffffffffffffffffff(i * j);\n"