LLVM API Documentation

Public Types | Public Member Functions | Protected Member Functions
llvm::raw_ostream Class Reference

#include <raw_ostream.h>

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

List of all members.

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.
void SetBuffered ()
void SetBufferSize (size_t Size)
size_t GetBufferSize () const
void SetUnbuffered ()
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<< (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)
 write_hex - Output N in hexadecimal, without any prefix or padding.
raw_ostreamwrite_escaped (StringRef Str, bool UseHexEscapes=false)
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_ostreamindent (unsigned NumSpaces)
 indent - Insert 'NumSpaces' spaces.
virtual raw_ostreamchangeColor (enum Colors Color, bool Bold=false, bool BG=false)
virtual raw_ostreamresetColor ()
virtual raw_ostreamreverseColor ()
 Reverses the forground and background colors.
virtual bool is_displayed () const
virtual bool has_colors () const
 This function determines if this stream is displayed and supports colors.

Protected Member Functions

void SetBuffer (char *BufferStart, size_t Size)
virtual size_t preferred_buffer_size () const
const char * getBufferStart () const

Detailed Description

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


Member Enumeration Documentation

Enumerator:
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 
SAVEDCOLOR 

Definition at line 72 of file raw_ostream.h.


Constructor & Destructor Documentation

llvm::raw_ostream::raw_ostream ( bool  unbuffered = false) [inline, explicit]

Definition at line 84 of file raw_ostream.h.

Definition at line 62 of file raw_ostream.cpp.


Member Function Documentation

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

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

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

void llvm::raw_ostream::flush ( ) [inline]

Definition at line 137 of file raw_ostream.h.

Referenced by llvm::raw_fd_ostream::changeColor(), llvm::raw_fd_ostream::close(), llvm::LLVMContext::diagnose(), emitComments(), llvm::MCWinCOFFStreamer::EmitCommonSymbol(), llvm::AMDGPUAsmPrinter::EmitInstruction(), llvm::MCWinCOFFStreamer::EmitInstToData(), llvm::MCObjectStreamer::EmitInstToFragment(), llvm::MCJIT::emitObject(), getBlockName(), getBlockNum(), llvm::object::ELFObjectFile< ELFT >::getRelocationValueString(), llvm::object::MachOObjectFile::getRelocationValueString(), llvm::NVPTXAsmPrinter::getVirtualRegisterName(), LLVMDisasmInstruction(), LLVMGetDiagInfoDescription(), LLVMParseIRInContext(), 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().

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

Definition at line 110 of file raw_ostream.h.

References preferred_buffer_size().

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

const char* llvm::raw_ostream::getBufferStart ( ) const [inline, protected]

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

Definition at line 299 of file raw_ostream.h.

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

size_t llvm::raw_ostream::GetNumBytesInBuffer ( ) const [inline]
virtual bool llvm::raw_ostream::has_colors ( ) const [inline, virtual]

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

Reimplemented in llvm::raw_fd_ostream.

Definition at line 255 of file raw_ostream.h.

References is_displayed().

Referenced by llvm::SMDiagnostic::print().

virtual bool llvm::raw_ostream::is_displayed ( ) const [inline, virtual]

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

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

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

Definition at line 142 of file raw_ostream.h.

References llvm::CallingConv::C, and write().

Referenced by operator<<().

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

Definition at line 149 of file raw_ostream.h.

References llvm::CallingConv::C, and write().

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

Definition at line 156 of file raw_ostream.h.

References llvm::CallingConv::C, and write().

raw_ostream& llvm::raw_ostream::operator<< ( StringRef  Str) [inline]
raw_ostream& llvm::raw_ostream::operator<< ( const char *  Str) [inline]

Definition at line 176 of file raw_ostream.h.

References operator<<().

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

Definition at line 183 of file raw_ostream.h.

References write().

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

Definition at line 108 of file raw_ostream.cpp.

References write().

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

Definition at line 124 of file raw_ostream.cpp.

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

Definition at line 134 of file raw_ostream.cpp.

References write().

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

Definition at line 150 of file raw_ostream.cpp.

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

Definition at line 220 of file raw_ostream.cpp.

References write_hex().

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

Definition at line 193 of file raw_ostream.h.

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

Definition at line 197 of file raw_ostream.h.

raw_ostream & raw_ostream::operator<< ( double  N)
raw_ostream & raw_ostream::operator<< ( const format_object_base Fmt)
raw_ostream & raw_ostream::operator<< ( const FormattedString FS)

Definition at line 398 of file raw_ostream.cpp.

References indent(), operator<<(), and llvm::StringRef::size().

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

Definition at line 409 of file raw_ostream.cpp.

References llvm::ARM_PROC::A, llvm::countLeadingZeros(), indent(), N, and write().

size_t raw_ostream::preferred_buffer_size ( ) const [protected, virtual]

preferred_buffer_size - Return an efficient buffer size for the underlying output mechanism.

Definition at line 75 of file raw_ostream.cpp.

Referenced by GetBufferSize(), and SetBuffered().

virtual raw_ostream& llvm::raw_ostream::resetColor ( ) [inline, virtual]

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

Referenced by llvm::SMDiagnostic::print(), and llvm::formatted_raw_ostream::resetColor().

virtual raw_ostream& llvm::raw_ostream::reverseColor ( ) [inline, virtual]

Reverses the forground and background colors.

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

Definition at line 247 of file raw_ostream.h.

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

void llvm::raw_ostream::SetBuffer ( char *  BufferStart,
size_t  Size 
) [inline, protected]

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

Referenced by llvm::raw_svector_ostream::raw_svector_ostream(), and llvm::raw_svector_ostream::resync().

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

Definition at line 80 of file raw_ostream.cpp.

References preferred_buffer_size(), SetBufferSize(), and SetUnbuffered().

Referenced by write().

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

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

Definition at line 105 of file raw_ostream.h.

References flush().

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

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

References flush().

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

uint64_t llvm::raw_ostream::tell ( ) const [inline]
raw_ostream & raw_ostream::write ( const char *  Ptr,
size_t  Size 
)

Definition at line 296 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 178 of file raw_ostream.cpp.

References llvm::StringRef::size().

Referenced by llvm::DWARFFormValue::dump(), llvm::StringToOffsetTable::EmitString(), and llvm::MCExternalSymbolizer::tryAddingPcLoadReferenceComment().


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