llvm::raw_fd_ostream

A raw_ostream that writes to a file descriptor.

Synopsis

Declared in <llvm/Support/raw_ostream.h>

class raw_fd_ostream
    : public raw_pwrite_stream

Base Classes

NameDescription
raw_pwrite_streamAn abstract base class for streams implementations that also support a pwrite operation. This is useful for code that can mostly stream out data, but needs to patch in a header that needs to know the output size.

Type Aliases

NameDescription
uuid_t Output a formatted UUID with dash separators.

Enums

NameDescription
Colors ANSI terminal color codes.
OStreamKind Discriminator for concrete raw_ostream subclasses.

Member Functions

NameDescription
raw_fd_ostream [constructor]Constructors
~raw_fd_ostream [destructor] [virtual]Flush and optionally close the underlying file descriptor.
operator= [deleted]Copy-assignment is deleted.
GetBufferSize Return the size of the current stream buffer, or the preferred size if buffering is enabled but the buffer has not been allocated yet.
GetNumBytesInBuffer Return the number of bytes currently held in the stream buffer.
SetBufferSize Set the stream to be buffered, using the specified buffer size.
SetBuffered Set the stream to be buffered, with an automatically determined buffer size.
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.
changeColor [virtual]Changes the foreground color of text that will be output from this point forward.
clear_error Set the flag read by has_error() to false. If the error flag is set at the time when this raw_ostream's destructor is called, report_fatal_error is called to report the error. Use clear_error() after handling the error to avoid this behavior.
close Manually flush the stream and close the file. Note that this does not call fsync.
colors_enabled Return true if ANSI color output is currently enabled.
enable_colors [virtual]Enable or disable ANSI color output for subsequent writes.
error Return the sticky error code for this stream.
flush Flush buffered output to the underlying device.
get_kind Return the concrete stream kind discriminator.
has_colors [virtual]Return true if the file stream supports ANSI colors.
has_error Return the value of the flag in this raw_fd_ostream indicating whether an output error has been encountered. This doesn't implicitly flush any pending output. Also, it doesn't guarantee to detect all errors unless the stream has been closed.
indent indent - Insert 'NumSpaces' spaces.
isRegularFile Return true if the underlying file is a regular file.
is_displayed [virtual]Return true if output from this stream is shown to the user (e.g. a TTY).
lock Locks the underlying file.
pwrite Write Size bytes from Ptr at absolute stream offset Offset.
reserveExtraSpace [virtual]If possible, pre-allocate ExtraSize bytes for stream data. i.e. it extends internal buffers to keep additional ExtraSize bytes. So that the stream could keep at least tell() + ExtraSize bytes without re-allocations. reserveExtraSpace() does not change the size/data of the stream.
resetColor [virtual]Resets the colors to terminal defaults. Call this when you are done outputting colored text, or before program exit.
reverseColor [virtual]Reverses the foreground and background colors.
seek Flushes the stream and repositions the underlying file descriptor position to the offset specified from the beginning of the file.
supportsSeeking Return true if this stream can seek its underlying file descriptor.
tell tell - Return the current offset with the file.
tie Tie this stream to the specified stream. Replaces any existing tied-to stream. Specifying a nullptr unties the stream. This is intended for to tie errs() to outs(), so that outs() is flushed whenever something is written to errs(), preventing weird and hard-to-test output when stderr is redirected to stdout.
tryLockFor Tries to lock the underlying file within the specified period.
write write overloads
write_escaped Output Str, turning '', 't', ' ', '"', and anything that doesn't satisfy llvm::isPrint into an escape sequence.
write_hex Output N in hexadecimal, without any prefix or padding.
write_uuid Write UUID UUID to the stream.
write_zeros write_zeros - Insert 'NumZeros' nulls.
operator<< Left shift operators

Static Data Members

NameDescription
BLACK Black foreground color constant.
BLUE Blue foreground color constant.
BRIGHT_BLACK Bright black (gray) foreground color constant.
BRIGHT_BLUE Bright blue foreground color constant.
BRIGHT_CYAN Bright cyan foreground color constant.
BRIGHT_GREEN Bright green foreground color constant.
BRIGHT_MAGENTA Bright magenta foreground color constant.
BRIGHT_RED Bright red foreground color constant.
BRIGHT_WHITE Bright white foreground color constant.
BRIGHT_YELLOW Bright yellow foreground color constant.
CYAN Cyan foreground color constant.
GREEN Green foreground color constant.
MAGENTA Magenta foreground color constant.
RED Red foreground color constant.
RESET Reset colors to the terminal default.
SAVEDCOLOR Saved-color constant that preserves the current color.
WHITE White foreground color constant.
YELLOW Yellow foreground color constant.

Protected Member Functions

