[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

Gedare Bloom via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 15:13:27 PST 2025


================
@@ -1169,6 +1181,18 @@ template <> struct MappingTraits<FormatStyle> {
     IO.mapOptional("WhitespaceSensitiveMacros",
                    Style.WhitespaceSensitiveMacros);
 
+    // If AlignAfterOpenBracket was specified but AlignAfterOpenBracketBreak
+    // was not, initialize the latter for backwards compatibility.
+    if ((Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak ||
+         Style.AlignAfterOpenBracket == FormatStyle::BAS_BlockIndent) &&
+        Style.AlignAfterOpenBracketBreak ==
+            FormatStyle::AlignAfterOpenBracketCustom()) {
----------------
gedare wrote:

Oh. I misunderstood this question at first. I guess it is possible, but it is not likely, for someone to explicitly set `AlwaysBreak` or `BlockIndent` together with `AlignAfterOpenBracketBreak = {false, false, false}`. It's a conflicting set of options in some way. It could be documented as invalid?

https://github.com/llvm/llvm-project/pull/108332


More information about the cfe-commits mailing list