Fix rdar://5919567: assertion failure: split didn't occur before erase!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50839 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/RewriteRope.cpp b/lib/Rewrite/RewriteRope.cpp
index 7ee9fcc..9d5d7a7 100644
--- a/lib/Rewrite/RewriteRope.cpp
+++ b/lib/Rewrite/RewriteRope.cpp
@@ -567,10 +567,12 @@
unsigned BytesFromChild = CurChild->size()-Offset;
CurChild->erase(Offset, BytesFromChild);
NumBytes -= BytesFromChild;
+ // Start at the beginning of the next child.
+ Offset = 0;
++i;
continue;
}
-
+
// If the deletion request completely covers the child, delete it and move
// the rest down.
NumBytes -= CurChild->size();