[llvm] r310906 - Propagate error in LazyEmittingLayer::removeModule.

Frederich Munch via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 19:25:36 PDT 2017


Author: marsupial
Date: Mon Aug 14 19:25:36 2017
New Revision: 310906

URL: http://llvm.org/viewvc/llvm-project?rev=310906&view=rev
Log:
Propagate error in LazyEmittingLayer::removeModule.

Summary:
Besides being the better thing to do, not doing so will triggers an assert with LLVM_ENABLE_ABI_BREAKING_CHECKS.

Reviewers: lhames

Reviewed By: lhames

Subscribers: llvm-commits

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

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h?rev=310906&r1=310905&r2=310906&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Mon Aug 14 19:25:36 2017
@@ -94,9 +94,9 @@ private:
       llvm_unreachable("Invalid emit-state.");
     }
 
-    void removeModuleFromBaseLayer(BaseLayerT &BaseLayer) {
-      if (EmitState != NotEmitted)
-        BaseLayer.removeModule(Handle);
+    Error removeModuleFromBaseLayer(BaseLayerT& BaseLayer) {
+      return EmitState != NotEmitted ? BaseLayer.removeModule(Handle)
+                                     : Error::success();
     }
 
     void emitAndFinalize(BaseLayerT &BaseLayer) {
@@ -226,9 +226,9 @@ public:
   ///   This method will free the memory associated with the given module, both
   /// in this layer, and the base layer.
   Error removeModule(ModuleHandleT H) {
-    (*H)->removeModuleFromBaseLayer(BaseLayer);
+    Error Err = (*H)->removeModuleFromBaseLayer(BaseLayer);
     ModuleList.erase(H);
-    return Error::success();
+    return Err;
   }
 
   /// @brief Search for the given named symbol.




More information about the llvm-commits mailing list