LLVM 22.0.0git
|
A virtualized output file that writes to a specific backend. More...
#include "llvm/Support/VirtualOutputFile.h"
Classes | |
class | TrackedProxy |
Public Member Functions | |
StringRef | getPath () const |
bool | isOpen () const |
Check if keep() or discard() has already been called. | |
operator bool () const | |
raw_pwrite_stream & | getOS () |
operator raw_pwrite_stream & () | |
template<class T> | |
raw_ostream & | operator<< (T &&V) |
Error | keep () |
Keep an output. | |
Error | discard () |
Discard an output, cleaning up any temporary state. | |
void | discardOnDestroy (unique_function< void(Error E)> Handler) |
Discard the output when destroying it if it's still open, sending the result to Handler. | |
Expected< std::unique_ptr< raw_pwrite_stream > > | createProxy () |
Create a proxy stream for clients that need to pass an owned stream to a producer. | |
bool | hasOpenProxy () const |
std::unique_ptr< OutputFileImpl > | takeImpl () |
Take the implementation. | |
bool | isNull () const |
Check whether this is a null output file. | |
OutputFile ()=default | |
OutputFile (const Twine &Path, std::unique_ptr< OutputFileImpl > Impl) | |
~OutputFile () | |
OutputFile (OutputFile &&O) | |
OutputFile & | operator= (OutputFile &&O) |
A virtualized output file that writes to a specific backend.
One of keep(), discard(), or discardOnDestroy() must be called before destruction.
Definition at line 59 of file VirtualOutputFile.h.
|
default |
Referenced by operator=(), and OutputFile().
|
inlineexplicit |
Definition at line 120 of file VirtualOutputFile.h.
References assert(), and llvm::move().
|
inline |
Definition at line 125 of file VirtualOutputFile.h.
|
inline |
Definition at line 126 of file VirtualOutputFile.h.
References OutputFile().
Expected< std::unique_ptr< raw_pwrite_stream > > OutputFile::createProxy | ( | ) |
Create a proxy stream for clients that need to pass an owned stream to a producer.
Errors if there's already a proxy. The proxy must be deleted before calling keep(). The proxy will crash if it's written to after calling discard().
Definition at line 46 of file VirtualOutputFile.cpp.
References getOS(), getPath(), llvm::vfs::has_open_proxy, and llvm::make_error().
Error OutputFile::discard | ( | ) |
Discard an output, cleaning up any temporary state.
Errors if clean-up fails.
If it has already been closed, calls report_fatal_error().
Definition at line 74 of file VirtualOutputFile.cpp.
References llvm::vfs::already_closed, getPath(), LLVM_UNLIKELY, llvm::make_error(), and llvm::report_fatal_error().
Referenced by keep().
|
inline |
Discard the output when destroying it if it's still open, sending the result to Handler.
Definition at line 93 of file VirtualOutputFile.h.
References E().
|
inline |
Definition at line 68 of file VirtualOutputFile.h.
References assert(), and isOpen().
Referenced by createProxy(), operator raw_pwrite_stream &(), and operator<<().
|
inline |
Definition at line 61 of file VirtualOutputFile.h.
Referenced by createProxy(), discard(), and keep().
|
inline |
Definition at line 103 of file VirtualOutputFile.h.
Referenced by takeImpl().
|
inline |
Check whether this is a null output file.
Definition at line 116 of file VirtualOutputFile.h.
References llvm::isa().
|
inline |
Check if keep() or discard() has already been called.
Definition at line 64 of file VirtualOutputFile.h.
Referenced by getOS(), and operator bool().
Error OutputFile::keep | ( | ) |
Keep an output.
Errors if this fails.
If it has already been closed, calls report_fatal_error().
If there's an open proxy from createProxy(), calls discard() to clean up temporaries followed by report_fatal_error().
Definition at line 53 of file VirtualOutputFile.cpp.
References llvm::vfs::already_closed, discard(), getPath(), llvm::vfs::has_open_proxy, llvm::joinErrors(), LLVM_UNLIKELY, llvm::make_error(), and llvm::report_fatal_error().
|
inlineexplicit |
Definition at line 66 of file VirtualOutputFile.h.
References isOpen().
|
inline |
Definition at line 72 of file VirtualOutputFile.h.
References getOS().
|
inline |
Definition at line 73 of file VirtualOutputFile.h.
|
inline |
Definition at line 127 of file VirtualOutputFile.h.
References OutputFile().
|
inline |
Take the implementation.
Definition at line 109 of file VirtualOutputFile.h.
References assert(), and hasOpenProxy().