Author: Owen Pan Date: 2025-07-13T20:35:45-07:00 New Revision: b79c763e91ac5e0991eea004b2c4117c8c766718
URL: https://github.com/llvm/llvm-project/commit/b79c763e91ac5e0991eea004b2c4117c8c766718 DIFF: https://github.com/llvm/llvm-project/commit/b79c763e91ac5e0991eea004b2c4117c8c766718.diff LOG: [clang-format][NFC] Simplify some logic in BreakableLineCommentSection (#148324) Added: Modified: clang/lib/Format/BreakableToken.cpp Removed: ################################################################################ diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp index 24912c25ef8c6..c36cb74bc4501 100644 --- a/clang/lib/Format/BreakableToken.cpp +++ b/clang/lib/Format/BreakableToken.cpp @@ -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 + ? Minimum - SpacesInPrefix + : FirstLineSpaceChange; - assert(Lines[i].size() > IndentPrefix.size()); const auto FirstNonSpace = Lines[i][IndentPrefix.size()]; const bool IsFormatComment = LineTok && switchesFormatting(*LineTok); const bool LineRequiresLeadingSpace = _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits