Report an error if one occurs in releaseModule.
[oota-llvm.git] / lib / Linker / LinkArchives.cpp
index 381d0e7e5a069252b8a8812b9d5465055057d6d5..f25df888ff8f021fa325a083e9124042ce261e13 100644 (file)
@@ -159,6 +159,9 @@ Linker::LinkInArchive(const sys::Path &Filename, bool &is_native) {
       // Get the module we must link in.
       std::string moduleErrorMsg;
       std::auto_ptr<Module> AutoModule((*I)->releaseModule( &moduleErrorMsg ));
+      if (!moduleErrorMsg.empty())
+        return error("Could not load a module: " + moduleErrorMsg);
+
       Module* aModule = AutoModule.get();
 
       if (aModule != NULL) {