[cfe-commits] r51519 - in /cfe/trunk: lib/Rewrite/RewriteRope.cpp test/Rewriter/crash.m
Chris Lattner
sabre at nondot.org
Fri May 23 16:29:34 PDT 2008
Author: lattner
Date: Fri May 23 18:29:33 2008
New Revision: 51519
URL: http://llvm.org/viewvc/llvm-project?rev=51519&view=rev
Log:
fix a nasty off-by-one error.
Added:
cfe/trunk/test/Rewriter/crash.m
Modified:
cfe/trunk/lib/Rewrite/RewriteRope.cpp
Modified: cfe/trunk/lib/Rewrite/RewriteRope.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteRope.cpp?rev=51519&r1=51518&r2=51519&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteRope.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteRope.cpp Fri May 23 18:29:33 2008
@@ -578,7 +578,7 @@
NumBytes -= CurChild->size();
CurChild->Destroy();
--NumChildren;
- if (i+1 != getNumChildren())
+ if (i != getNumChildren())
memmove(&Children[i], &Children[i+1],
(getNumChildren()-i)*sizeof(Children[0]));
}
Added: cfe/trunk/test/Rewriter/crash.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/crash.m?rev=51519&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/crash.m (added)
+++ cfe/trunk/test/Rewriter/crash.m Fri May 23 18:29:33 2008
@@ -0,0 +1,14 @@
+// RUN: clang -rewrite-objc -o - %s
+// rdar://5950938
+ at interface NSArray {}
++ (id)arrayWithObjects:(id)firstObj, ...;
+ at end
+
+ at interface NSConstantString {}
+ at end
+
+int main() {
+ id foo = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", @"5", @"6", @"7", @"8", @"9", @"10", @"11", @"12", 0];
+ return 0;
+}
+
More information about the cfe-commits
mailing list