LLVM  6.0.0svn
Public Types | Public Member Functions | Protected Member Functions | List of all members
llvm::raw_ostream Class Referenceabstract

This class implements an extremely fast bulk output stream that can only output to a stream. More...

#include "llvm/Support/raw_ostream.h"

Inheritance diagram for llvm::raw_ostream:
Inheritance graph
[legend]

Public Types

enum  Colors {
  BLACK = 0, RED, GREEN, YELLOW,
  BLUE, MAGENTA, CYAN, WHITE,
  SAVEDCOLOR
}
 

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_ostreamoperator<< (char C)
 
raw_ostreamoperator<< (unsigned char C)
 
raw_ostreamoperator<< (signed char C)
 
raw_ostreamoperator<< (StringRef Str)
 
raw_ostreamoperator<< (const char *Str)
 
raw_ostreamoperator<< (const std::string &Str)
 
raw_ostreamoperator<< (const SmallVectorImpl< char > &Str)
 
raw_ostreamoperator<< (unsigned long N)
 
raw_ostreamoperator<< (long N)
 
raw_ostreamoperator<< (unsigned long long N)
 
raw_ostreamoperator<< (long long N)
 
raw_ostreamoperator<< (const void *P)
 
raw_ostreamoperator<< (unsigned int N)
 
raw_ostreamoperator<< (int N)
 
raw_ostreamoperator<< (double N)
 
raw_ostreamwrite_hex (unsigned long long N)
 Output N in hexadecimal, without any prefix or padding. More...
 
raw_ostreamwrite_escaped (StringRef Str, bool UseHexEscapes=false)
 Output Str, turning '\', '', '
', '"', and anything that doesn't satisfy std::isprint into an escape sequence. More...
 
raw_ostreamwrite (unsigned char C)
 
raw_ostreamwrite (const char *Ptr, size_t Size)
 
raw_ostreamoperator<< (const format_object_base &Fmt)
 
raw_ostreamoperator<< (const FormattedString &)
 
raw_ostreamoperator<< (const FormattedNumber &)
 
raw_ostreamoperator<< (const formatv_object_base &)
 
raw_ostreamoperator<< (const FormattedBytes &)
 
raw_ostreamindent (unsigned NumSpaces)
 indent - Insert 'NumSpaces' spaces. More...
 
