From 0cfed297deab4872d7038f4919be38aee7252e29 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 4 May 2016 21:05:11 +0000 Subject: [PATCH] Handle errors on file opening as soft error. Also improves the error message. Previously it would just print out the cause (e.g. "permission denied"). Now it prints out something like "--reproduce: failed to open foo.cpio: permission denied". llvm-svn: 268551 --- lld/ELF/Driver.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index a1c82954d1c8..9a6be7dc9884 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -254,9 +254,12 @@ void LinkerDriver::main(ArrayRef ArgsArr) { if (!Config->Reproduce.empty()) { std::error_code EC; - ReproduceArchive = llvm::make_unique( - Config->Reproduce + ".cpio", EC, fs::F_None); - check(EC); + std::string File = Config->Reproduce + ".cpio"; + ReproduceArchive = llvm::make_unique(File, EC, fs::F_None); + if (EC) { + error(EC, "--reproduce: failed to open " + File); + return; + } createResponseFile(Args); }