blob: 7201ab31f5b08a10aa45eeed5afd012f6eb1d36b [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===- Caching.h - LLVM Link Time Optimizer Configuration -----------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the localCache function, which allows clients to add a
11// filesystem cache to ThinLTO.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LTO_CACHING_H
16#define LLVM_LTO_CACHING_H
17
18#include "llvm/LTO/LTO.h"
19#include <string>
20
21namespace llvm {
22namespace lto {
23
24/// This type defines the callback to add a pre-existing native object file
25/// (e.g. in a cache).
26///
27/// Buffer callbacks must be thread safe.
28typedef std::function<void(unsigned Task, std::unique_ptr<MemoryBuffer> MB)>
29 AddBufferFn;
30
31/// Create a local file system cache which uses the given cache directory and
32/// file callback. This function also creates the cache directory if it does not
33/// already exist.
34Expected<NativeObjectCache> localCache(StringRef CacheDirectoryPath,
35 AddBufferFn AddBuffer);
36
37} // namespace lto
38} // namespace llvm
39
40#endif