[cfe-commits] r51515 - /cfe/trunk/include/clang/Rewrite/RewriteRope.h
Chris Lattner
sabre at nondot.org
Fri May 23 16:10:58 PDT 2008
Author: lattner
Date: Fri May 23 18:10:58 2008
New Revision: 51515
URL: http://llvm.org/viewvc/llvm-project?rev=51515&view=rev
Log:
add some assertions to catch bad things before they die
somewhere deep in rewrite rope.
Modified:
cfe/trunk/include/clang/Rewrite/RewriteRope.h
Modified: cfe/trunk/include/clang/Rewrite/RewriteRope.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Rewrite/RewriteRope.h?rev=51515&r1=51514&r2=51515&view=diff
==============================================================================
--- cfe/trunk/include/clang/Rewrite/RewriteRope.h (original)
+++ cfe/trunk/include/clang/Rewrite/RewriteRope.h Fri May 23 18:10:58 2008
@@ -209,11 +209,13 @@
}
void insert(unsigned Offset, const char *Start, const char *End) {
+ assert(Offset <= size() && "Invalid position to insert!");
if (Start == End) return;
Chunks.insert(Offset, MakeRopeString(Start, End));
}
void erase(unsigned Offset, unsigned NumBytes) {
+ assert(Offset+NumBytes <= size() && "Invalid region to erase!");
if (NumBytes == 0) return;
Chunks.erase(Offset, NumBytes);
}
More information about the cfe-commits
mailing list