[cfe-commits] r51514 - in /cfe/trunk: lib/Rewrite/Rewriter.cpp test/Rewriter/rewrite-nest.m
Chris Lattner
sabre at nondot.org
Fri May 23 16:06:56 PDT 2008
Author: lattner
Date: Fri May 23 18:06:56 2008
New Revision: 51514
URL: http://llvm.org/viewvc/llvm-project?rev=51514&view=rev
Log:
fix an inconsistency computing offsets that caused a crash on rewrite-nest.m
Added:
cfe/trunk/test/Rewriter/rewrite-nest.m
Modified:
cfe/trunk/lib/Rewrite/Rewriter.cpp
Modified: cfe/trunk/lib/Rewrite/Rewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Rewriter.cpp?rev=51514&r1=51513&r2=51514&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/Rewriter.cpp (original)
+++ cfe/trunk/lib/Rewrite/Rewriter.cpp Fri May 23 18:06:56 2008
@@ -52,7 +52,7 @@
/// operation.
void RewriteBuffer::ReplaceText(unsigned OrigOffset, unsigned OrigLength,
const char *NewStr, unsigned NewLength) {
- unsigned RealOffset = getMappedOffset(OrigOffset, true);
+ unsigned RealOffset = getMappedOffset(OrigOffset, false);
Buffer.erase(RealOffset, OrigLength);
Buffer.insert(RealOffset, NewStr, NewStr+NewLength);
if (OrigLength != NewLength)
Added: cfe/trunk/test/Rewriter/rewrite-nest.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-nest.m?rev=51514&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-nest.m (added)
+++ cfe/trunk/test/Rewriter/rewrite-nest.m Fri May 23 18:06:56 2008
@@ -0,0 +1,29 @@
+// RUN: clang -rewrite-objc %s -o =-
+
+#include <objc/objc.h>
+
+ at interface NSMapTable @end
+ at interface NSEnumerator @end
+
+typedef unsigned int NSUInteger;
+
+ at interface NSConcreteMapTable : NSMapTable {
+ at public
+ NSUInteger capacity;
+}
+ at end
+
+ at interface NSConcreteMapTableValueEnumerator : NSEnumerator {
+ NSConcreteMapTable *mapTable;
+}
+ at end
+
+ at implementation NSConcreteMapTableValueEnumerator
+
+- nextObject {
+ while (mapTable->capacity) {
+ }
+ return 0;
+}
+ at end
+
More information about the cfe-commits
mailing list