NameDescription
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.
error_detected Set the flag indicating that an output error has been encountered.
getBufferStart Return the beginning of the current stream buffer, or 0 if the stream is unbuffered.
get_fd Return the file descriptor.
inc_pos Advance the tracked file position by Delta bytes.
preferred_buffer_size [virtual]Return an efficient buffer size for the underlying output mechanism.

Non-Member Functions

NameDescription
CheckBitcodeOutputToConsoleDetermine if the raw_ostream provided is connected to a terminal. If so, generate a warning message to errs() advising against display of bitcode and return true. Otherwise just return false. Check for output written to a console
PrintStatisticsPrint statistics to the given output stream.
PrintStatisticsJSONPrint statistics in JSON format. This does include all global timers (
createBitcodeWriterPassCreate and return a pass that writes the module to the specified ostream. Note that this pass is designed for use with the legacy pass manager.
createMIR2VecPrinterLegacyPassMIR2VecPrinter pass - This pass prints out the MIR2Vec embeddings for machine functions, basic blocks and instructions.
createMIR2VecVocabPrinterLegacyPassMIR2VecVocabPrinter pass - This pass prints out the MIR2Vec vocabulary contents to the given stream as a debugging tool.
createMachineFunctionPrinterPassMachineFunctionPrinter pass - This pass prints out the machine function to the given stream as a debugging tool.
createPrintFunctionPassCreate and return a pass that prints functions to the specified raw_ostream as they are processed.
createPrintMIRPassMIRPrinting pass - this pass prints out the LLVM IR into the given stream using the MIR serialization format.
createPrintModulePassCreate and return a pass that writes the module to the specified raw_ostream.
errsThis returns a reference to a raw_ostream for standard error. Use it like: errs() << "foo" << "bar"; By default, the stream is tied to stdout to ensure stdout is flushed before stderr is written, to ensure the error messages are written in their expected place.
operator<<Stream insertion operator
operator<<Debug print ModRefInfo.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Write Mode to OS via DenormalMode::print.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Write the spelled name of RM to OS.
operator<<Write a human readable form of Mask to OS
operator<<Print a short description useful for debugging or logging.
operator<<Stream insertion operator
operator<<Print a version number.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Write a formatted object to OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<An raw_ostream inserter for modules.
operator<<Stream insertion operator
operator<<Forward declarations of output streams for debug purposes.
operator<<Stream insertion operator
operator<<Write optional value O to OS, or std::nullopt if empty.
operator<<Stream insertion operator
operator<<Invoke P's print callback on OS and return OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Print I to OS as a signed decimal.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Print I to OS using its signedness.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Prints X to OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Debug print MemoryEffects.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Write a representation of std::nullopt to OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Write UTC time point TP to stream OS.
operator<<Write a textual representation of V to OS.
operator<<Write Indent spaces to OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Write RHS to OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Print a RegionNode.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Print the name of this node's function.
operator<<Stream operator function for FixedOrScalableQuantity.
operator<<Stream insertion operator
operator<<Write a textual representation of error E to stream OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Print a short description useful for debugging or logging.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<<< operator for AliasResult.
operator<<Write time point TP to stream OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Write FPEnv to OS via DenormalFPEnv::print.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream a human-readable representation of FX to OS.
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
operator<<Stream insertion operator
outsThis returns a reference to a raw_fd_ostream for standard output. Use it like: outs() << "foo" << "bar";
printLLVMNameWithoutPrefixPrint out a name of an LLVM value without any prefixes.
printMIRPrint MIR using New Pass Manager (uses FunctionAnalysisManager). If VRM is non-null, the printer will serialize VirtRegMap state (split-from, assigned-phys).
printMIRPrint MIR using Legacy Pass Manager (uses MachineModuleInfo). If VRM is non-null, the printer will serialize VirtRegMap state (split-from, assigned-phys).
printMIRPrint LLVM IR using the MIR serialization format to the given output stream.
reportAndResetTimingsIf -time-passes has been specified, report the timings immediately and then reset the timers to zero. By default it uses the stream created by CreateInfoOutputFile().
timeTraceProfilerWriteWrite profiling data to output stream. Data produced is JSON, in Chrome "Trace Event" format, see https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
write_doubleWrite floating-point D to S using Style and optional Precision.
write_hexWrite hex value N to S using Style and optional field Width.
write_integerWrite signed long long N to S using Style and at least MinDigits.
write_integerWrite unsigned long N to S using Style and at least MinDigits.
write_integerWrite signed long N to S using Style and at least MinDigits.
write_integerWrite unsigned long long N to S using Style and at least MinDigits.
write_integerWrite unsigned int N to S using Style and at least MinDigits.
write_integerWrite signed int N to S using Style and at least MinDigits.
AA::operator<<Stream insertion operator
AMDGPU::operator<<Stream insertion operator
DomTreeBuilder::operator<<Stream insertion operator
GVNExpression::operator<<Stream insertion operator
IntegerInclusiveIntervalUtils::printIntervalsPrint intervals to output stream.
MachO::operator<<Stream insertion operator
MachO::operator<<Stream insertion operator
MachO::operator<<Stream insertion operator
MachO::operator<<Stream insertion operator
bfi_detail::operator<<Stream insertion operator
cas::operator<<Print ID to OS.
cl::printBuildConfigPrints the compiler build configuration. Designed for compiler developers, not compiler end-users. Intended to be used in --version output when enabled.
codeview::operator<<Stream insertion operator
dwarf::operator<<Stream insertion operator
dwarf::operator<<Stream insertion operator
dwarf::operator<<Stream insertion operator
dwarf::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
gsym::operator<<Stream insertion operator
ifs::writeIFSToOutputStreamAttempts to write an IFS interface file to a raw_ostream.
jitlink::operator<<Stream insertion operator
jitlink::operator<<Stream insertion operator
jitlink::operator<<Stream insertion operator
json::operator<<Serializes this Value to JSON, writing it to the provided stream. The formatting is compact (no extra whitespace) and deterministic. For pretty-printing, use the formatv() format_provider below.
lsp::operator<<Stream insertion operator
lsp::operator<<Stream insertion operator
lsp::operator<<Stream insertion operator
lsp::operator<<Stream insertion operator
lsp::operator<<Stream insertion operator
lsp::operator<<Stream insertion operator
lsp::operator<<Stream insertion operator
lsp::operator<<Stream insertion operator
lsp::operator<<Stream insertion operator
mca::operator<<Stream insertion operator
objcarc::operator<<Stream insertion operator
object::operator<<Stream insertion operator
orc::operator<<Render a SymbolMap entry.
orc::operator<<Render an array of SymbolStringPtrs.
orc::operator<<Stream insertion operator
orc::operator<<Stream insertion operator
orc::operator<<Render a SymbolLookupSet.
orc::operator<<Print a MemDeallocPolicy.
orc::operator<<Print an AllocGroup.
orc::operator<<Dump a SymbolStringPool. Useful for debugging dangling-pointer crashes.
orc::operator<<Stream insertion operator
orc::operator<<Render a SymbolLookupSet entry.
orc::operator<<Render a SymbolAliasMap.
orc::operator<<Render a JITDylibSearchOrder.
orc::operator<<Print a MemProt as an RWX triple.
orc::operator<<Render a SymbolMap.
orc::operator<<Render a SymbolLookupFlags instance.
orc::operator<<Render a LookupKind.
orc::operator<<Render a SymbolState.
orc::operator<<Render a SymbolDependendeMap.
orc::operator<<Render a SymbolNameSet.
orc::operator<<Stream insertion operator
orc::operator<<Render a SymbolDependenceMap entry.
orc::operator<<Render a SymbolNameVector.
orc::operator<<Render a SymbolFlagsMap entry.
orc::operator<<Render a SymbolFlagsMap.
orc::operator<<Render a MaterializationUnit.
orc::operator<<Render JITSymbolFlags.
orc::operator<</ Render a JITDylibLookupFlags instance.
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
pdb::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
rdf::operator<<Stream insertion operator
remarks::operator<<Stream insertion operator
remarks::operator<<Stream insertion operator
remarks::operator<<Stream insertion operator
sampleprof::operator<<Stream insertion operator
sampleprof::operator<<Stream insertion operator
sampleprof::operator<<Stream insertion operator
sampleprof::operator<<Stream insertion operator
sampleprof::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sandboxir::operator<<Stream insertion operator
sys::PrintStackTracePrint the stack trace using the given raw_ostream object.
sys::operator<<Debugging output for Memory::ProtectionFlags.
sys::operator<<Debugging output for MemoryBlock.
sys::printArgPrint a command argument, and optionally quote it.
sys::printDefaultTargetAndDetectedCPUThis is a function compatible with cl::AddExtraVersionPrinter, which adds info about the current target triple and detected CPU.
hlsl::rootsig::operator<<Stream insertion operator
hlsl::rootsig::operator<<Stream insertion operator
hlsl::rootsig::operator<<Stream insertion operator
hlsl::rootsig::operator<<Stream insertion operator
hlsl::rootsig::operator<<The following contains the serialization interface for root elements
hlsl::rootsig::operator<<Stream insertion operator
hlsl::rootsig::operator<<Stream insertion operator

Derived Classes

NameDescription
raw_fd_stream A raw_ostream of a file for reading/writing/seeking.