[PATCH] D70292: Make it possible to redirect not only errs() but also outs()

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 23:16:50 PST 2019


ruiu created this revision.
ruiu added reviewers: blackhole12, grimar, MaskRay.
Herald added subscribers: mstorsjo, aheejin, kristof.beyls, arichardson, sbc100, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

This patch adds a new parmeter to lld::*::link() so that we can pass
an raw_ostream object representing stdout. Previously, lld::*::link()
took only an stderr object.

Justification for making stdoutOS and stderrOS mandatory: I wanted to
make link() functions to take stdout and stderr in that order.
However, if we change the function signature from

  bool link(ArrayRef<const char *> args, bool canExitEarly,
            raw_ostream &stderrOS = llvm::errs());

to

  bool link(ArrayRef<const char *> args, bool canExitEarly,
            raw_ostream &stdoutOS = llvm::outs(),
            raw_ostream &stderrOS = llvm::errs());

, then the meaning of existing code that passes stderrOS silently
changes (stderrOS would be interpreted as stdoutOS). So, I chose to
make existing code not to compile, so that developers can fix their
code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70292

Files:
  lld/COFF/Driver.cpp
  lld/COFF/DriverUtils.cpp
  lld/COFF/Writer.cpp
  lld/Common/ErrorHandler.cpp
  lld/ELF/Driver.cpp
  lld/ELF/DriverUtils.cpp
  lld/ELF/MapFile.cpp
  lld/MinGW/Driver.cpp
  lld/include/lld/Common/Driver.h
  lld/include/lld/Common/ErrorHandler.h
  lld/include/lld/Common/LLVM.h
  lld/lib/Core/Resolver.cpp
  lld/lib/Core/SymbolTable.cpp
  lld/lib/Driver/DarwinLdDriver.cpp
  lld/lib/ReaderWriter/FileArchive.cpp
  lld/lib/ReaderWriter/MachO/LayoutPass.cpp
  lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
  lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
  lld/tools/lld/lld.cpp
  lld/unittests/MachOTests/MachONormalizedFileBinaryWriterTests.cpp
  lld/wasm/Driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70292.229451.patch
Type: text/x-patch
Size: 24918 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191115/51765a7f/attachment.bin>


More information about the llvm-commits mailing list