From: Daniel Jasper Date: Mon, 8 Dec 2014 13:22:37 +0000 (+0000) Subject: clang-format: Support commas in lambda return types. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3431b7506939e742197fe803f9db412061778f2f;p=platform%2Fupstream%2Fllvm.git clang-format: Support commas in lambda return types. Before: auto next_pair = [](A * a) -> pair{}; After: auto next_pair = [](A* a) -> pair{}; llvm-svn: 223652 --- diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index d0c899f..6ff5405 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -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: diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 8664711..7ca7978 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -9378,6 +9378,7 @@ TEST_F(FormatTest, FormatsLambdas) { verifyFormat("int c = []() -> vector { return {2}; }();\n"); verifyFormat("Foo([]() -> std::vector { return {2}; }());"); verifyGoogleFormat("auto a = [&b, c](D* d) -> D* {};"); + verifyGoogleFormat("auto a = [&b, c](D* d) -> pair {};"); 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"