22 #if !defined(_MSC_VER) && !defined(__MINGW32__) 53 AddBuffer(Task, std::move(*MBOrErr));
67 ": " + EC.message() +
"\n");
74 std::string EntryPath;
77 CacheStream(std::unique_ptr<raw_pwrite_stream> OS,
AddBufferFn AddBuffer,
81 TempFile(std::move(TempFile)), EntryPath(std::move(EntryPath)),
96 MBOrErr.
getError().message() +
"\n");
115 MBOrErr = std::move(MBCopy);
125 TempFile.
TmpName +
" to " + EntryPath +
": " +
128 AddBuffer(Task, std::move(*MBOrErr));
132 return [=](
size_t Task) -> std::unique_ptr<NativeObjectStream> {
144 return llvm::make_unique<CacheStream>(
145 llvm::make_unique<raw_fd_ostream>(Temp->FD,
false),
146 AddBuffer, std::move(*Temp), EntryPath.
str(), Task);
std::error_code create_directories(const Twine &path, bool IgnoreExisting=true, perms Perms=owner_all|group_all)
Create all the non-existent directories in path.
Represents either an error or a value T.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
This class represents lattice values for constants.
std::error_code openFileForRead(const Twine &Name, int &ResultFD, OpenFlags Flags=OF_None, SmallVectorImpl< char > *RealPath=nullptr)
Opens the file with the given name in a read-only mode, returning its open file descriptor.
std::function< void(unsigned Task, std::unique_ptr< MemoryBuffer > MB)> AddBufferFn
This type defines the callback to add a pre-existing native object file (e.g.
Error takeError()
Take ownership of the stored error.
static Expected< TempFile > create(const Twine &Model, unsigned Mode=all_read|all_write)
This creates a temporary file with createUniqueFile and schedules it for deletion with sys::RemoveFil...
Error keep(const Twine &Name)
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
std::function< std::unique_ptr< NativeObjectStream >unsigned Task)> AddStreamFn
This type defines the callback to add a native object that is generated on the fly.
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
std::string toString(Error E)
Write all error messages (if any) in E to a string.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Represents a temporary file.
Tagged union holding either a T or a Error.
StringRef str() const
Explicit conversion to StringRef.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
This class wraps an output stream for a native object.
Expected< NativeObjectCache > localCache(StringRef CacheDirectoryPath, AddBufferFn AddBuffer)
Create a local file system cache which uses the given cache directory and file callback.
std::error_code getError() const
void consumeError(Error Err)
Consume a Error without doing anything.
Force files Atime to be updated on access. Only makes a difference on windows.
static ErrorSuccess success()
Create a success value.
static std::unique_ptr< MemoryBuffer > getMemBufferCopy(StringRef InputData, const Twine &BufferName="")
Open the specified memory range as a MemoryBuffer, copying the contents and taking ownership of it...
Provides a library for accessing information about this process and other processes on the operating ...
Lightweight error class with error context and mandatory checking.
Error handleErrors(Error E, HandlerTs &&... Hs)
Pass the ErrorInfo(s) contained in E to their respective handlers.
This class wraps a std::error_code in a Error.
StringRef - Represent a constant reference to a string, i.e.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getOpenFile(int FD, const Twine &Filename, uint64_t FileSize, bool RequiresNullTerminator=true, bool IsVolatile=false)
Given an already-open file descriptor, read the file and return a MemoryBuffer.