//===-Caching.cpp - LLVM Local File Cache ---------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements the localCache function, which simplifies creating, // adding to, and querying a local file system cache. localCache takes care of // periodically pruning older files from the cache using a CachePruningPolicy. // //===----------------------------------------------------------------------===// #include "llvm/Support/Caching.h" #include "llvm/Support/Errc.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Path.h" #if !defined(_MSC_VER) && !defined(__MINGW32__) #include <unistd.h> #else #include <io.h> #endif usingnamespacellvm; Expected<FileCache> llvm::localCache(const Twine &CacheNameRef, const Twine &TempFilePrefixRef, const Twine &CacheDirectoryPathRef, AddBufferFn AddBuffer) { … }