[llvm] r247954 - [llvm-readobj] Fix another "time of check to time of use bug".

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 15:29:58 PDT 2015


Author: davide
Date: Thu Sep 17 17:29:58 2015
New Revision: 247954

URL: http://llvm.org/viewvc/llvm-project?rev=247954&view=rev
Log:
[llvm-readobj] Fix another "time of check to time of use bug".

It seems there's more copy-paste between tools than needed.

Added:
    llvm/trunk/test/tools/llvm-readobj/basic.test
Modified:
    llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp

Added: llvm/trunk/test/tools/llvm-readobj/basic.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/basic.test?rev=247954&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/basic.test (added)
+++ llvm/trunk/test/tools/llvm-readobj/basic.test Thu Sep 17 17:29:58 2015
@@ -0,0 +1,2 @@
+RUN: not llvm-readobj %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
+ENOENT: {{.*}}.blah: {{[Nn]}}o such file or directory

Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=247954&r1=247953&r2=247954&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Thu Sep 17 17:29:58 2015
@@ -394,11 +394,6 @@ static void dumpMachOUniversalBinary(con
 
 /// @brief Opens \a File and dumps it.
 static void dumpInput(StringRef File) {
-  // If file isn't stdin, check that it exists.
-  if (File != "-" && !sys::fs::exists(File)) {
-    reportError(File, readobj_error::file_not_found);
-    return;
-  }
 
   // Attempt to open the binary.
   ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(File);




More information about the llvm-commits mailing list