[clang] [clang-format][NFC] AlignTokenSequence: Skip loop iteration (PR #68154)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 3 13:15:24 PDT 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-format

<details>
<summary>Changes</summary>

When Shift is 0 there does nothing happen in the remainder of the loop, express that directly.

---
Full diff: https://github.com/llvm/llvm-project/pull/68154.diff


1 Files Affected:

- (modified) clang/lib/Format/WhitespaceManager.cpp (+3) 


``````````diff
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 2cbde3da212ec65..be8eb4f60f310c9 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -353,6 +353,9 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
       }
     }
 
+    if (Shift == 0)
+      continue;
+
     // This is for function parameters that are split across multiple lines,
     // as mentioned in the ScopeStack comment.
     if (InsideNestedScope && Changes[i].NewlinesBefore > 0) {

``````````

</details>


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


More information about the cfe-commits mailing list