From fff7ba35a3576052595a9bcba90a81e40930126c Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 1 Aug 2014 18:31:17 +0000 Subject: [PATCH] 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 --- tools/lli/lli.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index f566bf7457d..fda55e4b575 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -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 Ar = - llvm::make_unique(std::move(ArBuf.get()), EC); - assert(Ar); - if (EC) { - Err.print(argv[0], errs()); + + ErrorOr> 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