[clang] [clang-format][NFC] Simplify some logic in BreakableLineCommentSection (PR #148324)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 13 09:37:47 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:
I see, but in general, how could `var1 + var2 < var3` be misread as `var1 + (var2 < var3)`, whether the former is in if/while, ternary, or assignment? In fact, I would always remove the redundant parentheses in `(var1 + var2) < var3`.
https://github.com/llvm/llvm-project/pull/148324
More information about the cfe-commits
mailing list