[PATCH] D137762: [clang-format] avoid breaking )( with BlockIndent

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 16 11:45:14 PST 2022


HazardyKnusperkeks accepted this revision.
HazardyKnusperkeks added a comment.

Thanks for your patience.
Please wait for @MyDeveloperDay .



================
Comment at: clang/unittests/Format/FormatTest.cpp:7215
   Style.AlignAfterOpenBracket = FormatStyle::BAS_DontAlign;
-  EXPECT_EQ(StringRef("functionCall(paramA, paramB,\n"
-                      "    paramC);\n"
-                      "void functionDecl(int A, int B,\n"
-                      "    int C);"),
-            format(Input, Style));
+  verifyFormat("functionCall(paramA, paramB,\n"
+               "    paramC);\n"
----------------
gedare wrote:
> HazardyKnusperkeks wrote:
> > Sorry for the confusion, you can (and should?) keep the `Input` variable. There is a verifyFormat with 4 arguments. So that the input in the formatting doesn't have to be the expected.
> Ok, I restored it in this function. I didn't add it to the other functions since they weren't using it already.  The vast majority of the calls to verifyFormat are using the 3-argument version. It's unclear what is preferred.
That depends. Most of the times the version with one string is enough. It verifies that:
* The input code is stable.
* It //messes up// the input and formats it.

The version with 2 strings does:
* Checks if the expected input is stable.
* Checks if the input is formatted to the expected.

The latter should be useful, if you want to verify what happens with your defined line breaks, that should not be stable, because https://github.com/llvm/llvm-project/blob/e989b8bb5fb36abac6e8f82809f06144dd762113/clang/unittests/Format/FormatTestUtils.h#L25 messup removes most of them.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137762



More information about the cfe-commits mailing list