17#ifndef LLVM_SUPPORT_VIRTUALOUTPUTFILE_H
18#define LLVM_SUPPORT_VIRTUALOUTPUTFILE_H
30 void anchor()
override;
42 :
public RTTIExtends<NullOutputFileImpl, OutputFileImpl> {
43 void anchor()
override;
74 return getOS() << std::forward<T>(V);
94 DiscardOnDestroyHandler = std::move(Handler);
111 assert(!DiscardOnDestroyHandler &&
"Unexpected discard handler");
112 return std::move(Impl);
121 : Path(Path.str()), Impl(
std::
move(Impl)) {
122 assert(this->Impl &&
"Expected open output file");
137 Path = std::move(O.Path);
138 Impl = std::move(O.Impl);
139 DiscardOnDestroyHandler = std::move(O.DiscardOnDestroyHandler);
140 OpenProxy = O.OpenProxy;
141 O.OpenProxy =
nullptr;
146 std::unique_ptr<OutputFileImpl> Impl;
150 TrackedProxy *OpenProxy =
nullptr;
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Inheritance utility for extensible RTTI.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
A raw_ostream that discards all output.
This class implements an extremely fast bulk output stream that can only output to a stream.
An abstract base class for streams implementations that also support a pwrite operation.
unique_function is a type-erasing functor similar to std::function.
raw_pwrite_stream & getOS() final
virtual raw_pwrite_stream & getOS()=0
virtual Error discard()=0
virtual ~OutputFileImpl()=default
A virtualized output file that writes to a specific backend.
bool isOpen() const
Check if keep() or discard() has already been called.
void discardOnDestroy(unique_function< void(Error E)> Handler)
Discard the output when destroying it if it's still open, sending the result to Handler.
StringRef getPath() const
raw_ostream & operator<<(T &&V)
raw_pwrite_stream & getOS()
std::unique_ptr< OutputFileImpl > takeImpl()
Take the implementation.
bool isNull() const
Check whether this is a null output file.
OutputFile(const Twine &Path, std::unique_ptr< OutputFileImpl > Impl)
Expected< std::unique_ptr< raw_pwrite_stream > > createProxy()
Create a proxy stream for clients that need to pass an owned stream to a producer.
OutputFile & operator=(OutputFile &&O)
bool hasOpenProxy() const
Error discard()
Discard an output, cleaning up any temporary state.
Error keep()
Keep an output.
OutputFile(OutputFile &&O)
void consumeDiscardOnDestroy(OutputFile &File)
Update File to silently discard itself if it's still open when it's destroyed.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void consumeError(Error Err)
Consume a Error without doing anything.
Implement std::hash so that hash_code can be used in STL containers.