18 #include <system_error>
20 #if !defined(_MSC_VER) && !defined(__MINGW32__)
29 FileOutputBuffer::FileOutputBuffer(std::unique_ptr<mapped_file_region> R,
30 StringRef Path, StringRef TmpPath)
31 :
Region(std::move(R)), FinalPath(Path), TempPath(TmpPath) {}
39 std::unique_ptr<FileOutputBuffer> &Result,
44 switch (Stat.
type()) {
90 auto MappedFile = llvm::make_unique<mapped_file_region>(
91 FD, mapped_file_region::readwrite, Size, 0, EC);
96 return std::error_code(errno, std::generic_category());
101 return std::error_code();
std::error_code createUniqueFile(const Twine &Model, int &ResultFD, SmallVectorImpl< char > &ResultPath, unsigned Mode=all_read|all_write)
Create a uniquely named file.
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
This class represents a memory mapped file.
file_status - Represents the result of a call to stat and friends.
~FileOutputBuffer()
If this object was previously committed, the destructor just deletes this object. ...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
FileOutputBuffer - This interface provides simple way to create an in-memory buffer which will be wri...
std::error_code make_error_code(BitcodeError E)
std::error_code commit()
Flushes the content of the buffer to its file and deallocates the buffer.
static std::error_code create(StringRef FilePath, size_t Size, std::unique_ptr< FileOutputBuffer > &Result, unsigned Flags=0)
Factory method to create an OutputBuffer object which manages a read/write buffer of the specified si...
std::error_code resize_file(int FD, uint64_t Size)
Resize path to size.
std::error_code rename(const Twine &from, const Twine &to)
Rename from to to.
StringRef - Represent a constant reference to a string, i.e.
std::error_code status(const Twine &path, file_status &result)
Get file status as if by POSIX stat().