[PATCH] D19063: clang-format: Fixed line merging of more than two lines

Maxime Beaulieu via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 13 13:34:19 PDT 2016


mxbOctasic added inline comments.

================
Comment at: unittests/Format/FormatTest.cpp:285
@@ +284,3 @@
+
+  EXPECT_EQ("class Foo\n"
+            "{\n"
----------------
djasper wrote:
> How does this break? I generally add an Before and After of one of the test cases into my patch descriptions.
This is a fun one.

The newline between `Foo() {}` and `void Funk() {}` is removed.
This is a combination of the line merge problem and `KeepEmptyLinesAtTheStartOfBlocks`.

`Last` on the merged line for `Foo() {}` points to `{` instead of `}`, so the newline before `void` is seen as a newline at the start of a block. (Checks `PreviousLine->Last->is(tok::l_brace)`)


http://reviews.llvm.org/D19063





More information about the cfe-commits mailing list