Author: mydeveloperday Date: 2020-04-30T11:02:42+01:00 New Revision: 14198ccfb3837a2972d39ac446454ca5f175838c
URL: https://github.com/llvm/llvm-project/commit/14198ccfb3837a2972d39ac446454ca5f175838c DIFF: https://github.com/llvm/llvm-project/commit/14198ccfb3837a2972d39ac446454ca5f175838c.diff LOG: [clang-format] Fix lambda with ellipsis in return type Summary: BTW my actual code that hit this issue is like ``` [a, b = std::move(b)](auto &&... c) mutable -> std::invoke_result_t<decltype(b), decltype(c)...> { /* omitted */ } ``` where this explicit return type is required for SFINAE. Reviewed By: krasimir, MyDeveloperDay Patch By: johnchen902 Subscribers: krasimir, dexonsmith, cfe-commits Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D78694 Added: Modified: clang/lib/Format/UnwrappedLineParser.cpp clang/unittests/Format/FormatTest.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 4734ff16921b..658773c10072 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -1646,6 +1646,7 @@ bool UnwrappedLineParser::tryToParseLambda() { case tok::lessequal: case tok::question: case tok::colon: + case tok::ellipsis: case tok::kw_true: case tok::kw_false: if (SeenArrow) { diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 1cd12476d788..ace4113393f0 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -14125,6 +14125,8 @@ TEST_F(FormatTest, FormatsLambdas) { " -> int {\n" " return 1; //\n" "};"); + verifyFormat("[]() -> Void<T...> {};"); + verifyFormat("[a, b]() -> Tuple<T...> { return {}; };"); // Lambdas with explicit template argument lists. verifyFormat( _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits