summaryrefslogtreecommitdiff
path: root/clang/lib/Format/BreakableToken.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/BreakableToken.cpp')
-rw-r--r--clang/lib/Format/BreakableToken.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/Format/BreakableToken.cpp b/clang/lib/Format/BreakableToken.cpp
index 24912c25ef8c..c36cb74bc450 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 =