forked from OSchip/llvm-project
fix an inconsistency computing offsets that caused a crash on rewrite-nest.m
llvm-svn: 51514
This commit is contained in:
parent
7c0db62a5e
commit
17c2476d0b
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue