[PATCH] D47521: [clang-format] Fix parsing lambdas with noexcept

Attila via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 30 02:34:02 PDT 2018


Uran198 created this revision.
Uran198 added reviewers: klimek, djasper.

Repository:
  rC Clang

https://reviews.llvm.org/D47521

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


Index: unittests/Format/FormatTest.cpp
===================================================================
--- unittests/Format/FormatTest.cpp
+++ unittests/Format/FormatTest.cpp
@@ -11522,6 +11522,12 @@
                "      ;\n"
                "};");
 
+  verifyFormat("if (a && []() noexcept {\n"
+               "      doo_dah();\n"
+               "      doo_dah();\n"
+               "    }()) {\n"
+               "}");
+
   // Lambdas with complex multiline introducers.
   verifyFormat(
       "aaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
Index: lib/Format/UnwrappedLineParser.cpp
===================================================================
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -1387,6 +1387,7 @@
     case tok::amp:
     case tok::star:
     case tok::kw_const:
+    case tok::kw_noexcept:
     case tok::comma:
     case tok::less:
     case tok::greater:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47521.149066.patch
Type: text/x-patch
Size: 924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180530/0f57cd73/attachment.bin>


More information about the cfe-commits mailing list