diff options
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/gold/gold-plugin.cpp | 7 | ||||
| -rw-r--r-- | llvm/tools/llvm-extract/llvm-extract.cpp | 18 |
2 files changed, 14 insertions, 11 deletions
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 8ebae0e498c..2d50f49ffd7 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -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); diff --git a/llvm/tools/llvm-extract/llvm-extract.cpp b/llvm/tools/llvm-extract/llvm-extract.cpp index 116b678e07e..fe97a03c034 100644 --- a/llvm/tools/llvm-extract/llvm-extract.cpp +++ b/llvm/tools/llvm-extract/llvm-extract.cpp @@ -217,9 +217,9 @@ int main(int argc, char **argv) { for (size_t i = 0, e = GVs.size(); i != e; ++i) { GlobalValue *GV = GVs[i]; if (GV->isMaterializable()) { - std::string ErrInfo; - if (GV->Materialize(&ErrInfo)) { - errs() << argv[0] << ": error reading input: " << ErrInfo << "\n"; + if (std::error_code EC = GV->materialize()) { + errs() << argv[0] << ": error reading input: " << EC.message() + << "\n"; return 1; } } @@ -229,18 +229,18 @@ int main(int argc, char **argv) { SmallPtrSet<GlobalValue *, 8> GVSet(GVs.begin(), GVs.end()); for (auto &G : M->globals()) { if (!GVSet.count(&G) && G.isMaterializable()) { - std::string ErrInfo; - if (G.Materialize(&ErrInfo)) { - errs() << argv[0] << ": error reading input: " << ErrInfo << "\n"; + if (std::error_code EC = G.materialize()) { + errs() << argv[0] << ": error reading input: " << EC.message() + << "\n"; return 1; } } } for (auto &F : *M) { if (!GVSet.count(&F) && F.isMaterializable()) { - std::string ErrInfo; - if (F.Materialize(&ErrInfo)) { - errs() << argv[0] << ": error reading input: " << ErrInfo << "\n"; + if (std::error_code EC = F.materialize()) { + errs() << argv[0] << ": error reading input: " << EC.message() + << "\n"; return 1; } } |

