1 //===- Caching.h - LLVM Link Time Optimizer Configuration -----------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the localCache function, which allows clients to add a
11 // filesystem cache to ThinLTO.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_LTO_CACHING_H
16 #define LLVM_LTO_CACHING_H
18 #include "llvm/LTO/LTO.h"
24 /// This type defines the callback to add a pre-existing native object file
25 /// (e.g. in a cache).
27 /// MB->getBufferIdentifier() is a valid path for the file at the time that it
28 /// was opened, but clients should prefer to access MB directly in order to
29 /// avoid a potential race condition.
31 /// Buffer callbacks must be thread safe.
32 typedef std::function<void(unsigned Task, std::unique_ptr<MemoryBuffer> MB)>
35 /// Create a local file system cache which uses the given cache directory and
36 /// file callback. This function also creates the cache directory if it does not
38 Expected<NativeObjectCache> localCache(StringRef CacheDirectoryPath,
39 AddBufferFn AddBuffer);