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

@ -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;
}
}