1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_INPROCESSMODULECACHE_H 10 #define LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_INPROCESSMODULECACHE_H 11 12 #include "clang/Serialization/ModuleCache.h" 13 #include "llvm/ADT/StringMap.h" 14 15 #include <mutex> 16 #include <shared_mutex> 17 18 namespace clang { 19 namespace tooling { 20 namespace dependencies { 21 struct ModuleCacheEntry { 22 std::shared_mutex CompilationMutex; 23 std::atomic<std::time_t> Timestamp = 0; 24 }; 25 26 struct ModuleCacheEntries { 27 std::mutex Mutex; 28 llvm::StringMap<std::unique_ptr<ModuleCacheEntry>> Map; 29 }; 30 31 IntrusiveRefCntPtr<ModuleCache> 32 makeInProcessModuleCache(ModuleCacheEntries &Entries); 33 } // namespace dependencies 34 } // namespace tooling 35 } // namespace clang 36 37 #endif 38