summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite/RewriteRope.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-04-23 03:21:50 +0000
committerChris Lattner <sabre@nondot.org>2008-04-23 03:21:50 +0000
commit68a27fac9d1666a345037a4a6daef8f6cc207e80 (patch)
tree421cd07cf638b73ba463362fb55287666bb0b803 /clang/lib/Rewrite/RewriteRope.cpp
parent2161d6c075614f2786606e20d650eb8e9d124e8b (diff)
downloadbcm5719-llvm-68a27fac9d1666a345037a4a6daef8f6cc207e80.tar.gz
bcm5719-llvm-68a27fac9d1666a345037a4a6daef8f6cc207e80.zip
fix a rewriter crash on zero length files.
llvm-svn: 50126
Diffstat (limited to 'clang/lib/Rewrite/RewriteRope.cpp')
-rw-r--r--clang/lib/Rewrite/RewriteRope.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/Rewrite/RewriteRope.cpp b/clang/lib/Rewrite/RewriteRope.cpp
index db55aa1cd4d..7ee9fcced24 100644
--- a/clang/lib/Rewrite/RewriteRope.cpp
+++ b/clang/lib/Rewrite/RewriteRope.cpp
@@ -741,6 +741,7 @@ void RopePieceBTree::erase(unsigned Offset, unsigned NumBytes) {
/// allocation instead of doing tons of tiny allocations.
RopePiece RewriteRope::MakeRopeString(const char *Start, const char *End) {
unsigned Len = End-Start;
+ assert(Len && "Zero length RopePiece is invalid!");
// If we have space for this string in the current alloc buffer, use it.
if (AllocOffs+Len <= AllocChunkSize) {
OpenPOWER on IntegriCloud