[clang] [clang-format] Merge case alignment into AlignTokens (PR #187811)

via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 21 02:08:45 PDT 2026


================
@@ -548,7 +557,8 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
 
   unsigned I = StartAt;
   const auto E = Changes.size();
-  for (; I != E; ++I) {
+  for (const auto LoopEnd = E - (Strategy == AlignStrategy::CaseBody ? 1 : 0);
----------------
owenca wrote:

```suggestion
  for (const auto LoopEnd = Strategy == AlignStrategy::CaseBody ? E - 1 : E;
```

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


More information about the cfe-commits mailing list