[lld] r268551 - Handle errors on file opening as soft error.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 14:05:12 PDT 2016


Author: ruiu
Date: Wed May  4 16:05:11 2016
New Revision: 268551

URL: http://llvm.org/viewvc/llvm-project?rev=268551&view=rev
Log:
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".

Modified:
    lld/trunk/ELF/Driver.cpp

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=268551&r1=268550&r2=268551&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Wed May  4 16:05:11 2016
@@ -254,9 +254,12 @@ void LinkerDriver::main(ArrayRef<const c
 
   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);
   }
 




More information about the llvm-commits mailing list