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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 13 06:07:59 PST 2022


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:5006-5010
+    return !((Previous && (Previous->is(tok::kw_for) || Previous->isIf())) ||
+             (Right.Next &&
+              (Right.Next->is(tok::l_paren) ||
+               (Right.Next->is(tok::r_paren) &&
+                (Right.NestingLevel == 0 || Previous->is(tok::star))))));
----------------
gedare wrote:
> HazardyKnusperkeks wrote:
> > This is horrible to read.
> > 
> > Could you split this into multiple statements? Maybe with lambdas, I don't know.
> > 
> > But I have no intention to ever understand that condition.
> Sure. I was just following the prevailing style in this code base. I'll refactor.
> Sure. I was just following the prevailing style in this code base. I'll refactor.

No problem. We have some of this occurrences.


================
Comment at: clang/unittests/Format/FormatTest.cpp:7237-7243
+  EXPECT_EQ(StringRef("functionCall(\n"
+                      "    paramA, paramB, paramC\n"
+                      ");\n"
+                      "void functionDecl(\n"
+                      "    int A, int B, int C\n"
+                      ");"),
+            format(Input, Style));
----------------
I know you copy what is there, but could you use verifyFormat? You can port the other checks also, but are not obligated to.


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