OSDN Git Service

[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 a8e4ca4..7e7c4ee 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);