[cfe-commits] r48503 - /cfe/trunk/lib/Rewrite/Rewriter.cpp
Ted Kremenek
kremenek at apple.com
Tue Mar 18 14:00:57 PDT 2008
Author: kremenek
Date: Tue Mar 18 16:00:57 2008
New Revision: 48503
URL: http://llvm.org/viewvc/llvm-project?rev=48503&view=rev
Log:
Bug fix in RewriteBuffer::getMappedOffset: potentially multiple deltas
need to be skipped over when AfterInserts == true, as multiple deltas
may share the same FileLoc.
Modified:
cfe/trunk/lib/Rewrite/Rewriter.cpp
Modified: cfe/trunk/lib/Rewrite/Rewriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/Rewriter.cpp?rev=48503&r1=48502&r2=48503&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/Rewriter.cpp (original)
+++ cfe/trunk/lib/Rewrite/Rewriter.cpp Tue Mar 18 16:00:57 2008
@@ -32,10 +32,12 @@
for (; DeltaIdx != Deltas.size() &&
Deltas[DeltaIdx].FileLoc < OrigOffset; ++DeltaIdx)
ResultOffset += Deltas[DeltaIdx].Delta;
-
- if (AfterInserts && DeltaIdx != Deltas.size() &&
- OrigOffset == Deltas[DeltaIdx].FileLoc)
- ResultOffset += Deltas[DeltaIdx].Delta;
+
+ if (AfterInserts)
+ for (; DeltaIdx != Deltas.size() &&
+ OrigOffset == Deltas[DeltaIdx].FileLoc; ++DeltaIdx)
+ ResultOffset += Deltas[DeltaIdx].Delta;
+
return ResultOffset;
}
More information about the cfe-commits
mailing list