LLVM API Documentation
#include <raw_ostream.h>
Public Types | |
enum | Colors { BLACK =0, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, SAVEDCOLOR } |
Public Member Functions | |
raw_ostream (bool unbuffered=false) | |
virtual | ~raw_ostream () |
uint64_t | tell () const |
tell - Return the current offset with the file. More... | |
void | SetBuffered () |
void | SetBufferSize (size_t Size) |
size_t | GetBufferSize () const |
void | SetUnbuffered () |
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<< (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) |
write_hex - Output N in hexadecimal, without any prefix or padding. More... | |
raw_ostream & | write_escaped (StringRef Str, bool UseHexEscapes=false) |
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 & | indent (unsigned NumSpaces) |
indent - Insert 'NumSpaces' spaces. More... | |
virtual raw_ostream & | changeColor (enum Colors Color, bool Bold=false, bool BG=false) |
virtual raw_ostream & | resetColor () |
virtual raw_ostream & | reverseColor () |
Reverses the forground and background colors. More... | |
virtual bool | is_displayed () const |
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) |
virtual size_t | preferred_buffer_size () const |
const char * | getBufferStart () const |
raw_ostream - 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 31 of file raw_ostream.h.
Enumerator | |
---|---|
BLACK | |
RED | |
GREEN | |
YELLOW | |
BLUE | |
MAGENTA | |
CYAN | |
WHITE | |
SAVEDCOLOR |
Definition at line 64 of file raw_ostream.h.
Definition at line 76 of file raw_ostream.h.
|
virtual |
Definition at line 61 of file raw_ostream.cpp.
|
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 219 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::changeColor(), and llvm::SMDiagnostic::print().
|
inline |
Definition at line 129 of file raw_ostream.h.
Referenced by llvm::raw_fd_ostream::changeColor(), llvm::raw_fd_ostream::close(), emitComments(), llvm::AMDGPUAsmPrinter::EmitInstruction(), llvm::MCObjectStreamer::EmitInstToFragment(), llvm::ObjectBufferStream::flush(), getBlockName(), getBlockNum(), llvm::object::MachOObjectFile::getRelocationValueString(), llvm::object::ELFObjectFile< ELFT >::getRelocationValueString(), llvm::NVPTXAsmPrinter::getVirtualRegisterName(), LLVMDisasmInstruction(), LLVMParseIRInContext(), LLVMPrintModuleToFile(), LLVMPrintModuleToString(), LLVMPrintTypeToString(), LLVMPrintValueToString(), LLVMTargetMachineEmit(), LLVMTargetMachineEmitToFile(), LLVMTargetMachineEmitToMemoryBuffer(), PrintCurStackTrace(), llvm::opt::OptTable::PrintHelp(), llvm::AMDGPUInstPrinter::printInst(), llvm::PrintStatistics(), llvm::raw_fd_ostream::resetColor(), llvm::raw_fd_ostream::reverseColor(), llvm::raw_fd_ostream::seek(), SetBufferSize(), SetUnbuffered(), llvm::raw_string_ostream::str(), llvm::raw_svector_ostream::str(), llvm::sys::StrError(), 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(), llvm::raw_string_ostream::~raw_string_ostream(), and llvm::raw_svector_ostream::~raw_svector_ostream().
|
inline |
Definition at line 102 of file raw_ostream.h.
References preferred_buffer_size().
Referenced by llvm::formatted_raw_ostream::setStream().
|
inlineprotected |
getBufferStart - Return the beginning of the current stream buffer, or 0 if the stream is unbuffered.
Definition at line 285 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::PadToColumn().
|
inline |
Definition at line 121 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::PadToColumn(), llvm::raw_svector_ostream::resync(), and tell().
|
inlinevirtual |
This function determines if this stream is displayed and supports colors.
Reimplemented in llvm::raw_fd_ostream.
Definition at line 241 of file raw_ostream.h.
References is_displayed().
Referenced by llvm::SMDiagnostic::print().
raw_ostream & raw_ostream::indent | ( | unsigned | NumSpaces | ) |
indent - Insert 'NumSpaces' spaces.
Definition at line 392 of file raw_ostream.cpp.
References llvm::array_lengthof(), and write().
Referenced by llvm::DWARFDebugInfoEntryMinimal::dump(), llvm::DWARFDebugLoc::dump(), llvm::LexicalScope::dump(), llvm::DWARFDebugInfoEntryMinimal::dumpAttribute(), DumpNodes(), DumpNodesr(), llvm::LPPassManager::dumpPassStructure(), llvm::RGPassManager::dumpPassStructure(), llvm::Pass::dumpPassStructure(), llvm::FPPassManager::dumpPassStructure(), llvm::StringMatcher::Emit(), emitBasicBlockLoopComments(), llvm::formatted_raw_ostream::PadToColumn(), llvm::LoopBase< N, M >::print(), llvm::Region::print(), PrintChildLoopComment(), llvm::PrintDomTree(), llvm::cl::generic_parser_base::printGenericOptionDiff(), PrintHelpOptionList(), printHelpStr(), llvm::cl::generic_parser_base::printOptionInfo(), llvm::cl::basic_parser_impl::printOptionName(), PrintParentLoopComment(), llvm::DOTGraphTraits< RegionInfo * >::printRegionCluster(), and printrWithDepthHelper().
|
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 238 of file raw_ostream.h.
Referenced by llvm::CheckBitcodeOutputToConsole(), has_colors(), and llvm::formatted_raw_ostream::is_displayed().
|
inline |
Definition at line 134 of file raw_ostream.h.
References llvm::CallingConv::C, and write().
Referenced by operator<<().
|
inline |
Definition at line 141 of file raw_ostream.h.
References llvm::CallingConv::C, and write().
|
inline |
Definition at line 148 of file raw_ostream.h.
References llvm::CallingConv::C, and write().
|
inline |
Definition at line 155 of file raw_ostream.h.
References llvm::StringRef::data(), llvm::Intrinsic::memcpy, llvm::StringRef::size(), and write().
|
inline |
Definition at line 168 of file raw_ostream.h.
References operator<<().
|
inline |
Definition at line 175 of file raw_ostream.h.
References write().
raw_ostream & raw_ostream::operator<< | ( | unsigned long | N | ) |
Definition at line 107 of file raw_ostream.cpp.
References write().
raw_ostream & raw_ostream::operator<< | ( | long | N | ) |
Definition at line 123 of file raw_ostream.cpp.
References N.
raw_ostream & raw_ostream::operator<< | ( | unsigned long long | N | ) |
Definition at line 133 of file raw_ostream.cpp.
raw_ostream & raw_ostream::operator<< | ( | long long | N | ) |
Definition at line 149 of file raw_ostream.cpp.
References N.
raw_ostream & raw_ostream::operator<< | ( | const void * | P | ) |
Definition at line 219 of file raw_ostream.cpp.
References write_hex().
|
inline |
Definition at line 185 of file raw_ostream.h.
References N.
|
inline |
Definition at line 189 of file raw_ostream.h.
References N.
raw_ostream & raw_ostream::operator<< | ( | double | N | ) |
Definition at line 225 of file raw_ostream.cpp.
References llvm::format(), llvm::LibFunc::isdigit, operator<<(), and llvm::LibFunc::snprintf.
raw_ostream & raw_ostream::operator<< | ( | const format_object_base & | Fmt | ) |
Definition at line 351 of file raw_ostream.cpp.
References llvm::SmallVectorTemplateCommon< T >::data(), llvm::format_object_base::print(), llvm::SmallVectorImpl< T >::resize(), and write().
|
protectedvirtual |
preferred_buffer_size - Return an efficient buffer size for the underlying output mechanism.
Definition at line 74 of file raw_ostream.cpp.
Referenced by GetBufferSize(), 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 230 of file raw_ostream.h.
Referenced by llvm::SMDiagnostic::print(), and llvm::formatted_raw_ostream::resetColor().
|
inlinevirtual |
Reverses the forground and background colors.
Reimplemented in llvm::raw_fd_ostream, and llvm::formatted_raw_ostream.
Definition at line 233 of file raw_ostream.h.
Referenced by llvm::formatted_raw_ostream::reverseColor().
|
inlineprotected |
SetBuffer - 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 275 of file raw_ostream.h.
Referenced by llvm::raw_svector_ostream::raw_svector_ostream(), and llvm::raw_svector_ostream::resync().
void raw_ostream::SetBuffered | ( | ) |
SetBuffered - Set the stream to be buffered, with an automatically determined buffer size.
Definition at line 79 of file raw_ostream.cpp.
References preferred_buffer_size(), SetBufferSize(), and SetUnbuffered().
Referenced by write().
|
inline |
SetBufferSize - Set the stream to be buffered, using the specified buffer size.
Definition at line 97 of file raw_ostream.h.
References flush().
Referenced by SetBuffered(), and llvm::formatted_raw_ostream::setStream().
|
inline |
SetUnbuffered - 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 116 of file raw_ostream.h.
References flush().
Referenced by SetBuffered(), and llvm::formatted_raw_ostream::setStream().
|
inline |
tell - Return the current offset with the file.
Definition at line 85 of file raw_ostream.h.
References GetNumBytesInBuffer().
Referenced by llvm::MCAssembler::Finish(), printLine(), llvm::MachObjectWriter::WriteDysymtabLoadCommand(), writeFragment(), llvm::MachObjectWriter::WriteHeader(), llvm::MachObjectWriter::WriteLinkeditLoadCommand(), llvm::MachObjectWriter::WriteLinkerOptionsLoadCommand(), llvm::MachObjectWriter::WriteSection(), llvm::MCAssembler::writeSectionData(), llvm::MachObjectWriter::WriteSegmentLoadCommand(), and llvm::MachObjectWriter::WriteSymtabLoadCommand().
raw_ostream & raw_ostream::write | ( | unsigned char | C | ) |
Definition at line 269 of file raw_ostream.cpp.
References llvm::CallingConv::C, LLVM_UNLIKELY, and SetBuffered().
Referenced by llvm::raw_fd_ostream::changeColor(), EmitGCCInlineAsmStr(), EmitMSInlineAsmStr(), llvm::circular_raw_ostream::flushBufferWithBanner(), indent(), operator<<(), llvm::raw_fd_ostream::resetColor(), llvm::raw_fd_ostream::reverseColor(), write(), write_hex(), llvm::object::yaml::BinaryRef::writeAsBinary(), llvm::object::yaml::BinaryRef::writeAsHex(), and llvm::WriteBitcodeToFile().
raw_ostream & raw_ostream::write | ( | const char * | Ptr, |
size_t | Size | ||
) |
Definition at line 289 of file raw_ostream.cpp.
References LLVM_UNLIKELY, SetBuffered(), and write().
raw_ostream & raw_ostream::write_escaped | ( | StringRef | Str, |
bool | UseHexEscapes = false |
||
) |
write_escaped - Output Str
, turning '\', '', '
', '"', and anything that doesn't satisfy std::isprint into an escape sequence.
Definition at line 177 of file raw_ostream.cpp.
References llvm::StringRef::size().
Referenced by llvm::DWARFFormValue::dump(), and llvm::StringToOffsetTable::EmitString().
raw_ostream & raw_ostream::write_hex | ( | unsigned long long | N | ) |
write_hex - Output N
in hexadecimal, without any prefix or padding.
Definition at line 159 of file raw_ostream.cpp.
References write().
Referenced by dumpDataAux(), llvm::MipsTargetAsmStreamer::emitMipsHackELFFlags(), operator<<(), llvm::DIEInteger::print(), llvm::MipsAsmPrinter::printHex32(), llvm::AArch64InstPrinter::printLogicalImmOperand(), llvm::ARMInstPrinter::printNEONModImmOperand(), llvm::AArch64InstPrinter::printNeonUImm64MaskOperand(), llvm::ARMInstPrinter::printOperand(), llvm::AArch64InstPrinter::printOperand(), and llvm::AArch64InstPrinter::printUImmHexOperand().