[PATCH] D109557: Adds a BlockIndent option to AlignAfterOpenBracket

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 25 02:41:59 PDT 2021


HazardyKnusperkeks added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:227
   correctly places the opening brace according to ``BraceWrapping.AfterEnum``.
+- Option ``AlignAfterOpenBracket: BlockIndent`` has been added. If set, it will
+  always break after an open bracket, if the parameters don't fit on a single
----------------
Add a new line before.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4207-4212
+  if (Right.is(tok::r_paren) && Right.MatchingParen &&
+      !(Right.MatchingParen->Previous &&
+        (Right.MatchingParen->Previous->is(tok::kw_for) ||
+         Right.MatchingParen->Previous->isIf())))
+    return Style.AlignAfterOpenBracket == FormatStyle::BAS_BlockIndent;
+
----------------
I'm not sure if this is sufficient. Before we returned always false. Shouldn't we use 2 ifs here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109557



More information about the cfe-commits mailing list