Modernize the error handling of the Materialize function.
[oota-llvm.git] / lib / IR / LegacyPassManager.cpp
index 5ba08575134a4ba418357c5ffa35bdc830e49d88..1081f2a1b8c27c6555a57995504aa85e4ee91cab 100644 (file)
@@ -1404,9 +1404,8 @@ void FunctionPassManager::add(Pass *P) {
 ///
 bool FunctionPassManager::run(Function &F) {
   if (F.isMaterializable()) {
-    std::string errstr;
-    if (F.Materialize(&errstr))
-      report_fatal_error("Error reading bitcode file: " + Twine(errstr));
+    if (std::error_code EC = F.materialize())
+      report_fatal_error("Error reading bitcode file: " + EC.message());
   }
   return FPM->run(F);
 }