r310958 - Switch to consumeError(), since this can crash otherwise.

Stephen Hines via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 15 14:20:41 PDT 2017

Author: srhines
Date: Tue Aug 15 14:20:41 2017
New Revision: 310958

URL: http://llvm.org/viewvc/llvm-project?rev=310958&view=rev
Switch to consumeError(), since this can crash otherwise.

If assertions are disabled, but LLVM_ABI_BREAKING_CHANGES is enabled,
this will cause an issue with an unchecked Success. Switching to
consumeError() is the correct way to bypass the check.

Reviewers: llvm-commits, cfe-commits, arphaman

Reviewed By: arphaman

Subscribers: arphaman, klimek, pirama

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


Modified: cfe/trunk/lib/Tooling/Core/Replacement.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=310958&r1=310957&r2=310958&view=diff
--- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)
+++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Tue Aug 15 14:20:41 2017
@@ -503,7 +503,7 @@ calculateRangesAfterReplacements(const R
                                             std::string(R.getLength(), ' ')));
     assert(!Err &&
            "Replacements must not conflict since ranges have been merged.");
-    (void)Err;
+    llvm::consumeError(std::move(Err));
   return FakeReplaces.merge(Replaces).getAffectedRanges();

More information about the cfe-commits mailing list