[PATCH] D36700: Propagate error in LazyEmittingLayer::removeModule.

Frederich Munch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 14 10:45:38 PDT 2017


marsupial created this revision.

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


https://reviews.llvm.org/D36700

Files:
  include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h


Index: include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
===================================================================
--- include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
+++ include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
@@ -94,9 +94,9 @@
       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 @@
   ///   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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36700.111031.patch
Type: text/x-patch
Size: 1129 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170814/865cba73/attachment.bin>


More information about the llvm-commits mailing list