diff options
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/Globals.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/IR/LegacyPassManager.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/IR/Module.cpp | 13 |
3 files changed, 8 insertions, 14 deletions
diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 64bc61c5008..cecd999657e 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -36,8 +36,8 @@ bool GlobalValue::isMaterializable() const { bool GlobalValue::isDematerializable() const { return getParent() && getParent()->isDematerializable(this); } -bool GlobalValue::Materialize(std::string *ErrInfo) { - return getParent()->Materialize(this, ErrInfo); +std::error_code GlobalValue::materialize() { + return getParent()->materialize(this); } void GlobalValue::Dematerialize() { getParent()->Dematerialize(this); diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index 5ba08575134..1081f2a1b8c 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -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); } diff --git a/llvm/lib/IR/Module.cpp b/llvm/lib/IR/Module.cpp index f43080b72ee..e35eefbd45c 100644 --- a/llvm/lib/IR/Module.cpp +++ b/llvm/lib/IR/Module.cpp @@ -395,16 +395,11 @@ bool Module::isDematerializable(const GlobalValue *GV) const { return false; } -bool Module::Materialize(GlobalValue *GV, std::string *ErrInfo) { +std::error_code Module::materialize(GlobalValue *GV) { if (!Materializer) - return false; - - std::error_code EC = Materializer->Materialize(GV); - if (!EC) - return false; - if (ErrInfo) - *ErrInfo = EC.message(); - return true; + return std::error_code(); + + return Materializer->materialize(GV); } void Module::Dematerialize(GlobalValue *GV) { |

