Go to the documentation of this file.
21 #if !defined(_MSC_VER) && !defined(__MINGW32__)
30 Twine TempFilePrefixRef,
31 Twine CacheDirectoryPathRef,
37 TempFilePrefixRef.
toVector(TempFilePrefix);
38 CacheDirectoryPathRef.
toVector(CacheDirectoryPath);
73 EntryPath +
": " + EC.message() +
"\n");
82 CacheStream(std::unique_ptr<raw_pwrite_stream> OS,
AddBufferFn AddBuffer,
104 MBOrErr.
getError().message() +
"\n");
117 std::error_code EC =
E.convertToErrorCode();
133 TempFile.
TmpName +
" to " + ObjectPathName +
": " +
140 return [=](
size_t Task) ->
Expected<std::unique_ptr<CachedFileStream>> {
144 CacheDirectoryPath,
true))
150 TempFilePrefix +
"-%%%%%%.tmp.o");
156 ": Can't get a temporary file");
159 return std::make_unique<CacheStream>(
160 std::make_unique<raw_fd_ostream>(Temp->FD,
false),
161 AddBuffer,
std::move(*Temp), std::string(EntryPath.
str()), Task);
This is an optimization pass for GlobalISel generic memory operations.
Error handleErrors(Error E, HandlerTs &&... Hs)
Pass the ErrorInfo(s) contained in E to their respective handlers.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getOpenFile(sys::fs::file_t 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.
This class wraps an output stream for a file.
std::function< Expected< std::unique_ptr< CachedFileStream > >(unsigned Task)> AddStreamFn
This type defines the callback to add a file that is generated on the fly.
std::function< void(unsigned Task, std::unique_ptr< MemoryBuffer > MB)> AddBufferFn
This type defines the callback to add a pre-existing file (e.g.
static ErrorSuccess success()
Create a success value.
@ no_such_file_or_directory
Tagged union holding either a T or a Error.
This class wraps a std::error_code in a Error.
void consumeError(Error Err)
Consume a Error without doing anything.
void append(SmallVectorImpl< char > &path, const Twine &a, const Twine &b="", const Twine &c="", const Twine &d="")
Append to path.
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.
std::error_code getError() const
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.
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Error keep(const Twine &Name)
Expected< file_t > openNativeFileForRead(const Twine &Name, 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.
Expected< FileCache > localCache(Twine CacheNameRef, Twine TempFilePrefixRef, Twine CacheDirectoryPathRef, AddBufferFn AddBuffer=[](size_t Task, std::unique_ptr< MemoryBuffer > MB) { })
Create a local file system cache which uses the given cache name, temporary file prefix,...
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
std::error_code closeFile(file_t &F)
Close the file object.
StringRef - Represent a constant reference to a string, i.e.
@ OF_UpdateAtime
Force files Atime to be updated on access.
file_t convertFDToNativeFile(int FD)
Converts from a Posix file descriptor number to a native file handle.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
const char * toString(DWARFSectionKind Kind)
Lightweight error class with error context and mandatory checking.
StringRef str() const
Explicit conversion to StringRef.
std::error_code errorToErrorCode(Error Err)
Helper for converting an ECError to a std::error_code.
Error takeError()
Take ownership of the stored error.
Represents either an error or a value T.
Represents a temporary file.
static Expected< TempFile > create(const Twine &Model, unsigned Mode=all_read|all_write, OpenFlags ExtraFlags=OF_None)
This creates a temporary file with createUniqueFile and schedules it for deletion with sys::RemoveFil...
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.