[clang] [clang-format] treat continuation as indent for aligned lines (PR #191217)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 9 13:08:34 PDT 2026


================
@@ -1241,19 +1240,23 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
   switch (Style.BreakInheritanceList) {
   case FormatStyle::BILS_BeforeColon:
   case FormatStyle::BILS_AfterComma:
-    CurrentState.IsAligned = CurrentState.IsAligned ||
-                             Current.is(TT_InheritanceColon) ||
-                             Previous.is(TT_InheritanceComma);
+    if (Current.is(TT_InheritanceColon)) {
+      CurrentState.AlignedTo =
+          Current.getPreviousOneOf(tok::kw_class, tok::kw_struct);
+    } else if (Previous.is(TT_InheritanceComma)) {
+      CurrentState.AlignedTo =
+          Previous.getPreviousOneOf(tok::kw_class, tok::kw_struct);
----------------
HazardyKnusperkeks wrote:

For completeness add `tok::kw_union`.

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


More information about the cfe-commits mailing list