15#ifndef LLVM_SUPPORT_CACHING_H
16#define LLVM_SUPPORT_CACHING_H
31 std::string OSPath =
"")
33 std::unique_ptr<raw_pwrite_stream>
OS;
41using AddStreamFn = std::function<Expected<std::unique_ptr<CachedFileStream>>(
57using FileCache = std::function<Expected<AddStreamFn>(
64 std::unique_ptr<MemoryBuffer> MB)>;
73 const Twine &CacheNameRef,
const Twine &TempFilePrefixRef,
74 const Twine &CacheDirectoryPathRef,
76 std::unique_ptr<MemoryBuffer> MB) {});
This class wraps an output stream for a file.
CachedFileStream(std::unique_ptr< raw_pwrite_stream > OS, std::string OSPath="")
std::string ObjectPathName
virtual ~CachedFileStream()=default
std::unique_ptr< raw_pwrite_stream > OS
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This is an optimization pass for GlobalISel generic memory operations.
std::function< void(unsigned Task, const Twine &ModuleName, std::unique_ptr< MemoryBuffer > MB)> AddBufferFn
This type defines the callback to add a pre-existing file (e.g.
std::function< Expected< std::unique_ptr< CachedFileStream > >(unsigned Task, const Twine &ModuleName)> AddStreamFn
This type defines the callback to add a file that is generated on the fly.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
std::function< Expected< AddStreamFn >(unsigned Task, StringRef Key, const Twine &ModuleName)> FileCache
This is the type of a file cache.
Expected< FileCache > localCache(const Twine &CacheNameRef, const Twine &TempFilePrefixRef, const Twine &CacheDirectoryPathRef, AddBufferFn AddBuffer=[](size_t Task, const Twine &ModuleName, std::unique_ptr< MemoryBuffer > MB) {})
Create a local file system cache which uses the given cache name, temporary file prefix,...
Implement std::hash so that hash_code can be used in STL containers.