[llvm-readobj] Fix another "time of check to time of use bug".
authorDavide Italiano <davide@freebsd.org>
Thu, 17 Sep 2015 22:29:58 +0000 (22:29 +0000)
committerDavide Italiano <davide@freebsd.org>
Thu, 17 Sep 2015 22:29:58 +0000 (22:29 +0000)
It seems there's more copy-paste between tools than needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247954 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-readobj/basic.test [new file with mode: 0644]
tools/llvm-readobj/llvm-readobj.cpp

diff --git a/test/tools/llvm-readobj/basic.test b/test/tools/llvm-readobj/basic.test
new file mode 100644 (file)
index 0000000..fc6349b
--- /dev/null
@@ -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
index a8e4ca4893f7ae27330ff303e9b455d8db6b0c57..7e7c4eeaff722aa8a53fbe9e56ab9cb1e6f926ef 100644 (file)
@@ -394,11 +394,6 @@ static void dumpMachOUniversalBinary(const MachOUniversalBinary *UBinary) {
 
 /// @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);