[llvm] r311739 - Fix two (three) more issues with unchecked Error.

Stephen Hines via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 17:48:21 PDT 2017


Author: srhines
Date: Thu Aug 24 17:48:21 2017
New Revision: 311739

URL: http://llvm.org/viewvc/llvm-project?rev=311739&view=rev
Log:
Fix two (three) more issues with unchecked Error.

Summary:
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. This patch also
includes disabling 2 tests that can't work without assertions enabled,
since llvm_unreachable() with NDEBUG won't crash.

Reviewers: llvm-commits, lhames

Reviewed By: lhames

Subscribers: lhames, pirama

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

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
    llvm/trunk/unittests/Support/ErrorTest.cpp

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h?rev=311739&r1=311738&r2=311739&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h Thu Aug 24 17:48:21 2017
@@ -168,10 +168,8 @@ public:
 
     void deregisterEHFrames() override {
       for (auto &Frame : RegisteredEHFrames) {
-        auto Err = Client.deregisterEHFrames(Frame.Addr, Frame.Size);
         // FIXME: Add error poll.
-        assert(!Err && "Failed to register remote EH frames.");
-        (void)Err;
+        llvm::cantFail(Client.deregisterEHFrames(Frame.Addr, Frame.Size));
       }
     }
 

Modified: llvm/trunk/unittests/Support/ErrorTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/ErrorTest.cpp?rev=311739&r1=311738&r2=311739&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/ErrorTest.cpp (original)
+++ llvm/trunk/unittests/Support/ErrorTest.cpp Thu Aug 24 17:48:21 2017
@@ -483,7 +483,7 @@ TEST(Error, CantFailSuccess) {
 }
 
 // Test that cantFail results in a crash if you pass it a failure value.
-#if LLVM_ENABLE_ABI_BREAKING_CHECKS
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS && !defined(NDEBUG)
 TEST(Error, CantFailDeath) {
   EXPECT_DEATH(
       cantFail(make_error<StringError>("foo", inconvertibleErrorCode())),




More information about the llvm-commits mailing list