Modernize the error handling of the Materialize function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220600 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-10-24 22:50:48 +00:00
parent 44ccedc273
commit c498284e46
12 changed files with 39 additions and 36 deletions

View File

@@ -482,8 +482,11 @@ static GlobalObject *makeInternalReplacement(GlobalObject *GO) {
Module *M = GO->getParent();
GlobalObject *Ret;
if (auto *F = dyn_cast<Function>(GO)) {
if (F->isMaterializable())
F->Materialize();
if (F->isMaterializable()) {
if (std::error_code EC = F->materialize())
message(LDPL_FATAL, "LLVM gold plugin has failed to read a function");
}
auto *NewF = Function::Create(F->getFunctionType(), F->getLinkage(),
F->getName(), M);