[PATCH] D78694: [clang-format] Fix lambda with ellipsis in return type
Pochang Chen via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 22 22:14:49 PDT 2020
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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78694.259475.patch
Type: text/x-patch
Size: 886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200423/ceefe5cb/attachment-0001.bin>
More information about the cfe-commits
mailing list