diff --git a/clang/lib/Rewrite/Rewriter.cpp b/clang/lib/Rewrite/Rewriter.cpp index 4f54102d02b5..bea7c00352d2 100644 --- a/clang/lib/Rewrite/Rewriter.cpp +++ b/clang/lib/Rewrite/Rewriter.cpp @@ -52,7 +52,7 @@ void RewriteBuffer::InsertText(unsigned OrigOffset, /// 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) diff --git a/clang/test/Rewriter/rewrite-nest.m b/clang/test/Rewriter/rewrite-nest.m new file mode 100644 index 000000000000..1fe0c75850cf --- /dev/null +++ b/clang/test/Rewriter/rewrite-nest.m @@ -0,0 +1,29 @@ +// RUN: clang -rewrite-objc %s -o =- + +#include + +@interface NSMapTable @end +@interface NSEnumerator @end + +typedef unsigned int NSUInteger; + +@interface NSConcreteMapTable : NSMapTable { +@public + NSUInteger capacity; +} +@end + +@interface NSConcreteMapTableValueEnumerator : NSEnumerator { + NSConcreteMapTable *mapTable; +} +@end + +@implementation NSConcreteMapTableValueEnumerator + +- nextObject { + while (mapTable->capacity) { + } + return 0; +} +@end +