From 3431b7506939e742197fe803f9db412061778f2f Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 8 Dec 2014 13:22:37 +0000 Subject: [PATCH] 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 --- clang/lib/Format/UnwrappedLineParser.cpp | 1 + clang/unittests/Format/FormatTest.cpp | 1 + 2 files changed, 2 insertions(+) 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" -- 2.7.4