[PATCH] D65149: [Format] Add test demonstrating PR42722

Brian Gesiak via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 07:24:52 PDT 2019


modocache created this revision.
modocache added reviewers: ank, klimek, acoomans.
Herald added a project: clang.

https://bugs.llvm.org/show_bug.cgi?id=42722 describes what I believe to
be a bug in lambda formatting. If it is indeed a bug, I'd like to commit
this test that reliably reproduces it. I'll try in the coming days to
then fix the behavior and update this test to demonstrate the correct
behavior (but if anyone fixes it before I do, this test will help them
too, I think).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65149

Files:
  clang/unittests/Format/FormatTest.cpp


Index: clang/unittests/Format/FormatTest.cpp
===================================================================
--- clang/unittests/Format/FormatTest.cpp
+++ clang/unittests/Format/FormatTest.cpp
@@ -5173,6 +5173,17 @@
                "           \"bbbb\");\n"
                "}",
                getLLVMStyleWithColumns(30));
+  verifyFormat("testPR42722() {\n"
+               "  int c = 19;\n"
+               "  int d = 32;\n"
+               "  Executor ex;\n"
+               "  ex.addFuture([]() {\n"
+               "      throw std::runtime_error(\"oops\");\n"
+               "    }).then([](Result &&result) {\n"
+               "    c++;\n"
+               "    d++\n"
+               "  });\n"
+               "}");
 }
 
 TEST_F(FormatTest, BreaksAccordingToOperatorPrecedence) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65149.211297.patch
Type: text/x-patch
Size: 795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190723/6f3a5b6d/attachment.bin>


More information about the cfe-commits mailing list