r248375 - Fix bad iterator access.
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 23 05:47:51 PDT 2015
Author: djasper
Date: Wed Sep 23 07:47:50 2015
New Revision: 248375
URL: http://llvm.org/viewvc/llvm-project?rev=248375&view=rev
Log:
Fix bad iterator access.
Modified:
cfe/trunk/lib/Tooling/Core/Replacement.cpp
Modified: cfe/trunk/lib/Tooling/Core/Replacement.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=248375&r1=248374&r2=248375&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)
+++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Wed Sep 23 07:47:50 2015
@@ -405,7 +405,8 @@ Replacements mergeReplacements(const Rep
for (auto FirstI = First.begin(), SecondI = Second.begin();
FirstI != First.end() || SecondI != Second.end();) {
bool NextIsFirst = SecondI == Second.end() ||
- FirstI->getOffset() < SecondI->getOffset() + Delta;
+ (FirstI != First.end() &&
+ FirstI->getOffset() < SecondI->getOffset() + Delta);
MergedReplacement Merged(NextIsFirst ? *FirstI : *SecondI, NextIsFirst,
Delta);
++(NextIsFirst ? FirstI : SecondI);
More information about the cfe-commits
mailing list