aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Frontend
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/unittests/Frontend
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/unittests/Frontend')
-rw-r--r--clang/unittests/Frontend/FrontendActionTest.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/unittests/Frontend/FrontendActionTest.cpp b/clang/unittests/Frontend/FrontendActionTest.cpp
index 75e1667..a6bb767 100644
--- a/clang/unittests/Frontend/FrontendActionTest.cpp
+++ b/clang/unittests/Frontend/FrontendActionTest.cpp
@@ -18,6 +18,7 @@
#include "clang/Lex/PreprocessorOptions.h"
#include "clang/Sema/Sema.h"
#include "clang/Serialization/InMemoryModuleCache.h"
+#include "clang/Serialization/ModuleCache.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/VirtualFileSystem.h"
@@ -287,10 +288,12 @@ TEST(GeneratePCHFrontendAction, CacheGeneratedPCH) {
// Check whether the PCH was cached.
if (ShouldCache)
EXPECT_EQ(InMemoryModuleCache::Final,
- Compiler.getModuleCache().getPCMState(PCHFilename));
+ Compiler.getModuleCache().getInMemoryModuleCache().getPCMState(
+ PCHFilename));
else
EXPECT_EQ(InMemoryModuleCache::Unknown,
- Compiler.getModuleCache().getPCMState(PCHFilename));
+ Compiler.getModuleCache().getInMemoryModuleCache().getPCMState(
+ PCHFilename));
}
}