[clang] [clang-format] Allow array alignment on non-rectangular arrays (PR #143781)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 17 09:01:55 PDT 2025


================
@@ -1959,12 +1970,35 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State,
       NewIndent = CurrentState.LastSpace + Style.ContinuationIndentWidth;
     }
     const FormatToken *NextNonComment = Current.getNextNonComment();
-    AvoidBinPacking = EndsInComma || Current.is(TT_DictLiteral) ||
-                      Style.isProto() || !Style.BinPackArguments ||
-                      (NextNonComment && NextNonComment->isOneOf(
-                                             TT_DesignatedInitializerPeriod,
-                                             TT_DesignatedInitializerLSquare));
+
+    bool AlignedArrayInitializer = Current.opensAlignedArrayInitializer(Style);
----------------
HazardyKnusperkeks wrote:

```suggestion
    const bool AlignedArrayInitializer = Current.opensAlignedArrayInitializer(Style);
```

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


More information about the cfe-commits mailing list