[cfe-commits] r43881 - /cfe/trunk/Rewrite/Rewriter.cpp
Chris Lattner
sabre at nondot.org
Wed Nov 7 20:41:06 PST 2007
Author: lattner
Date: Wed Nov 7 22:41:04 2007
New Revision: 43881
URL: http://llvm.org/viewvc/llvm-project?rev=43881&view=rev
Log:
minor cleanups
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=43881&r1=43880&r2=43881&view=diff
==============================================================================
--- cfe/trunk/Rewrite/Rewriter.cpp (original)
+++ cfe/trunk/Rewrite/Rewriter.cpp Wed Nov 7 22:41:04 2007
@@ -105,7 +105,7 @@
unsigned RealOffset = getMappedOffset(OrigOffset, true);
assert(RealOffset <= Buffer.size() && "Invalid location");
- // Remove the dead characters.
+ // Insert the new characters.
Buffer.insert(Buffer.begin()+RealOffset, StrData, StrData+StrLen);
// Add a delta so that future changes are offset correctly.
@@ -121,8 +121,8 @@
assert(RealOffset+OrigLength <= Buffer.size() && "Invalid location");
// Overwrite the common piece.
- std::copy(NewStr, NewStr+std::min(OrigLength, NewLength),
- Buffer.begin()+RealOffset);
+ unsigned CommonLength = std::min(OrigLength, NewLength);
+ std::copy(NewStr, NewStr+CommonLength, Buffer.begin()+RealOffset);
// If replacing without shifting around, just overwrite the text.
if (OrigLength == NewLength)
More information about the cfe-commits
mailing list