summaryrefslogtreecommitdiffstats
path: root/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-01-29 10:47:14 +0000
committerDaniel Jasper <djasper@google.com>2015-01-29 10:47:14 +0000
commit2a27967cd6072877cd42dba59bea170561284e5e (patch)
treed6f7b7e594cfad526991b76b467e1e181d25be84 /lib/Format/WhitespaceManager.cpp
parent0aaadda8e18ef6cf8fd65fad649f5a21b4070c3c (diff)
clang-format: Fix crasher caused by not properly setting dry-run.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@227427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/WhitespaceManager.cpp')
-rw-r--r--lib/Format/WhitespaceManager.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Format/WhitespaceManager.cpp b/lib/Format/WhitespaceManager.cpp
index bf1207e59c..44e5f690a2 100644
--- a/lib/Format/WhitespaceManager.cpp
+++ b/lib/Format/WhitespaceManager.cpp
@@ -264,6 +264,11 @@ void WhitespaceManager::alignEscapedNewlines(unsigned Start, unsigned End,
void WhitespaceManager::generateChanges() {
for (unsigned i = 0, e = Changes.size(); i != e; ++i) {
const Change &C = Changes[i];
+ if (i > 0) {
+ assert(Changes[i - 1].OriginalWhitespaceRange.getBegin() !=
+ C.OriginalWhitespaceRange.getBegin() &&
+ "Generating two replacements for the same location");
+ }
if (C.CreateReplacement) {
std::string ReplacementText = C.PreviousLinePostfix;
if (C.ContinuesPPDirective)