From e192341de79c1454d70767e99f084944b8a1c1a2 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. llvm-svn: 214535 --- llvm/tools/lli/lli.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index f566bf7..fda55e4 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/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 -- 2.7.4