]> granicus.if.org Git - llvm/commitdiff
Fix two (three) more issues with unchecked Error.
authorStephen Hines <srhines@google.com>
Fri, 25 Aug 2017 00:48:21 +0000 (00:48 +0000)
committerStephen Hines <srhines@google.com>
Fri, 25 Aug 2017 00:48:21 +0000 (00:48 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311739 91177308-0d34-0410-b5e6-96231b3b80d8

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

index da02250ba1692d96c455bc6b3062f716247b3a89..c602f1d542f811f9a3db41fe45ed202f1932257f 100644 (file)
@@ -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));
       }
     }
 
index 9f22892374ac3a98a0e909806e855f7b66bfdee4..852753fbf04fa32d187a43517d55a4e07358b829 100644 (file)
@@ -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())),