summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 3b6311d1548..c48883351c7 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -111,7 +111,7 @@ void WhitespaceManager::calculateLineBreakInformation() {
// If there are multiple changes in this token, sum up all the changes until
// the end of the line.
- if (Changes[i - 1].IsInsideToken)
+ if (Changes[i - 1].IsInsideToken && Changes[i - 1].NewlinesBefore == 0)
LastOutsideTokenChange->TokenLength +=
Changes[i - 1].TokenLength + Changes[i - 1].Spaces;
else
@@ -434,7 +434,9 @@ void WhitespaceManager::alignTrailingComments() {
continue;
unsigned ChangeMinColumn = Changes[i].StartOfTokenColumn;
- unsigned ChangeMaxColumn = Style.ColumnLimit - Changes[i].TokenLength;
+ unsigned ChangeMaxColumn = Style.ColumnLimit >= Changes[i].TokenLength
+ ? Style.ColumnLimit - Changes[i].TokenLength
+ : ChangeMinColumn;
// If we don't create a replacement for this change, we have to consider
// it to be immovable.
OpenPOWER on IntegriCloud