Use object::Archive::create instead of new object::Archive.

Also fix the error handling. No testcaes, issue found by inspection.

Thanks to David Blaikie for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214535 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2014-08-01 18:31:17 +00:00
parent 5a96b41c70
commit fff7ba35a3

View File

@ -544,15 +544,14 @@ int main(int argc, char **argv, char * const *envp) {
Err.print(argv[0], errs());
return 1;
}
std::error_code EC;
std::unique_ptr<object::Archive> Ar =
llvm::make_unique<object::Archive>(std::move(ArBuf.get()), EC);
assert(Ar);
if (EC) {
Err.print(argv[0], errs());
ErrorOr<std::unique_ptr<object::Archive>> ArOrErr =
object::Archive::create(std::move(ArBuf.get()));
if (std::error_code EC = ArOrErr.getError()) {
errs() << EC.message();
return 1;
}
EE->addArchive(std::move(Ar));
EE->addArchive(std::move(ArOrErr.get()));
}
// If the target is Cygwin/MingW and we are generating remote code, we