r353318 - Switch to cantFail(), since it does the same assertion.

Stephen Hines via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 6 09:59:39 PST 2019


Author: srhines
Date: Wed Feb  6 09:59:39 2019
New Revision: 353318

URL: http://llvm.org/viewvc/llvm-project?rev=353318&view=rev
Log:
Switch to cantFail(), since it does the same assertion.

Reviewers: cfe-commits, lhames

Reviewed By: lhames

Subscribers: hintonda, klimek, pirama

Differential Revision: https://reviews.llvm.org/D36806

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=353318&r1=353317&r2=353318&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)
+++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Wed Feb  6 09:59:39 2019
@@ -519,12 +519,11 @@ calculateRangesAfterReplacements(const R
     return MergedRanges;
   tooling::Replacements FakeReplaces;
   for (const auto &R : MergedRanges) {
-    auto Err = FakeReplaces.add(Replacement(Replaces.begin()->getFilePath(),
-                                            R.getOffset(), R.getLength(),
-                                            std::string(R.getLength(), ' ')));
-    assert(!Err &&
-           "Replacements must not conflict since ranges have been merged.");
-    llvm::consumeError(std::move(Err));
+    llvm::cantFail(
+        FakeReplaces.add(Replacement(Replaces.begin()->getFilePath(),
+                                     R.getOffset(), R.getLength(),
+                                     std::string(R.getLength(), ' '))),
+        "Replacements must not conflict since ranges have been merged.");
   }
   return FakeReplaces.merge(Replaces).getAffectedRanges();
 }




More information about the cfe-commits mailing list