johnchen902 created this revision. johnchen902 added a project: clang-format. Herald added a project: clang. Herald added a subscriber: cfe-commits. johnchen902 retitled this revision from "[Format] Fix lambda with ellipsis in return type" to "[clang-format] Fix lambda with ellipsis in return type". johnchen902 edited the summary of this revision. johnchen902 added a reviewer: jkorous. Herald added a subscriber: dexonsmith.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D78694 Files: clang/lib/Format/UnwrappedLineParser.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -14111,6 +14111,8 @@ " -> int {\n" " return 1; //\n" "};"); + verifyFormat("[]() -> Void<T...> {};"); + verifyFormat("[a, b]() -> Tuple<T...> { return {}; };"); // Lambdas with explicit template argument lists. verifyFormat( Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -1557,6 +1557,7 @@ case tok::lessequal: case tok::question: case tok::colon: + case tok::ellipsis: case tok::kw_true: case tok::kw_false: if (SeenArrow) {
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -14111,6 +14111,8 @@ " -> int {\n" " return 1; //\n" "};"); + verifyFormat("[]() -> Void<T...> {};"); + verifyFormat("[a, b]() -> Tuple<T...> { return {}; };"); // Lambdas with explicit template argument lists. verifyFormat( Index: clang/lib/Format/UnwrappedLineParser.cpp =================================================================== --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -1557,6 +1557,7 @@ case tok::lessequal: case tok::question: case tok::colon: + case tok::ellipsis: case tok::kw_true: case tok::kw_false: if (SeenArrow) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits