1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/include/llvm/Support
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
..
Solaris/sys
Windows [Support] Improve Windows widenPath and add support for long UNC paths 2020-03-19 13:00:21 +00:00
AArch64TargetParser.def [AARch64] Add Marvell ThunderX3T110 support 2020-05-13 16:58:51 -07:00
AArch64TargetParser.h AArch6/ARMTargetParser.h - move Triple.h dependency down to cpp file. NFC. 2020-05-08 11:10:28 +01:00
Alignment.h [Align] Remove operations on MaybeAlign that asserted that it had a defined value. 2020-05-22 21:54:28 -07:00
AlignOf.h
Allocator.h [Allocator] Make Deallocate() pass alignment and make it use (de)allocate_buffer 2020-05-02 16:08:46 +02:00
AllocatorBase.h [Allocator] Make Deallocate() pass alignment and make it use (de)allocate_buffer 2020-05-02 16:08:46 +02:00
AMDGPUMetadata.h [AMDGPU] add support for hostcall buffer pointer as hidden kernel argument 2019-11-20 15:53:55 +05:30
AMDHSAKernelDescriptor.h
ARMAttributeParser.h [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
ARMBuildAttributes.h [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
ARMEHABI.h
ARMTargetParser.def [ARM] Armv8.6-a Matrix Mul cmd line support 2020-04-24 15:54:06 +01:00
ARMTargetParser.h AArch6/ARMTargetParser.h - move Triple.h dependency down to cpp file. NFC. 2020-05-08 11:10:28 +01:00
ARMWinEH.h
ArrayRecycler.h
Atomic.h
AtomicOrdering.h
Automaton.h Revert "Avoid creating an immutable map in the Automaton class." 2020-01-17 10:20:36 +01:00
Base64.h Syndicate, test and fix base64 implementation 2020-03-03 12:17:53 +01:00
BinaryByteStream.h
BinaryItemStream.h
BinaryStream.h
BinaryStreamArray.h Fix header includes after 0697bcb66f1d82f2fd447e9d13b74d141c3ce085 2020-01-24 18:32:54 -08:00
BinaryStreamError.h
BinaryStreamReader.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
BinaryStreamRef.h BinaryStream - fix static analyzer warnings. NFCI. 2019-11-08 13:20:24 +00:00
BinaryStreamWriter.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
BlockFrequency.h
BranchProbability.h Make some static class members constexpr 2020-04-22 12:25:01 +02:00
BuryPointer.h
CachePruning.h CachePruning.h - reduce StringRef.h to Optional.h include. NFC 2020-05-08 14:06:53 +01:00
Capacity.h
Casting.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
CBindingWrapping.h
CFGDiff.h Revert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff." 2020-04-10 07:44:06 +00:00
CFGUpdate.h [GraphDiff] Extend GraphDiff to track a list of updates. 2020-04-03 12:10:36 -07:00
CheckedArithmetic.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
Chrono.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
circular_raw_ostream.h Make some static class members constexpr 2020-04-22 12:25:01 +02:00
CMakeLists.txt Fix build failure when source is read only 2020-05-29 20:04:22 +05:30
CodeGen.h Move CodeGenFileType enum to Support/CodeGen.h 2019-11-13 16:39:34 -08:00
CodeGenCoverage.h
COM.h
CommandLine.h CommandLine.h - remove unnecessary raw_ostream forward declaration. NFC. 2020-05-19 15:15:25 +01:00
Compiler.h [Support] Remove stale comment 2020-05-26 12:22:03 -07:00
Compression.h
ConvertUTF.h
CrashRecoveryContext.h [Clang][Driver] After default -fintegrated-cc1, make llvm::report_fatal_error() generate preprocessed source + reproducer.sh again. 2020-02-11 10:17:30 -05:00
CRC.h
DataExtractor.h [Support] Make DataExtractor error messages more clear 2020-06-02 12:57:51 +02:00
DataTypes.h
Debug.h
DebugCounter.h DebugCounter.h - remove unused includes. NFC. 2020-05-12 13:03:49 +01:00
DJB.h
DOTGraphTraits.h
DynamicLibrary.h
ELFAttributeParser.h [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
ELFAttributes.h [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
Endian.h Remove unused Endian.h includes, NFC 2020-03-11 15:45:34 -07:00
EndianStream.h
Errc.h
Errno.h Use C++14-style return type deduction in LLVM. 2020-02-11 07:38:42 -08:00
Error.h Make some static class members constexpr 2020-04-22 12:25:01 +02:00
ErrorHandling.h Revert "Revert "Reland "[Support] make report_fatal_error abort instead of exit""" 2020-02-13 10:16:06 -08:00
ErrorOr.h Make some static class members constexpr 2020-04-22 12:25:01 +02:00
ExtensibleRTTI.h [Support] Add support RTTI support for open class hierarchies. 2020-04-13 12:52:44 -07:00
FileCheck.h [FileCheck] Support comment directives 2020-05-13 11:29:48 -04:00
FileCollector.h [FileCollector][NFC] Add comments 2020-05-12 11:02:31 -07:00
FileOutputBuffer.h FileOutputBuffer.h - remove unused includes. NFC. 2020-05-28 14:38:12 +01:00
FileSystem.h Revert "[Support] Add file lock/unlock functions" 2020-06-03 15:40:12 +07:00
FileUtilities.h
Format.h Revert "Forward declare Optional<T> in STLExtras.h" 2019-11-13 16:36:21 -08:00
FormatAdapters.h FormatAdapters.h - remove unused SmallString.h include. NFC. 2020-05-20 17:30:02 +01:00
FormatCommon.h
FormatProviders.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
FormattedStream.h Revert "[llvm-objdump] Display locations of variables alongside disassembly" 2020-03-16 14:04:25 -04:00
FormatVariadic.h [NFC] Silence compiler warning [-Wmissing-braces]. 2020-04-12 14:42:59 -07:00
FormatVariadicDetails.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
GenericDomTree.h GenericDomTree.h - remove unused PointerIntPair.h include. NFC. 2020-05-21 15:48:36 +01:00
GenericDomTreeConstruction.h GenericDomTreeConstruction.h - reorder includes. NFC. 2020-05-20 14:00:52 +01:00
GenericIteratedDominanceFrontier.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
GlobPattern.h GlobPattern.h - remove unnecessary StringRef.h include. NFC 2020-05-19 11:27:40 +01:00
GraphWriter.h Utility to dump .dot representation of SelectionDAG without firing viewer 2020-06-04 11:51:48 +05:30
Host.h Drop a StringMap.h include, NFC 2020-03-11 15:45:34 -07:00
InitLLVM.h [Signal] Allow llvm clients to opt into one-shot SIGPIPE handling 2019-11-18 10:27:27 -08:00
ItaniumManglingCanonicalizer.h ItaniumManglingCanonicalizer.h - add cstdint.h include for missing uintptr_t def 2020-05-08 14:22:26 +01:00
JSON.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
KnownBits.h [KnownBits] Move AND, OR and XOR logic into KnownBits 2020-04-09 10:10:37 +01:00
LEB128.h [llvm/Support] Don't crash on empty nullptr ranges when decoding LEBs 2020-04-06 14:14:11 +02:00
LICENSE.TXT
LineIterator.h Fix line_iterator uninitialized variable warnings. NFCI. 2019-11-03 11:20:12 +00:00
Locale.h
LockFileManager.h Improve module.pcm lock file performance on machines with high core counts 2020-03-23 14:59:39 -07:00
LowLevelTypeImpl.h GlobalISel: Fix casted unmerge of G_CONCAT_VECTORS 2020-04-13 22:03:05 -04:00
MachineValueType.h [SelectionDAG] Update getNode asserts for EXTRACT/INSERT_SUBVECTOR. 2020-05-29 11:02:18 +00:00
ManagedStatic.h [ManagedStatic] Fix build errors with clang-tblgen in Debug mode using MSVC 2019 v16.6 2020-05-25 16:59:40 +03:00
MathExtras.h Support: Add specializations for reverseBits to use builtin 2020-04-03 14:52:54 -04:00
MD5.h Avoid SmallString.h include in MD5.h, NFC 2020-02-26 09:10:24 -08:00
MemAlloc.h [ADT] Move allocate_buffer to MemAlloc.h and out of line 2020-04-24 13:32:50 +02:00
Memory.h [Support][NFC] Add a comment about the semantics of MF_HUGE_HINT flag 2020-01-09 17:34:18 +00:00
MemoryBuffer.h Avoid including FileSystem.h from MemoryBuffer.h 2020-02-29 12:30:23 -08:00
MipsABIFlags.h
MSVCErrorWorkarounds.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
Mutex.h
NativeFormatting.h NativeFormatting.h - reduce raw_ostream.h include to forward declaration. NFC. 2020-05-09 13:32:14 +01:00
OnDiskHashTable.h
OptimizedStructLayout.h Rename OptimalLayout to OptimizedStructLayout at Chris's request. 2020-04-10 00:14:20 -04:00
Parallel.h [Support] Move LLD's parallel algorithm wrappers to support 2020-05-05 15:21:05 -07:00
Path.h [Clang] Restore replace_path_prefix instead of startswith 2020-05-13 13:49:14 -04:00
PluginLoader.h
PointerLikeTypeTraits.h A few cosmetic cleanups to StringMap/StringSet.h, including fixing 2020-04-11 22:14:35 -07:00
PrettyStackTrace.h Tools emit the bug report URL on crash 2020-03-26 10:26:59 +00:00
Printable.h
Process.h Introduce llvm::sys::Process::getProcessId() and adopt it 2020-04-16 15:05:37 +03:00
Program.h
RandomNumberGenerator.h
raw_os_ostream.h
raw_ostream.h [Support] Use outs() in ToolOutputFile 2020-06-04 14:56:35 +02:00
raw_sha1_ostream.h
Recycler.h
RecyclingAllocator.h
Regex.h
Registry.h
ReverseIteration.h
RISCVAttributeParser.h RISCVAttributeParser.h - remove unnecessary ScopedPrinter.h include. NFC. 2020-05-11 22:11:21 +01:00
RISCVAttributes.h [RISCV] ELF attribute section for RISC-V. 2020-03-31 16:16:19 +08:00
RWMutex.h
SaveAndRestore.h
ScaledNumber.h Make some static class members constexpr 2020-04-22 12:25:01 +02:00
ScopedPrinter.h
SHA1.h SHA1.h - remove unnecessary ArrayRef.h/StringRef.h includes. NFC. 2020-04-21 15:12:17 +01:00
Signals.h [Support] Optionally call signal handlers when a function wrapped by the the CrashRecoveryContext fails 2020-01-11 15:27:07 -05:00
Signposts.h
SmallVectorMemoryBuffer.h Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
SMLoc.h
SMTAPI.h
SourceMgr.h [SourceMgr] Tidy up the SourceMgr header file to include less stuff. 2020-04-25 21:18:59 -07:00
SpecialCaseList.h Fix warning -Wpedantic. NFC. 2020-05-27 12:05:55 -04:00
StringSaver.h Temporarily Revert "[Support] Make UniqueStringSaver wrap a StringSet" 2020-05-14 19:18:20 -07:00
SwapByteOrder.h [Support] Remove byte swapping from MathExtras.h 2020-02-27 17:23:48 -08:00
SymbolRemappingReader.h
SystemUtils.h
TargetOpcodes.def GlobalISel: Start defining strict FP instructions 2020-06-03 20:46:37 -04:00
TargetParser.h AMDGPU: Teach toolchain to link rocm device libs 2020-04-10 13:37:32 -04:00
TargetRegistry.h createMCObjectStreamer - fix uninitialized variable warning. NFCI. 2019-11-04 17:24:34 +00:00
TargetSelect.h
TarWriter.h
TaskQueue.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
thread.h
Threading.h [llvm-cov] Prevent llvm-cov from using too many threads 2020-04-24 15:28:25 -04:00
ThreadLocal.h
ThreadPool.h [Support] Simplify and optimize ThreadPool 2020-04-28 12:20:42 -07:00
TimeProfiler.h Refactor TimeProfiler write methods (NFC) 2020-03-06 14:34:56 -08:00
Timer.h [Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a compiler crash 2020-03-13 08:15:35 -04:00
ToolOutputFile.h [Support] Use outs() in ToolOutputFile 2020-06-04 14:56:35 +02:00
TrailingObjects.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
TrigramIndex.h TrigramIndex.h - remove unnecessary StringMap.h include. NFC 2020-04-12 14:30:52 +01:00
type_traits.h Use std::foo_t rather than std::foo in LLVM. 2020-02-11 15:12:51 -08:00
TypeName.h
TypeSize.h [SVE] Remove IITDescriptor::ScalableVecArgument 2020-05-21 08:15:10 +01:00
Unicode.h
UnicodeCharRanges.h
Valgrind.h
VersionTuple.h [driver][darwin] Pass -platform_version flag to the linker instead of the -<platform>_version_min flag 2019-12-17 10:26:32 -08:00
VirtualFileSystem.h VirtualFileSystem.h - reduce Twine.h include to forward declaration. NFC. 2020-05-29 11:40:56 +01:00
Watchdog.h
Win64EH.h [Windows] Use information from the PE32 exceptions directory to construct unwind plans 2019-10-11 09:03:29 +00:00
WindowsError.h
WithColor.h WithColor.h - reduce unnecessary includes to forward declarations. NFC. 2020-05-28 14:38:11 +01:00
X86DisassemblerDecoderCommon.h [X86] Fix a comment reference to registers R8L..R15L to use R8B..R15B like everywhere else. NFC 2020-05-28 15:13:02 -07:00
X86TargetParser.def [X86] Separate X86_CPU_TYPE_COMPAT_WITH_ALIAS from X86_CPU_TYPE_COMPAT. NFC 2020-06-03 14:13:12 -07:00
xxhash.h
YAMLParser.h [Allocator] Make Deallocate() pass alignment and make it use (de)allocate_buffer 2020-05-02 16:08:46 +02:00
YAMLTraits.h [YAMLTraits] Remove char trait and serialize as uint8_t in lldb. 2020-05-26 11:07:27 -07:00