[cfe-commits] r43879 - /cfe/trunk/Rewrite/Rewriter.cpp
Chris Lattner
sabre at nondot.org
Wed Nov 7 20:10:00 PST 2007
Author: lattner
Date: Wed Nov 7 22:09:59 2007
New Revision: 43879
URL: http://llvm.org/viewvc/llvm-project?rev=43879&view=rev
Log:
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.
Modified:
cfe/trunk/Rewrite/Rewriter.cpp
Modified: cfe/trunk/Rewrite/Rewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Rewrite/Rewriter.cpp?rev=43879&r1=43878&r2=43879&view=diff
==============================================================================
--- cfe/trunk/Rewrite/Rewriter.cpp (original)
+++ cfe/trunk/Rewrite/Rewriter.cpp Wed Nov 7 22:09:59 2007
@@ -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.
More information about the cfe-commits
mailing list