r244890 - clang-format: Fix incorrect lambda-detection.

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 13 06:37:09 PDT 2015


Author: djasper
Date: Thu Aug 13 08:37:08 2015
New Revision: 244890

URL: http://llvm.org/viewvc/llvm-project?rev=244890&view=rev
Log:
clang-format: Fix incorrect lambda-detection.

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

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

Modified:
    cfe/trunk/lib/Format/UnwrappedLineParser.cpp
    cfe/trunk/unittests/Format/FormatTest.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=244890&r1=244889&r2=244890&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Thu Aug 13 08:37:08 2015
@@ -1000,6 +1000,7 @@ bool UnwrappedLineParser::tryToParseLamb
     case tok::less:
     case tok::greater:
     case tok::identifier:
+    case tok::numeric_constant:
     case tok::coloncolon:
     case tok::kw_mutable:
       nextToken();

Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=244890&r1=244889&r2=244890&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Aug 13 08:37:08 2015
@@ -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"




More information about the cfe-commits mailing list