[llvm-cxxdump] Remove duplicate code check.
authorDavide Italiano <davide@freebsd.org>
Tue, 15 Sep 2015 23:35:32 +0000 (23:35 +0000)
committerDavide Italiano <davide@freebsd.org>
Tue, 15 Sep 2015 23:35:32 +0000 (23:35 +0000)
We already fail with 'No such file or directory' when we try to open
the file -- if that doesn't exist. Also add a test to verify this behavior.

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

test/tools/llvm-cxxdump/trivial.test
tools/llvm-cxxdump/llvm-cxxdump.cpp

index 450ed3b3780dc93eae2e060727ab4fd92ddcbf27..2c36620bff2fc99227deb3c998c69116922fec52 100644 (file)
@@ -56,3 +56,6 @@ ELF-I386:      _ZTS1A: 1A
 ELF-I386-NEXT: _ZTV1A[0]: 0
 ELF-I386-NEXT: _ZTV1A[4]: _ZTI1A
 ELF-I386-NEXT: _ZTV1A[8]: _ZN1A1fEv
 ELF-I386-NEXT: _ZTV1A[0]: 0
 ELF-I386-NEXT: _ZTV1A[4]: _ZTI1A
 ELF-I386-NEXT: _ZTV1A[8]: _ZN1A1fEv
+
+RUN: not llvm-cxxdump %t.blah 2>&1 | FileCheck --check-prefix=ENOENT %s
+ENOENT: {{.*}}.blah: {{[Nn]}}o such file or directory
index ede13f7aca5b00c0532001e9550fd3de8a3a87ef..bea34fee3aaa5af740bcc3436547f1a4464a07a4 100644 (file)
@@ -499,12 +499,6 @@ static void dumpArchive(const Archive *Arc) {
 }
 
 static void dumpInput(StringRef File) {
 }
 
 static void dumpInput(StringRef File) {
-  // If file isn't stdin, check that it exists.
-  if (File != "-" && !sys::fs::exists(File)) {
-    reportError(File, cxxdump_error::file_not_found);
-    return;
-  }
-
   // Attempt to open the binary.
   ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(File);
   if (std::error_code EC = BinaryOrErr.getError()) {
   // Attempt to open the binary.
   ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(File);
   if (std::error_code EC = BinaryOrErr.getError()) {