aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/GeneratePCH.cpp
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2025-03-14 11:32:39 -0700
committerGitHub <noreply@github.com>2025-03-14 11:32:39 -0700
commitc84d8e8f1c406ab34d56efd4a9f8c5fbce70af2d (patch)
tree869fe558fc328f610628c697c2006a91f7581ec1 /clang/lib/Serialization/GeneratePCH.cpp
parentd0a0de50f7dc6f116863ea9e8ca11efc2dc9f71e (diff)
downloadllvm-c84d8e8f1c406ab34d56efd4a9f8c5fbce70af2d.zip
llvm-c84d8e8f1c406ab34d56efd4a9f8c5fbce70af2d.tar.gz
llvm-c84d8e8f1c406ab34d56efd4a9f8c5fbce70af2d.tar.bz2
[clang][modules] Introduce new `ModuleCache` interface (#131193)
This PR adds new `ModuleCache` interface to Clang's implicitly-built modules machinery. The main motivation for this change is to create a second implementation that uses a more efficient kind of `llvm::AdvisoryLock` during dependency scanning. In addition to the lock abstraction, the `ModuleCache` interface also manages the existing `InMemoryModuleCache` instance. I found that compared to keeping these separate/independent, the code is a bit simpler now, since these are two tightly coupled concepts. I can envision a more efficient implementation of the `InMemoryModuleCache` for the single-process case too, which will be much easier to implement with the current setup. This is not intended to be a functional change.
Diffstat (limited to 'clang/lib/Serialization/GeneratePCH.cpp')
-rw-r--r--clang/lib/Serialization/GeneratePCH.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Serialization/GeneratePCH.cpp b/clang/lib/Serialization/GeneratePCH.cpp
index 12751be..46ab1be 100644
--- a/clang/lib/Serialization/GeneratePCH.cpp
+++ b/clang/lib/Serialization/GeneratePCH.cpp
@@ -23,7 +23,7 @@
using namespace clang;
PCHGenerator::PCHGenerator(
- Preprocessor &PP, InMemoryModuleCache &ModuleCache, StringRef OutputFile,
+ Preprocessor &PP, ModuleCache &ModCache, StringRef OutputFile,
StringRef isysroot, std::shared_ptr<PCHBuffer> Buffer,
ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
bool AllowASTWithErrors, bool IncludeTimestamps,
@@ -31,7 +31,7 @@ PCHGenerator::PCHGenerator(
bool GeneratingReducedBMI)
: PP(PP), Subject(&PP), OutputFile(OutputFile), isysroot(isysroot.str()),
Buffer(std::move(Buffer)), Stream(this->Buffer->Data),
- Writer(Stream, this->Buffer->Data, ModuleCache, Extensions,
+ Writer(Stream, this->Buffer->Data, ModCache, Extensions,
IncludeTimestamps, BuildingImplicitModule, GeneratingReducedBMI),
AllowASTWithErrors(AllowASTWithErrors),
ShouldCacheASTInMemory(ShouldCacheASTInMemory) {
@@ -100,12 +100,12 @@ ASTDeserializationListener *PCHGenerator::GetASTDeserializationListener() {
void PCHGenerator::anchor() {}
CXX20ModulesGenerator::CXX20ModulesGenerator(Preprocessor &PP,
- InMemoryModuleCache &ModuleCache,
+ ModuleCache &ModCache,
StringRef OutputFile,
bool GeneratingReducedBMI,
bool AllowASTWithErrors)
: PCHGenerator(
- PP, ModuleCache, OutputFile, llvm::StringRef(),
+ PP, ModCache, OutputFile, llvm::StringRef(),
std::make_shared<PCHBuffer>(),
/*Extensions=*/ArrayRef<std::shared_ptr<ModuleFileExtension>>(),
AllowASTWithErrors, /*IncludeTimestamps=*/false,