diff options
Diffstat (limited to 'include/llvm/LTO/Caching.h')
-rw-r--r-- | include/llvm/LTO/Caching.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/LTO/Caching.h b/include/llvm/LTO/Caching.h index 3b96bd1dc301..f5ec70e081c1 100644 --- a/include/llvm/LTO/Caching.h +++ b/include/llvm/LTO/Caching.h @@ -24,12 +24,19 @@ namespace lto { /// This type defines the callback to add a pre-existing native object file /// (e.g. in a cache). /// -/// File callbacks must be thread safe. -typedef std::function<void(unsigned Task, StringRef Path)> AddFileFn; +/// MB->getBufferIdentifier() is a valid path for the file at the time that it +/// was opened, but clients should prefer to access MB directly in order to +/// avoid a potential race condition. +/// +/// Buffer callbacks must be thread safe. +typedef std::function<void(unsigned Task, std::unique_ptr<MemoryBuffer> MB)> + AddBufferFn; /// Create a local file system cache which uses the given cache directory and -/// file callback. -NativeObjectCache localCache(std::string CacheDirectoryPath, AddFileFn AddFile); +/// file callback. This function also creates the cache directory if it does not +/// already exist. +Expected<NativeObjectCache> localCache(StringRef CacheDirectoryPath, + AddBufferFn AddBuffer); } // namespace lto } // namespace llvm |