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
This commit is contained in:
Rui Ueyama 2016-05-04 21:05:11 +00:00
parent 7e8c285814
commit 0cfed297de
1 changed files with 6 additions and 3 deletions

View File

@ -254,9 +254,12 @@ void LinkerDriver::main(ArrayRef<const char *> ArgsArr) {
if (!Config->Reproduce.empty()) {
std::error_code EC;
ReproduceArchive = llvm::make_unique<raw_fd_ostream>(
Config->Reproduce + ".cpio", EC, fs::F_None);
check(EC);
std::string File = Config->Reproduce + ".cpio";
ReproduceArchive = llvm::make_unique<raw_fd_ostream>(File, EC, fs::F_None);
if (EC) {
error(EC, "--reproduce: failed to open " + File);
return;
}
createResponseFile(Args);
}