LLVM
8.0.1
|
This class implements an extremely fast bulk output stream that can only output to a stream. More...
#include "llvm/Support/raw_ostream.h"
Public Types | |
enum | Colors { BLACK = 0, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, SAVEDCOLOR } |
using | uuid_t = uint8_t[16] |
Output a formatted UUID with dash separators. More... | |
Public Member Functions | |
raw_ostream (bool unbuffered=false) | |
raw_ostream (const raw_ostream &)=delete | |
void | operator= (const raw_ostream &)=delete |
virtual | ~raw_ostream () |
uint64_t | tell () const |
tell - Return the current offset with the file. More... | |
void | SetBuffered () |
Set the stream to be buffered, with an automatically determined buffer size. More... | |
void | SetBufferSize (size_t Size) |
Set the stream to be buffered, using the specified buffer size. More... | |
size_t | GetBufferSize () const |
void | SetUnbuffered () |
Set the stream to be unbuffered. More... | |
size_t | GetNumBytesInBuffer () const |
void | flush () |
raw_ostream & | operator<< (char C) |
raw_ostream & | operator<< (unsigned char C) |
raw_ostream & | operator<< (signed char C) |
raw_ostream & | operator<< (StringRef Str) |
raw_ostream & | operator<< (const char *Str) |
raw_ostream & | operator<< (const std::string &Str) |
raw_ostream & | operator<< (const SmallVectorImpl< char > &Str) |
raw_ostream & | operator<< (unsigned long N) |
raw_ostream & | operator<< (long N) |
raw_ostream & | operator<< (unsigned long long N) |
raw_ostream & | operator<< (long long N) |
raw_ostream & | operator<< (const void *P) |
raw_ostream & | operator<< (unsigned int N) |
raw_ostream & | operator<< (int N) |
raw_ostream & | operator<< (double N) |
raw_ostream & | write_hex (unsigned long long N) |
Output N in hexadecimal, without any prefix or padding. More... | |
raw_ostream & | write_uuid (const uuid_t UUID) |
raw_ostream & | write_escaped (StringRef Str, bool UseHexEscapes=false) |
Output Str , turning '\', '', '', '"', and anything that doesn't satisfy llvm::isPrint into an escape sequence. More... | |
raw_ostream & | write (unsigned char C) |
raw_ostream & | write (const char *Ptr, size_t Size) |
raw_ostream & | operator<< (const format_object_base &Fmt) |
raw_ostream & | operator<< (const FormattedString &) |
raw_ostream & | operator<< (const FormattedNumber &) |
raw_ostream & | operator<< (const formatv_object_base &) |
raw_ostream & | operator<< (const FormattedBytes &) |
raw_ostream & | indent (unsigned NumSpaces) |
indent - Insert 'NumSpaces' spaces. More... | |
raw_ostream & | write_zeros (unsigned NumZeros) |
write_zeros - Insert 'NumZeros' nulls. More... | |
virtual raw_ostream & | changeColor (enum Colors Color, bool Bold=false, bool BG=false) |
Changes the foreground color of text that will be output from this point forward. More... | |
virtual raw_ostream & | resetColor () |
Resets the colors to terminal defaults. More... | |
virtual raw_ostream & | reverseColor () |
Reverses the foreground and background colors. More... | |
virtual bool | is_displayed () const |
This function determines if this stream is connected to a "tty" or "console" window. More... | |
virtual bool | has_colors () const |
This function determines if this stream is displayed and supports colors. More... | |
Protected Member Functions | |
void | SetBuffer (char *BufferStart, size_t Size) |
Use the provided buffer as the raw_ostream buffer. More... | |
virtual size_t | preferred_buffer_size () const |
Return an efficient buffer size for the underlying output mechanism. More... | |
const char * | getBufferStart () const |
Return the beginning of the current stream buffer, or 0 if the stream is unbuffered. More... | |
This class implements an extremely fast bulk output stream that can only output to a stream.
It does not support seeking, reopening, rewinding, line buffered disciplines etc. It is a simple buffer that outputs a chunk at a time.
Definition at line 46 of file raw_ostream.h.
using llvm::raw_ostream::uuid_t = uint8_t[16] |
Output a formatted UUID with dash separators.
Definition at line 219 of file raw_ostream.h.
Enumerator | |
---|---|
BLACK | |
RED | |
GREEN | |
YELLOW | |
BLUE | |
MAGENTA | |
CYAN | |
WHITE | |
SAVEDCOLOR |
Definition at line 76 of file raw_ostream.h.
Definition at line 88 of file raw_ostream.h.
|
delete |
|
virtual |
Definition at line 69 of file raw_ostream.cpp.
References assert().
|
inlinevirtual |
Changes the foreground color of text that will be output from this point forward.
Color | ANSI color to use, the special SAVEDCOLOR can be used to change only the bold attribute, and keep colors untouched |
Bold | bold/brighter text, default false |
BG | if true change the background, default: change foreground |
Reimplemented in llvm::raw_fd_ostream, and llvm::formatted_raw_ostream.
Definition at line 257 of file raw_ostream.h.
Referenced by llvm::WithColor::changeColor(), llvm::formatted_raw_ostream::changeColor(), and llvm::WithColor::WithColor().
|
inline |
Definition at line 142 of file raw_ostream.h.
Referenced by llvm::raw_fd_ostream::changeColor(), llvm::raw_fd_ostream::close(), computeMemberData(), computeStringTable(), createSchedInfoStr(), llvm::LTOCodeGenerator::DiagnosticHandler(), doCandidateWalk(), llvm::AsmPrinter::doFinalization(), llvm::pdb::PDBSymbol::dumpChildStats(), llvm::pdb::PDBSymbol::dumpProperties(), emitComments(), EmitDebugSectionImpl(), llvm::emitLinkerFlagsForGlobalCOFF(), llvm::VPlan::execute(), fail(), llvm::MCJIT::generateCodeForModule(), llvm::object::ArchiveMemberHeader::getAccessMode(), getBlockName(), getBranchCondString(), getDebugLocString(), llvm::BFIDOTGraphTraitsBase< BlockFrequencyInfoT, BranchProbabilityInfoT >::getEdgeAttributes(), getFilename(), llvm::object::ArchiveMemberHeader::getGID(), llvm::object::ArchiveMemberHeader::getLastModified(), llvm::object::ArchiveMemberHeader::getName(), llvm::LazyCallGraph::SCC::getName(), llvm::LazyCallGraph::RefSCC::getName(), llvm::BFIDOTGraphTraitsBase< BlockFrequencyInfoT, BranchProbabilityInfoT >::getNodeAttributes(), getShuffleComment(), llvm::object::ArchiveMemberHeader::getSize(), llvm::SelectionDAG::getSymbolFunctionGlobalAddress(), llvm::object::ArchiveMemberHeader::getUID(), llvm::NVPTXAsmPrinter::getVirtualRegisterName(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::IsSameAsFreshTree(), llvm::isThumbFunc(), LLVMGetDiagInfoDescription(), LLVMGetSymbolAddress(), LLVMGetSymbolName(), LLVMMoveToContainingSection(), LLVMParseIRInContext(), LLVMPrintModuleToString(), LLVMPrintTypeToString(), LLVMPrintValueToString(), LLVMTargetMachineEmit(), LLVMTargetMachineEmitToFile(), llvm::CodeViewYAML::detail::UnknownSymbolRecord::map(), llvm::operator<<(), llvm::MIRPrinter::print(), llvm::DiagnosticInfoUnsupported::print(), PrintCurStackTrace(), llvm::opt::OptTable::PrintHelp(), llvm::AMDGPUInstPrinter::printInst(), llvm::R600InstPrinter::printInst(), llvm::PrintStatistics(), llvm::PrintStatisticsJSON(), llvm::RuntimeDyldELF::processRelocationRef(), reportError(), ReportError(), reportOpenError(), rescheduleLexographically(), llvm::raw_fd_ostream::resetColor(), llvm::raw_fd_ostream::reverseColor(), llvm::raw_fd_ostream::seek(), setFastFlags(), llvm::setProfMetadata(), llvm::raw_sha1_ostream::sha1(), llvm::formatv_object_base::str(), llvm::AMDGPU::IsaInfo::streamIsaVersion(), llvm::sys::StrError(), llvm::AMDGPU::PALMD::toString(), llvm::VPRecipeBuilder::tryToCreateRecipe(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::VerifyDFSNumbers(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::VerifyLevels(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::verifyParentProperty(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::verifyReachability(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::verifyRoots(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::verifySiblingProperty(), llvm::writeArchive(), writeToResolutionFile(), llvm::circular_raw_ostream::~circular_raw_ostream(), llvm::formatted_raw_ostream::~formatted_raw_ostream(), llvm::raw_fd_ostream::~raw_fd_ostream(), llvm::raw_null_ostream::~raw_null_ostream(), llvm::raw_os_ostream::~raw_os_ostream(), and llvm::raw_string_ostream::~raw_string_ostream().
|
inline |
Definition at line 116 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::is_displayed().
Return the beginning of the current stream buffer, or 0 if the stream is unbuffered.
Definition at line 318 of file raw_ostream.h.
References Mode.
Referenced by llvm::formatted_raw_ostream::PadToColumn().
|
inline |
Definition at line 134 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::PadToColumn(), and SetBuffered().
|
inlinevirtual |
This function determines if this stream is displayed and supports colors.
Reimplemented in llvm::raw_fd_ostream.
Definition at line 279 of file raw_ostream.h.
References Size.
Referenced by llvm::WithColor::colorsEnabled().
raw_ostream & raw_ostream::indent | ( | unsigned | NumSpaces | ) |
indent - Insert 'NumSpaces' spaces.
Definition at line 478 of file raw_ostream.cpp.
Referenced by llvm::pdb::IPDBSourceFile::dump(), llvm::DWARFDebugLoc::LocationList::dump(), llvm::dwarf::CFIProgram::dump(), llvm::DWARFDebugLoclists::LocationList::dump(), llvm::LexicalScope::dump(), llvm::DWARFDie::dump(), dumpAttribute(), llvm::RGPassManager::dumpPassStructure(), llvm::LPPassManager::dumpPassStructure(), llvm::Pass::dumpPassStructure(), llvm::FPPassManager::dumpPassStructure(), dumpRanges(), llvm::pdb::dumpSymbolField(), llvm::pdb::dumpSymbolIdField(), llvm::StringMatcher::Emit(), emitBasicBlockLoopComments(), llvm::detail::PadAdapter< T >::format(), llvm::format_provider< llvm::json::Value >::format(), llvm::legacy::FunctionPassManagerImpl::getContainedManager(), operator<<(), llvm::formatted_raw_ostream::PadToColumn(), llvm::DWARFDebugLine::LineTable::parse(), llvm::WebAssemblyException::print(), llvm::PassManagerPrettyStackEntry::print(), llvm::MemoryDepChecker::Dependence::print(), llvm::sampleprof::FunctionSamples::print(), llvm::SCEVEqualPredicate::print(), llvm::SCEVWrapPredicate::print(), llvm::LoopBase< BasicBlock, Loop >::print(), llvm::RegionBase< RegionTraits< Function > >::print(), llvm::RuntimePointerChecking::print(), llvm::LoopAccessInfo::print(), llvm::LoopAccessLegacyAnalysis::print(), llvm::MachineBasicBlock::print(), llvm::PredicatedScalarEvolution::print(), llvm::RuntimePointerChecking::printChecks(), PrintChildLoopComment(), llvm::PrintDomTree(), llvm::cl::generic_parser_base::printGenericOptionDiff(), PrintHelpOptionList(), llvm::cl::Option::printHelpStr(), llvm::cl::generic_parser_base::printOptionInfo(), llvm::cl::basic_parser_impl::printOptionName(), PrintParentLoopComment(), llvm::DOTGraphTraits< RegionInfo * >::printRegionCluster(), llvm::TargetRegistry::printRegisteredTargetsForVersion(), printWithSpacePadding(), llvm::LoopAccessInfoPrinterPass::run(), sortSubCommands(), and llvm::TimerGroup::~TimerGroup().
|
inlinevirtual |
This function determines if this stream is connected to a "tty" or "console" window.
That is, the output would be displayed to the user rather than being put on a pipe or stored in a file.
Reimplemented in llvm::raw_fd_ostream, and llvm::formatted_raw_ostream.
Definition at line 276 of file raw_ostream.h.
Referenced by llvm::CheckBitcodeOutputToConsole(), and llvm::formatted_raw_ostream::is_displayed().
|
inline |
Definition at line 147 of file raw_ostream.h.
Referenced by operator<<().
|
inline |
Definition at line 154 of file raw_ostream.h.
|
inline |
Definition at line 161 of file raw_ostream.h.
|
inline |
Definition at line 168 of file raw_ostream.h.
References llvm::StringRef::data(), llvm::Intrinsic::memcpy, Size, llvm::StringRef::size(), and write().
|
inline |
Definition at line 183 of file raw_ostream.h.
References llvm::operator<<().
|
inline |
Definition at line 190 of file raw_ostream.h.
References write().
|
inline |
Definition at line 195 of file raw_ostream.h.
References N, llvm::operator<<(), P, and write().
raw_ostream & raw_ostream::operator<< | ( | unsigned long | N | ) |
Definition at line 112 of file raw_ostream.cpp.
References llvm::Integer, and llvm::write_integer().
raw_ostream & raw_ostream::operator<< | ( | long | N | ) |
Definition at line 117 of file raw_ostream.cpp.
References llvm::Integer, and llvm::write_integer().
raw_ostream & raw_ostream::operator<< | ( | unsigned long long | N | ) |
Definition at line 122 of file raw_ostream.cpp.
References llvm::Integer, and llvm::write_integer().
raw_ostream & raw_ostream::operator<< | ( | long long | N | ) |
Definition at line 127 of file raw_ostream.cpp.
References llvm::Integer, and llvm::write_integer().
raw_ostream & raw_ostream::operator<< | ( | const void * | P | ) |
Definition at line 187 of file raw_ostream.cpp.
References llvm::PrefixLower, and llvm::write_hex().
|
inline |
Definition at line 205 of file raw_ostream.h.
References N.
|
inline |
Definition at line 209 of file raw_ostream.h.
References N, llvm::operator<<(), and llvm::write_hex().
raw_ostream & raw_ostream::operator<< | ( | double | N | ) |
Definition at line 192 of file raw_ostream.cpp.
References assert(), llvm::Exponent, and llvm::write_double().
raw_ostream & raw_ostream::operator<< | ( | const format_object_base & | Fmt | ) |
Definition at line 287 of file raw_ostream.cpp.
References assert(), llvm::SmallVectorTemplateCommon< T >::data(), llvm::format_object_base::print(), llvm::SmallVectorImpl< T >::resize(), and write().
raw_ostream & raw_ostream::operator<< | ( | const FormattedString & | FS | ) |
Definition at line 333 of file raw_ostream.cpp.
References indent(), llvm::FormattedString::JustifyCenter, llvm::FormattedString::JustifyLeft, llvm::FormattedString::JustifyNone, llvm::FormattedString::JustifyRight, llvm_unreachable, operator<<(), and llvm::StringRef::size().
raw_ostream & raw_ostream::operator<< | ( | const FormattedNumber & | FN | ) |
Definition at line 361 of file raw_ostream.cpp.
References indent(), llvm::Integer, llvm::Lower, llvm::PrefixLower, llvm::PrefixUpper, llvm::SmallVectorBase::size(), llvm::Upper, llvm::write_hex(), and llvm::write_integer().
raw_ostream & raw_ostream::operator<< | ( | const formatv_object_base & | Obj | ) |
Definition at line 327 of file raw_ostream.cpp.
References llvm::formatv_object_base::format().
raw_ostream & raw_ostream::operator<< | ( | const FormattedBytes & | FB | ) |
Definition at line 384 of file raw_ostream.cpp.
References llvm::alignTo(), assert(), llvm::ArrayRef< T >::empty(), llvm::Optional< T >::getValue(), llvm::Optional< T >::hasValue(), I, indent(), llvm::isPrint(), llvm::Log2_64_Ceil(), llvm::Lower, Size, llvm::Upper, and llvm::write_hex().
|
delete |
|
protectedvirtual |
Return an efficient buffer size for the underlying output mechanism.
Definition at line 79 of file raw_ostream.cpp.
Referenced by llvm::raw_fd_ostream::seek(), and SetBuffered().
|
inlinevirtual |
Resets the colors to terminal defaults.
Call this when you are done outputting colored text, or before program exit.
Reimplemented in llvm::raw_fd_ostream, and llvm::formatted_raw_ostream.
Definition at line 268 of file raw_ostream.h.
Referenced by llvm::WithColor::resetColor(), and llvm::formatted_raw_ostream::resetColor().
|
inlinevirtual |
Reverses the foreground and background colors.
Reimplemented in llvm::raw_fd_ostream, and llvm::formatted_raw_ostream.
Definition at line 271 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::reverseColor().
Use the provided buffer as the raw_ostream buffer.
This is intended for use only by subclasses which can arrange for the output to go directly into the desired output buffer, instead of being copied on each flush.
Definition at line 309 of file raw_ostream.h.
void raw_ostream::SetBuffered | ( | ) |
Set the stream to be buffered, with an automatically determined buffer size.
Definition at line 84 of file raw_ostream.cpp.
References assert(), GetNumBytesInBuffer(), Mode, preferred_buffer_size(), SetBufferSize(), SetUnbuffered(), and Size.
Referenced by write().
|
inline |
Set the stream to be buffered, using the specified buffer size.
Definition at line 111 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::is_displayed(), and SetBuffered().
|
inline |
Set the stream to be unbuffered.
When unbuffered, the stream will flush after every write. This routine will also flush the buffer immediately when the stream is being set to unbuffered.
Definition at line 129 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::is_displayed(), and SetBuffered().
|
inline |
tell - Return the current offset with the file.
Definition at line 100 of file raw_ostream.h.
Referenced by computeMemberData(), llvm::OnDiskChainedHashTableGenerator< Info >::Emit(), llvm::DWARFYAML::EmitDebugAranges(), llvm::MCDwarfLineAddr::FixedEncode(), getSymbols(), pad(), printLine(), printMemberHeader(), printWithSpacePadding(), llvm::raw_fd_ostream::seek(), llvm::sampleprof::SampleProfileWriterCompactBinary::writeFuncOffsetTable(), llvm::MachObjectWriter::writeObject(), and writeSymbolTable().
raw_ostream & raw_ostream::write | ( | unsigned char | C | ) |
Definition at line 204 of file raw_ostream.cpp.
References C, LLVM_UNLIKELY, and SetBuffered().
Referenced by adjustFixupValue(), llvm::raw_fd_ostream::changeColor(), llvm::InstrProfRecordWriterTrait::EmitData(), llvm::DWARFYAML::EmitDebugAbbrev(), llvm::DWARFYAML::EmitDebugLine(), llvm::DWARFYAML::EmitDebugStr(), EmitFileEntry(), EmitGCCInlineAsmStr(), llvm::InstrProfRecordWriterTrait::EmitKey(), EmitMSInlineAsmStr(), llvm::DWARFYAML::EmitPubSection(), llvm::MCDwarfLineAddr::FixedEncode(), llvm::circular_raw_ostream::flushBufferWithBanner(), getLit64Encoding(), getRelaxedOpcode(), operator<<(), llvm::formatted_raw_ostream::PadToColumn(), printBSDMemberHeader(), llvm::raw_fd_ostream::resetColor(), llvm::raw_fd_ostream::reverseColor(), llvm::raw_fd_ostream::seek(), shouldKeepInEntry(), llvm::support::endian::write(), write(), llvm::write_hex(), write_padding(), write_unsigned_impl(), llvm::yaml::BinaryRef::writeAsBinary(), llvm::yaml::BinaryRef::writeAsHex(), llvm::WriteBitcodeToFile(), llvm::WriteIndexToFile(), writeInteger(), llvm::ARMAsmBackend::writeNopData(), llvm::RISCVAsmBackend::writeNopData(), writeSymbolTable(), llvm::WriteThinLinkBitcodeToFile(), writeWithCommas(), ZeroFillBytes(), and llvm::raw_fd_ostream::~raw_fd_ostream().
raw_ostream & raw_ostream::write | ( | const char * | Ptr, |
size_t | Size | ||
) |
Definition at line 224 of file raw_ostream.cpp.
References assert(), LLVM_FALLTHROUGH, LLVM_UNLIKELY, llvm::Intrinsic::memcpy, SetBuffered(), Size, and write().
raw_ostream & raw_ostream::write_escaped | ( | StringRef | Str, |
bool | UseHexEscapes = false |
||
) |
Output Str
, turning '\', '', '
', '"', and anything that doesn't satisfy llvm::isPrint into an escape sequence.
Definition at line 147 of file raw_ostream.cpp.
References llvm::isPrint().
Referenced by llvm::DWARFFormValue::dump(), llvm::DWARFContext::dump(), llvm::AsmToken::dump(), llvm::StringToOffsetTable::EmitCharArray(), llvm::StringToOffsetTable::EmitString(), llvm::object::ArchiveMemberHeader::getAccessMode(), llvm::object::ArchiveMemberHeader::getGID(), llvm::object::ArchiveMemberHeader::getLastModified(), llvm::object::ArchiveMemberHeader::getName(), llvm::object::ArchiveMemberHeader::getSize(), llvm::object::ArchiveMemberHeader::getUID(), llvm::FileCheckPattern::PrintVariableUses(), llvm::MCExternalSymbolizer::tryAddingPcLoadReferenceComment(), and llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand().
raw_ostream & raw_ostream::write_hex | ( | unsigned long long | N | ) |
Output N
in hexadecimal, without any prefix or padding.
Definition at line 132 of file raw_ostream.cpp.
References llvm::Lower, and llvm::write_hex().
Referenced by dumpDataAux(), llvm::DIEInteger::print(), llvm::AArch64InstPrinter::printAlignedLabel(), printExpr(), printHex32(), llvm::AArch64InstPrinter::printLogicalImm(), llvm::ARMInstPrinter::printNEONModImmOperand(), llvm::ARMInstPrinter::printOperand(), PrintQuotedString(), printSImmOperand(), llvm::HexagonShuffler::shuffle(), and llvm::Twine::toNullTerminatedStringRef().
raw_ostream & raw_ostream::write_uuid | ( | const uuid_t | UUID | ) |
Definition at line 137 of file raw_ostream.cpp.
References llvm::format().
Referenced by dumpUUID(), and llvm::yaml::ScalarTraits< uuid_t >::output().
raw_ostream & raw_ostream::write_zeros | ( | unsigned | NumZeros | ) |
write_zeros - Insert 'NumZeros' nulls.
Definition at line 483 of file raw_ostream.cpp.
Referenced by adjustFixupValue(), getFixupKindNumBytes(), llvm::AVRAsmBackend::writeNopData(), llvm::MipsAsmBackend::writeNopData(), and llvm::MachObjectWriter::writeObject().