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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 11 12:05:00 PST 2022


HazardyKnusperkeks added a comment.

In D137762#3919092 <https://reviews.llvm.org/D137762#3919092>, @MyDeveloperDay wrote:

> Definitely needs tests

Could you please add tests in the `clang/unittests/Format/FormatTest.cpp` file?



================
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))))));
----------------
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.


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