Fix a rewriter bug that fariborz hit, when an @interface was the very very very
first thing in the file.
The trick is that text replacement should go after the insert point,
not before it, because it will be replacing text after the point, not before
it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43879 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Rewrite/Rewriter.cpp b/Rewrite/Rewriter.cpp
index a8bc99f..f068f68 100644
--- a/Rewrite/Rewriter.cpp
+++ b/Rewrite/Rewriter.cpp
@@ -117,7 +117,7 @@
/// operation.
void RewriteBuffer::ReplaceText(unsigned OrigOffset, unsigned OrigLength,
const char *NewStr, unsigned NewLength) {
- unsigned RealOffset = getMappedOffset(OrigOffset);
+ unsigned RealOffset = getMappedOffset(OrigOffset, true);
assert(RealOffset+OrigLength <= Buffer.size() && "Invalid location");
// Overwrite the common piece.