clang-format: Support commas in lambda return types.
authorDaniel Jasper <djasper@google.com>
Mon, 8 Dec 2014 13:22:37 +0000 (13:22 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 8 Dec 2014 13:22:37 +0000 (13:22 +0000)
Before:
  auto next_pair = [](A * a) -> pair<A*, A*>{};

After:
  auto next_pair = [](A* a) -> pair<A*, A*>{};

llvm-svn: 223652

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

index d0c899f..6ff5405 100644 (file)
@@ -880,6 +880,7 @@ bool UnwrappedLineParser::tryToParseLambda() {
     case tok::amp:
     case tok::star:
     case tok::kw_const:
+    case tok::comma:
     case tok::less:
     case tok::greater:
     case tok::identifier:
index 8664711..7ca7978 100644 (file)
@@ -9378,6 +9378,7 @@ TEST_F(FormatTest, FormatsLambdas) {
   verifyFormat("int c = []() -> vector<int> { return {2}; }();\n");
   verifyFormat("Foo([]() -> std::vector<int> { return {2}; }());");
   verifyGoogleFormat("auto a = [&b, c](D* d) -> D* {};");
+  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("auto aaaaaaaa = [](int i, // break for some reason\n"