13#ifndef LLVM_SUPPORT_FILEOUTPUTBUFFER_H
14#define LLVM_SUPPORT_FILEOUTPUTBUFFER_H
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
FileOutputBuffer - This interface provides simple way to create an in-memory buffer which will be wri...
virtual uint8_t * getBufferStart() const =0
Returns a pointer to the start of the buffer.
static Expected< std::unique_ptr< FileOutputBuffer > > create(StringRef FilePath, size_t Size, unsigned Flags=0)
Factory method to create an OutputBuffer object which manages a read/write buffer of the specified si...
virtual ~FileOutputBuffer()=default
If this object was previously committed, the destructor just deletes this object.
StringRef getPath() const
Returns path where file will show up if buffer is committed.
@ F_no_mmap
Don't use mmap and instead write an in-memory buffer to a file when this buffer is closed.
@ F_executable
Set the 'x' bit on the resulting file.
FileOutputBuffer(StringRef Path)
virtual uint8_t * getBufferEnd() const =0
Returns a pointer to the end of the buffer.
virtual Error commit()=0
Flushes the content of the buffer to its file and deallocates the buffer.
virtual size_t getBufferSize() const =0
Returns size of the buffer.
virtual void discard()
This removes the temporary file (unless it already was committed) but keeps the memory mapping alive.
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.