fix an inconsistency computing offsets that caused a crash on rewrite-nest.m

llvm-svn: 51514
This commit is contained in:
Chris Lattner 2008-05-23 23:06:56 +00:00
parent 7c0db62a5e
commit 17c2476d0b
2 changed files with 30 additions and 1 deletions

View File

@ -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)

View File

@ -0,0 +1,29 @@
// RUN: clang -rewrite-objc %s -o =-
#include <objc/objc.h>
@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