1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/include/llvm
Pavel Labath 0d0270ebc8 [Support] Use outs() in ToolOutputFile
Summary:
If the output filename was specified as "-", the ToolOutputFile class
would create a brand new raw_ostream object referring to the stdout.
This patch changes it to reuse the llvm::outs() singleton.

At the moment, this change should be "NFC", but it does enable other
enhancements, like the automatic stdout/stderr synchronization as
discussed on D80803.

I've checked the history, and I did not find any indication that this
class *has* to use a brand new stream object instead of outs() --
indeed, it is special-casing "-" in a number of places already, so this
change fits the pattern pretty well. I suspect the main reason for the
current state of affairs is that the class was originally introduced
(r111595, in 2010) as a raw_fd_ostream subclass, which made any other
solution impossible.

Another potential benefit of this patch is that it makes it possible to
move the raw_ostream class out of the business of special-casing "-" for
stdout handling. That state of affairs does not seem appropriate because
"-" is a valid filename (albeit hard to access with a lot of command
line tools) on most systems. Handling "-" in ToolOutputFile seems more
appropriate.

To make this possible, this patch changes the return type of
llvm::outs() and errs() to raw_fd_ostream&. Previously the functions
were constructing objects of that type, but returning a generic
raw_ostream reference. This makes it possible for new ToolOutputFile and
other code to use raw_fd_ostream methods like error() on the outs()
object. This does not seem like a bad thing (since stdout is a file
descriptor which can be redirected to anywhere, it makes sense to ask it
whether the writing was successful or if it supports seeking), and
indeed a lot of code was already depending on this fact via the
ToolOutputFile "back door".

Reviewers: dblaikie, JDevlieghere, MaskRay, jhenderson

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81078
2020-06-04 14:56:35 +02:00
..
ADT [LiveDebugValues] Speed up removeEntryValue, NFC 2020-06-01 11:02:36 -07:00
Analysis [Inlining] Introduce -enable-npm-pgo-inline-deferral 2020-06-04 00:40:58 -07:00
AsmParser
BinaryFormat [llvm-dwarfdump] Print [=<offset>] after --debug-* options in help output. 2020-06-02 11:06:11 -07:00
Bitcode [ThinLTO] Compute the basic block count across modules. 2020-05-28 10:33:05 -07:00
Bitstream
CodeGen Utility to dump .dot representation of SelectionDAG without firing viewer 2020-06-04 11:51:48 +05:30
Config
DebugInfo [llvm-dwarfdump] Print [=<offset>] after --debug-* options in help output. 2020-06-02 11:06:11 -07:00
Demangle
DWARFLinker
ExecutionEngine [jitlink] R_X86_64_PC32 support for the elf x86 jitlinker 2020-05-30 10:53:18 +10:00
Frontend/OpenMP [OPENMP50]Initial codegen for 'affinity' clauses. 2020-06-02 10:50:08 -04:00
FuzzMutate
IR [Instruction] Remove setProfWeight() 2020-06-04 15:10:55 +07:00
IRReader
LineEditor
Linker
LTO
MC [DWARF5] Added support for emission of .debug_macro.dwo section 2020-05-30 11:13:23 +05:30
MCA
Object SymbolicFile.h - removed unused FileSystem.h include. NFC. 2020-05-28 15:26:31 +01:00
ObjectYAML [yaml2obj] - Add a way to exclude specified sections from the section header. 2020-06-04 13:50:35 +03:00
Option
Passes NFC: Simplify O1 pass pipeline construction. 2020-05-29 20:08:22 -07:00
ProfileData [gcov] Improve .gcno compatibility with gcov and use DataExtractor 2020-06-03 19:29:21 -07:00
Remarks
Support [Support] Use outs() in ToolOutputFile 2020-06-04 14:56:35 +02:00
TableGen
Target GlobalISel: Start defining strict FP instructions 2020-06-03 20:46:37 -04:00
Testing/Support
TextAPI TextAPIReader.h - reduce MemoryBuffer.h include to forward declaration. NFC. 2020-06-02 11:06:10 +01:00
ToolDrivers
Transforms [llvm][NFC] Cache FAM in InlineAdvisor 2020-06-01 13:02:34 -07:00
WindowsManifest
WindowsResource
XRay
CMakeLists.txt
InitializePasses.h Revert "Added a new IRCanonicalizer pass." 2020-05-23 13:51:43 +02:00
LinkAllIR.h
LinkAllPasses.h Revert "Added a new IRCanonicalizer pass." 2020-05-23 13:51:43 +02:00
module.extern.modulemap
module.install.modulemap
module.modulemap Add DIAError.h to list of headers excluded from the LLVM_DebugInfo_PDB module 2020-06-01 21:01:05 +01:00
module.modulemap.build
Pass.h
PassAnalysisSupport.h
PassInfo.h
PassRegistry.h
PassSupport.h