]> granicus.if.org Git - clang/commitdiff
Trying to buildbot failures caused by r282577.
authorEric Liu <ioeric@google.com>
Wed, 28 Sep 2016 12:49:14 +0000 (12:49 +0000)
committerEric Liu <ioeric@google.com>
Wed, 28 Sep 2016 12:49:14 +0000 (12:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@282583 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Tooling/Core/Replacement.cpp

index 918488310c56a30cedca1b1819c9f28df1069b60..7a5fb856ae7aba8a3d307b8ff7f57a4c8fc940a1 100644 (file)
@@ -287,8 +287,13 @@ llvm::Error Replacements::add(const Replacement &R) {
     // with them and replace them with the merged replacements.
     auto MergeBegin = I;
     auto MergeEnd = std::next(I);
-    while (I-- != Replaces.begin() && Overlap(R, *I))
+    while (I != Replaces.begin()) {
+      --I;
+      // If `I` doesn't overlap with `R`, don't merge it.
+      if (!Overlap(R, *I))
+        break;
       MergeBegin = I;
+    }
     Replacements OverlapReplaces(MergeBegin, MergeEnd);
     llvm::Expected<Replacements> Merged =
         OverlapReplaces.mergeIfOrderIndependent(R);