virtual raw_ostreamchangeColor (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_ostreamresetColor ()
 Resets the colors to terminal defaults. More...
 
virtual raw_ostreamreverseColor ()
 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 chargetBufferStart () const
 Return the beginning of the current stream buffer, or 0 if the stream is unbuffered. More...
 

Detailed Description

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 44 of file raw_ostream.h.

Member Enumeration Documentation

◆ Colors

Enumerator
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 
SAVEDCOLOR 

Definition at line 74 of file raw_ostream.h.

Constructor & Destructor Documentation

◆ raw_ostream() [1/2]

llvm::raw_ostream::raw_ostream ( bool  unbuffered = false)
inlineexplicit

Definition at line 86 of file raw_ostream.h.

◆ raw_ostream() [2/2]

llvm::raw_ostream::raw_ostream ( const raw_ostream )
delete

◆ ~raw_ostream()

raw_ostream::~raw_ostream ( )
virtual

Definition at line 71 of file raw_ostream.cpp.

References assert().

Member Function Documentation

◆ changeColor()

virtual raw_ostream& llvm::raw_ostream::changeColor ( enum Colors  Color,
bool  Bold = false,
bool  BG = false 
)
inlinevirtual

Changes the foreground color of text that will be output from this point forward.

Parameters
ColorANSI color to use, the special SAVEDCOLOR can be used to change only the bold attribute, and keep colors untouched
Boldbold/brighter text, default false
BGif true change the background, default: change foreground
Returns
itself so it can be used within << invocations

Reimplemented in llvm::raw_fd_ostream, and llvm::formatted_raw_ostream.

Definition at line 248 of file raw_ostream.h.

Referenced by llvm::formatted_raw_ostream::changeColor(), llvm::SMDiagnostic::print(), and llvm::dwarf::syntax::WithColor::WithColor().

◆ flush()

void llvm::raw_ostream::flush ( )
inline

Definition at line 140 of file raw_ostream.h.

Referenced by llvm::object::ArchiveMemberHeader::ArchiveMemberHeader(), llvm::raw_fd_ostream::changeColor(), llvm::object::Archive::Child::Child(), llvm::raw_fd_ostream::close(), createMissedAnalysis(), createSchedInfoStr(), llvm::ImportedFunctionsInliningStatistics::dump(), llvm::pdb::PDBSymbol::dumpChildStats(), llvm::pdb::PDBSymbol::dumpProperties(), emitComments(), EmitDebugSectionImpl(), llvm::ARMAsmPrinter::EmitEndOfAsmFile(), llvm::X86AsmPrinter::EmitEndOfAsmFile(), llvm::AMDGPUAsmPrinter::EmitInstruction(), llvm::emitLinkerFlagsForGlobalCOFF(), fail(), llvm::MCJIT::generateCodeForModule(), llvm::object::ArchiveMemberHeader::getAccessMode(), getBlockName(), llvm::BFIDOTGraphTraitsBase< BlockFrequencyInfoT, BranchProbabilityInfoT >::getEdgeAttributes(), llvm::LockFileManager::getErrorMessage(), getFunctionName(), 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(), getSpecialRegForName(), llvm::object::ArchiveMemberHeader::getUID(), llvm::NVPTXAsmPrinter::getVirtualRegisterName(), llvm::isThumbFunc(), LLVMGetDiagInfoDescription(), LLVMGetSymbolAddress(), LLVMGetSymbolName(), LLVMMoveToContainingSection(), LLVMParseIRInContext(), LLVMPrintModuleToString(), LLVMPrintTypeToString(), LLVMPrintValueToString(), LLVMTargetMachineEmit(), LLVMTargetMachineEmitToFile(), llvm::NVPTXTargetLowering::LowerOperation(), llvm::CodeViewYAML::detail::UnknownSymbolRecord::map(), llvm::LTOCodeGenerator::parseCodeGenDebugOptions(), llvm::MIRPrinter::print(), llvm::DiagnosticInfoUnsupported::print(), PrintCurStackTrace(), llvm::opt::OptTable::PrintHelp(), llvm::AMDGPUInstPrinter::printInst(), llvm::PrintStatistics(), llvm::PrintStatisticsJSON(), llvm::RuntimeDyldELF::processRelocationRef(), reportError(), ReportError(), reportOpenError(), llvm::raw_fd_ostream::resetColor(), llvm::raw_fd_ostream::reverseColor(), rewritesSort(), llvm::raw_fd_ostream::seek(), llvm::setProfMetadata(), llvm::raw_sha1_ostream::sha1(), llvm::formatv_object_base::str(), llvm::sys::StrError(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::VerifyLevels(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::verifyNCD(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::verifyParentProperty(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::verifyReachability(), llvm::DomTreeBuilder::SemiNCAInfo< DomTreeT >::verifySiblingProperty(), 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().

◆ GetBufferSize()

size_t llvm::raw_ostream::GetBufferSize ( ) const
inline

Definition at line 114 of file raw_ostream.h.

Referenced by llvm::formatted_raw_ostream::is_displayed().

◆ getBufferStart()

const char* llvm::raw_ostream::getBufferStart ( ) const
inlineprotected

Return the beginning of the current stream buffer, or 0 if the stream is unbuffered.

Definition at line 312 of file raw_ostream.h.

References Mode.

Referenced by llvm::formatted_raw_ostream::PadToColumn().

◆ GetNumBytesInBuffer()

size_t llvm::raw_ostream::GetNumBytesInBuffer ( ) const
inline

Definition at line 132 of file raw_ostream.h.

Referenced by llvm::formatted_raw_ostream::PadToColumn(), and SetBuffered().

◆ has_colors()

virtual bool llvm::raw_ostream::has_colors ( ) const
inlinevirtual

This function determines if this stream is displayed and supports colors.

Reimplemented in llvm::raw_fd_ostream.

Definition at line 270 of file raw_ostream.h.

Referenced by llvm::SMDiagnostic::print(), llvm::dwarf::syntax::WithColor::WithColor(), and llvm::dwarf::syntax::WithColor::~WithColor().

◆ indent()

raw_ostream & raw_ostream::indent ( unsigned  NumSpaces)

indent - Insert 'NumSpaces' spaces.

Definition at line 452 of file raw_ostream.cpp.

References llvm::array_lengthof(), and write().

Referenced by llvm::pdb::IPDBSourceFile::dump(), llvm::DWARFDebugLoc::dump(), llvm::DWARFDebugLocDWO::dump(), llvm::LexicalScope::dump(), llvm::DWARFDie::dump(), dumpAttribute(), llvm::RGPassManager::dumpPassStructure(), llvm::LPPassManager::dumpPassStructure(), llvm::Pass::dumpPassStructure(), llvm::FPPassManager::dumpPassStructure(), dumpRanges(), llvm::StringMatcher::Emit(), emitBasicBlockLoopComments(), llvm::detail::PadAdapter< T >::format(), llvm::legacy::FunctionPassManagerImpl::getContainedManager(), operator<<(), llvm::formatted_raw_ostream::PadToColumn(), llvm::PassManagerPrettyStackEntry::print(), llvm::MemoryDepChecker::Dependence::print(), llvm::sampleprof::FunctionSamples::print(), llvm::SCEVEqualPredicate::print(), llvm::LoopBase< BasicBlock, Loop >::print(), llvm::SCEVWrapPredicate::print(), llvm::RuntimePointerChecking::print(), llvm::RegionBase< RegionTraits< Function > >::print(), llvm::LoopAccessInfo::print(), llvm::LoopAccessLegacyAnalysis::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(), printrWithDepthHelper(), printWithSpacePadding(), llvm::LoopAccessInfoPrinterPass::run(), sortSubCommands(), and llvm::TimerGroup::~TimerGroup().

◆ is_displayed()

virtual bool llvm::raw_ostream::is_displayed ( ) const
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 267 of file raw_ostream.h.

Referenced by llvm::CheckBitcodeOutputToConsole(), and llvm::formatted_raw_ostream::is_displayed().

◆ operator<<() [1/20]

raw_ostream& llvm::raw_ostream::operator<< ( char  C)
inline

Definition at line 145 of file raw_ostream.h.

References C, and write().

Referenced by operator<<().

◆ operator<<() [2/20]

raw_ostream& llvm::raw_ostream::operator<< ( unsigned char  C)
inline

Definition at line 152 of file raw_ostream.h.

References C, and write().

◆ operator<<() [3/20]

raw_ostream& llvm::raw_ostream::operator<< ( signed char  C)
inline

Definition at line 159 of file raw_ostream.h.

References C, and write().

◆ operator<<() [4/20]

raw_ostream& llvm::raw_ostream::operator<< ( StringRef  Str)
inline

◆ operator<<() [5/20]

raw_ostream& llvm::raw_ostream::operator<< ( const char Str)
inline

Definition at line 181 of file raw_ostream.h.

References llvm::operator<<().

◆ operator<<() [6/20]

raw_ostream& llvm::raw_ostream::operator<< ( const std::string &  Str)
inline

Definition at line 188 of file raw_ostream.h.

References write().

◆ operator<<() [7/20]

raw_ostream& llvm::raw_ostream::operator<< ( const SmallVectorImpl< char > &  Str)
inline

Definition at line 193 of file raw_ostream.h.

References N, llvm::operator<<(), P, and write().

◆ operator<<() [8/20]

raw_ostream & raw_ostream::operator<< ( unsigned long  N)

Definition at line 117 of file raw_ostream.cpp.

References llvm::Integer, and llvm::write_integer().

◆ operator<<() [9/20]

raw_ostream & raw_ostream::operator<< ( long  N)

Definition at line 122 of file raw_ostream.cpp.

References llvm::Integer, and llvm::write_integer().

◆ operator<<() [10/20]

raw_ostream & raw_ostream::operator<< ( unsigned long long  N)

Definition at line 127 of file raw_ostream.cpp.

References llvm::Integer, and llvm::write_integer().

◆ operator<<() [11/20]

raw_ostream & raw_ostream::operator<< ( long long  N)

Definition at line 132 of file raw_ostream.cpp.

References llvm::Integer, and llvm::write_integer().

◆ operator<<() [12/20]

raw_ostream & raw_ostream::operator<< ( const void *  P)

Definition at line 182 of file raw_ostream.cpp.

References llvm::PrefixLower, and llvm::write_hex().

◆ operator<<() [13/20]

raw_ostream& llvm::raw_ostream::operator<< ( unsigned int  N)
inline

Definition at line 203 of file raw_ostream.h.

References N.

◆ operator<<() [14/20]

raw_ostream& llvm::raw_ostream::operator<< ( int  N)
inline

◆ operator<<() [15/20]

raw_ostream & raw_ostream::operator<< ( double  N)

Definition at line 187 of file raw_ostream.cpp.

References assert(), llvm::Exponent, and llvm::write_double().

◆ operator<<() [16/20]

raw_ostream & raw_ostream::operator<< ( const format_object_base Fmt)

◆ operator<<() [17/20]

raw_ostream & raw_ostream::operator<< ( const FormattedString FS)

◆ operator<<() [18/20]

raw_ostream & raw_ostream::operator<< ( const FormattedNumber FN)

◆ operator<<() [19/20]

raw_ostream & raw_ostream::operator<< ( const formatv_object_base Obj)

Definition at line 322 of file raw_ostream.cpp.

References llvm::formatv_object_base::format().

◆ operator<<() [20/20]

raw_ostream & raw_ostream::operator<< ( const FormattedBytes FB)

◆ operator=()

void llvm::raw_ostream::operator= ( const raw_ostream )
delete

◆ preferred_buffer_size()

size_t raw_ostream::preferred_buffer_size ( ) const
protectedvirtual

Return an efficient buffer size for the underlying output mechanism.

Definition at line 84 of file raw_ostream.cpp.

Referenced by llvm::raw_fd_ostream::seek(), and SetBuffered().

◆ resetColor()

virtual raw_ostream& llvm::raw_ostream::resetColor ( )
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 259 of file raw_ostream.h.

Referenced by llvm::SMDiagnostic::print(), llvm::formatted_raw_ostream::resetColor(), and llvm::dwarf::syntax::WithColor::~WithColor().

◆ reverseColor()

virtual raw_ostream& llvm::raw_ostream::reverseColor ( )
inlinevirtual

Reverses the foreground and background colors.

Reimplemented in llvm::raw_fd_ostream, and llvm::formatted_raw_ostream.

Definition at line 262 of file raw_ostream.h.

Referenced by llvm::formatted_raw_ostream::reverseColor().

◆ SetBuffer()

void llvm::raw_ostream::SetBuffer ( char BufferStart,
size_t  Size 
)
inlineprotected

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 303 of file raw_ostream.h.

◆ SetBuffered()

void raw_ostream::SetBuffered ( )

Set the stream to be buffered, with an automatically determined buffer size.

Definition at line 89 of file raw_ostream.cpp.

References assert(), GetNumBytesInBuffer(), Mode, preferred_buffer_size(), SetBufferSize(), SetUnbuffered(), and llvm::AMDGPU::CodeObject::Kernel::Arg::Key::Size.

Referenced by write().

◆ SetBufferSize()

void llvm::raw_ostream::SetBufferSize ( size_t  Size)
inline

Set the stream to be buffered, using the specified buffer size.

Definition at line 109 of file raw_ostream.h.

Referenced by llvm::formatted_raw_ostream::is_displayed(), and SetBuffered().

◆ SetUnbuffered()

void llvm::raw_ostream::SetUnbuffered ( )
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 127 of file raw_ostream.h.

Referenced by llvm::formatted_raw_ostream::is_displayed(), and SetBuffered().

◆ tell()

uint64_t llvm::raw_ostream::tell ( ) const
inline

◆ write() [1/2]

raw_ostream & raw_ostream::write ( unsigned char  C)

◆ write() [2/2]

raw_ostream & raw_ostream::write ( const char Ptr,
size_t  Size 
)

◆ write_escaped()

raw_ostream & raw_ostream::write_escaped ( StringRef  Str,
bool  UseHexEscapes = false 
)

◆ write_hex()

raw_ostream & raw_ostream::write_hex ( unsigned long long  N)

The documentation for this class was generated from the following files: