diff --git a/llvm/test/tools/llvm-nm/invalid-input.test b/llvm/test/tools/llvm-nm/invalid-input.test new file mode 100644 index 000000000000..ad9195613d40 --- /dev/null +++ b/llvm/test/tools/llvm-nm/invalid-input.test @@ -0,0 +1,2 @@ +RUN: not llvm-nm %s 2>&1 | FileCheck %s -check-prefix=UNKNOWN_FILE_TYPE +UNKNOWN_FILE_TYPE: {{.*}}invalid-input.test: The file was not recognized as a valid object file diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp index 26d1e182abcb..00a6cacf78ff 100644 --- a/llvm/tools/llvm-nm/llvm-nm.cpp +++ b/llvm/tools/llvm-nm/llvm-nm.cpp @@ -1240,9 +1240,7 @@ static void dumpSymbolNamesFromFile(std::string &Filename) { if (!checkMachOAndArchFlags(O, Filename)) return; dumpSymbolNamesFromObject(*O, true); - return; } - error("unrecognizable file type", Filename); } int main(int argc, char **argv) {