[clang] [clang-format][NFC] Simplify some logic in BreakableLineCommentSection (PR #148324)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 12 09:20:29 PDT 2025


================
@@ -927,14 +927,12 @@ BreakableLineCommentSection::BreakableLineCommentSection(
       }
 
       if (Lines[i].size() != IndentPrefix.size()) {
-        PrefixSpaceChange[i] = FirstLineSpaceChange;
+        assert(Lines[i].size() > IndentPrefix.size());
 
-        if (SpacesInPrefix + PrefixSpaceChange[i] < Minimum) {
-          PrefixSpaceChange[i] +=
-              Minimum - (SpacesInPrefix + PrefixSpaceChange[i]);
-        }
+        PrefixSpaceChange[i] = SpacesInPrefix + FirstLineSpaceChange < Minimum
----------------
owenca wrote:

Why would we want to add the redundant parentheses? They were not there in the `if` statement before.

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


More information about the cfe-commits mailing list