From 5a52e6dc9eeb07e44a62bdc828bc9b8b7348549d Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 24 Oct 2014 22:50:48 +0000 Subject: Modernize the error handling of the Materialize function. llvm-svn: 220600 --- llvm/tools/llvm-extract/llvm-extract.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'llvm/tools/llvm-extract') 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 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; } } -- cgit v1.2.3