[PATCH] D64290: [tools] [llvm-nm] Default to reading from stdin not a.out

Alex Brachet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 8 06:14:54 PDT 2019


abrachet marked 3 inline comments as done.
abrachet added a comment.

> Have you tried testing this manually? I suspect things might go wrong...

I have tried these

  $ llvm-nm
  llvm-nm: warning: can't read from keyboard input.
  <help message>

  $ llvm-nm `which llvm-nm` # this wasn't touched so should work the same
  <works>

  $ llvm-nm < `which llvm-nm` # should be the same as above now
  <works>



================
Comment at: llvm/docs/CommandGuide/llvm-nm.rst:17
 command line.  Each symbol is listed along with some simple 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.
+its provenance.  If no filename is specified, or *-* is used as a filename,
+:program:`llvm-nm` will process a file on its standard input stream.
----------------
I have used the same language here to what existed prior to rL363065


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:1755
 static void dumpSymbolNamesFromFile(std::string &Filename) {
+  if (sys::Process::StandardInIsUserInput()) {
+    WithColor::warning(outs(), ToolName) << "can't read from keyboard input.\n";
----------------
jhenderson wrote:
> Shouldn't this be conditional on whether we are reading from stdin?
Oops. Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64290/new/

https://reviews.llvm.org/D64290





More information about the llvm-commits mailing list