[PATCH] D71512: [clang-format] Fix short block when braking after control statement

Pablo Martin-Gomez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 21 08:37:51 PST 2019


Bouska added inline comments.


================
Comment at: clang/unittests/Format/FormatTest.cpp:586
   verifyFormat("if (true) {\n"
-               "  ffffffffffffffffffffffffffffffffffffffffffffffffffffff();\n"
                "}",
----------------
MyDeveloperDay wrote:
> any reason you are changing existing tests?
According to the change that added this test (https://reviews.llvm.org/D37140?id=113074), this test was made to check that "the wrapping is forced by exceeding the column limit". This should be check at the limit condition when the control statement + the block exceed the column limit by a few characters. With the current test, the length of the block statement alone is sufficient to force the wrapping, that's why with the current code this test has the expected wrapping.

Even my change is incorrect, with the control statement, the curly braces, the spaces and the statement, it is way above the column limit of 40. I'm going to fix that. Alternatively, I just could add another test with the correct length.   


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71512





More information about the cfe-commits mailing list