[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)
Gedare Bloom via cfe-commits
cfe-commits at lists.llvm.org
Thu May 22 07:10:21 PDT 2025
================
@@ -3373,6 +3409,51 @@ the configuration (without a prefix: ``Auto``).
+.. _BreakBeforeCloseBracketIf:
+
+**BreakBeforeCloseBracketIf** (``Boolean``) :versionbadge:`clang-format 21` :ref:`¶ <BreakBeforeCloseBracketIf>`
+ Force break before the right parenthesis of an if control statement
+ when the expression exceeds the column limit. The break before the
+ closing parenthesis is only made if there is a break after the opening
+ parenthesis.
+
+ .. code-block:: c++
+
+ true: false:
+ if constexpr ( vs. if constexpr (a ||
+ a || b b)
+ )
+
+.. _BreakBeforeCloseBracketLoop:
+
+**BreakBeforeCloseBracketLoop** (``Boolean``) :versionbadge:`clang-format 21` :ref:`¶ <BreakBeforeCloseBracketLoop>`
+ Force break before the right parenthesis of a loop control statement
+ when the expression exceeds the column limit. The break before the
+ closing parenthesis is only made if there is a break after the opening
+ parenthesis.
+
+ .. code-block:: c++
+
+ true: false:
+ while ( vs. while (a &&
----------------
gedare wrote:
as above. If the formatter decides to break after the `(` for any reason (e.g., because of `BreakAfterOpenBracketLoop` or because the first token exceeds the `ColumnLimit`), the `BreakBeforeCloseBracketLoop` will be in effect for the closing `)`.
https://github.com/llvm/llvm-project/pull/108332
More information about the cfe-commits
mailing list