diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:01:22 +0000 |
commit | 71d5a2540a98c81f5bcaeb48805e0e2881f530ef (patch) | |
tree | 5343938942df402b49ec7300a1c25a2d4ccd5821 /include/llvm/LTO/Caching.h | |
parent | 31bbf64f3a4974a2d6c8b3b27ad2f519caf74057 (diff) |
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 |