]> granicus.if.org Git - clang/commitdiff
Fix a rewriter bug that fariborz hit, when an @interface was the very very very
authorChris Lattner <sabre@nondot.org>
Thu, 8 Nov 2007 04:09:59 +0000 (04:09 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 8 Nov 2007 04:09:59 +0000 (04:09 +0000)
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

Rewrite/Rewriter.cpp

index a8bc99fe39efc8bc552982e103f4721f8247b292..f068f68ae9febd49f49373e100c56adde4b6d424 100644 (file)
@@ -117,7 +117,7 @@ void RewriteBuffer::InsertText(unsigned OrigOffset,
 /// 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.