[PATCH] D58922: [clang-format] broken after lambda with return type template with boolean literal

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 14:19:34 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC355450: [clang-format] broken after lambda with return type template with boolean… (authored by paulhoad, committed by ).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D58922?vs=189190&id=189399#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58922/new/

https://reviews.llvm.org/D58922

Files:
  lib/Format/UnwrappedLineParser.cpp
  unittests/Format/FormatTest.cpp


Index: lib/Format/UnwrappedLineParser.cpp
===================================================================
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -1442,6 +1442,8 @@
     case tok::lessequal:
     case tok::question:
     case tok::colon:
+    case tok::kw_true:
+    case tok::kw_false:
       nextToken();
       break;
     case tok::arrow:
Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11936,6 +11936,21 @@
               "// broken:\n"
               "auto foo{[]() -> foo<2 ? 1 : 0> { return {}; }};\n"
               "} // namespace bar");
+  verifyFormat("[]() -> a<1> {};");
+  verifyFormat("[]() -> a<1> { ; };");
+  verifyFormat("[]() -> a<1> { ; }();");
+  verifyFormat("[a, a]() -> a<true> {};");
+  verifyFormat("[]() -> a<true> {};");
+  verifyFormat("[]() -> a<true> { ; };");
+  verifyFormat("[]() -> a<true> { ; }();");
+  verifyFormat("[a, a]() -> a<false> {};");
+  verifyFormat("[]() -> a<false> {};");
+  verifyFormat("[]() -> a<false> { ; };");
+  verifyFormat("[]() -> a<false> { ; }();");
+  verifyFormat("auto foo{[]() -> foo<false> { ; }};");
+  verifyFormat("namespace bar {\n"
+               "auto foo{[]() -> foo<false> { ; }};\n"
+               "} // namespace bar");
   verifyFormat("auto aaaaaaaa = [](int i, // break for some reason\n"
                "                   int j) -> int {\n"
                "  return ffffffffffffffffffffffffffffffffffffffffffff(i * j);\n"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58922.189399.patch
Type: text/x-patch
Size: 1590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190305/c743b5b4/attachment.bin>


More information about the cfe-commits mailing list