From: Alex Brachet Date: Tue, 16 Jul 2019 15:33:43 +0000 (+0000) Subject: Revert [tools] [llvm-nm] Default to reading from stdin not a.out X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f892f6959ebc24d5827c2e4baeb8f44bcd5ac4b5;p=llvm Revert [tools] [llvm-nm] Default to reading from stdin not a.out This reverts r365889 (git commit 60c81354b1d3fced1bd284d334f118d2d792ab4b) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@366219 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/CommandGuide/llvm-nm.rst b/docs/CommandGuide/llvm-nm.rst index aa58a3f3884..f071e1be1a5 100644 --- a/docs/CommandGuide/llvm-nm.rst +++ b/docs/CommandGuide/llvm-nm.rst @@ -13,8 +13,9 @@ DESCRIPTION The :program:`llvm-nm` utility lists the names of symbols from LLVM bitcode files, object files, and archives. Each symbol is listed along with some simple -information about its provenance. If no filename is specified, or *-* is used as -a filename, :program:`llvm-nm` will read a file from its standard input stream. +information about its provenance. If no filename is specified, *a.out* is used +as the input. If *-* is used as a filename, :program:`llvm-nm` will read a file +from its standard input stream. :program:`llvm-nm`'s default output format is the traditional BSD :program:`nm` output format. Each such output record consists of an (optional) 8-digit diff --git a/test/tools/llvm-nm/stdin.test b/test/tools/llvm-nm/stdin.test deleted file mode 100644 index 352ee23a30a..00000000000 --- a/test/tools/llvm-nm/stdin.test +++ /dev/null @@ -1,33 +0,0 @@ -## Test llvm-nm when using stdin both explicitly (using '-' as a filename) -## and implicitly (not specifying any filename). - -# RUN: yaml2obj %s -o %t.o - -## Pass an explicit filename to produce a baseline output. llvm-nm should -## have the same behavior when opening a file itself and when reading that -## file from its standard input stream. -# RUN: llvm-nm %t.o > %t.base 2> %t.err - -## Make sure there is no warning message about no file redirected to stdin. -# RUN: FileCheck %s --input-file=%t.err --allow-empty --implicit-check-not={{.}} - -# RUN: llvm-nm - < %t.o > %t.explicit 2> %t.err -# RUN: FileCheck %s --input-file=%t.err --allow-empty --implicit-check-not={{.}} -# RUN: cmp %t.base %t.explicit - -# RUN: llvm-nm < %t.o > %t.implicit 2> %t.err -# RUN: FileCheck %s --input-file=%t.err --allow-empty --implicit-check-not={{.}} -# RUN: cmp %t.base %t.implicit - -!ELF -FileHeader: - Class: ELFCLASS64 - Data: ELFDATA2LSB - Type: ET_REL - Machine: EM_X86_64 -Sections: - - Name: .text - Type: SHT_PROGBITS -Symbols: - - Name: symbol_a - Section: .text diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index c45c8716f18..aa62e6f0209 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -34,7 +34,6 @@ #include "llvm/Support/Format.h" #include "llvm/Support/InitLLVM.h" #include "llvm/Support/MemoryBuffer.h" -#include "llvm/Support/Process.h" #include "llvm/Support/Program.h" #include "llvm/Support/Signals.h" #include "llvm/Support/TargetSelect.h" @@ -1752,12 +1751,6 @@ static bool checkMachOAndArchFlags(SymbolicFile *O, std::string &Filename) { } static void dumpSymbolNamesFromFile(std::string &Filename) { - if (Filename == "-" && sys::Process::StandardInIsUserInput()) { - WithColor::warning(errs(), ToolName) << "can't read from terminal\n"; - cl::PrintHelpMessage(); - HadError = true; - return; - } ErrorOr> BufferOrErr = MemoryBuffer::getFileOrSTDIN(Filename); if (error(BufferOrErr.getError(), Filename)) @@ -2089,7 +2082,7 @@ int main(int argc, char **argv) { if (OutputFormat == sysv || SizeSort) PrintSize = true; if (InputFilenames.empty()) - InputFilenames.push_back("-"); + InputFilenames.push_back("a.out"); if (InputFilenames.size() > 1) MultipleFiles = true;