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) {


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) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to