[clang] [clang-format] Reuse AlignTokens for aligning macros (PR #164120)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 19 13:31:30 PDT 2025


================
@@ -536,14 +540,17 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
     if (CurrentChange.Tok->isNot(tok::comment))
       LineIsComment = false;
 
-    if (CurrentChange.Tok->is(tok::comma)) {
-      ++CommasBeforeMatch;
-    } else if (CurrentChange.indentAndNestingLevel() > IndentAndNestingLevel) {
-      // Call AlignTokens recursively, skipping over this scope block.
-      unsigned StoppedAt =
-          AlignTokens(Style, Matches, Changes, i, ACS, RightJustify);
-      i = StoppedAt - 1;
-      continue;
+    if (!SimpleCheck) {
+      if (CurrentChange.Tok->is(tok::comma)) {
+        ++CommasBeforeMatch;
+      } else if (CurrentChange.indentAndNestingLevel() >
+                 IndentAndNestingLevel) {
+        // Call AlignTokens recursively, skipping over this scope block.
+        unsigned StoppedAt =
----------------
HazardyKnusperkeks wrote:

I just added the if, but can change that.

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


More information about the cfe-commits mailing list