aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorJan Svoboda <jan_svoboda@apple.com>2025-05-19 12:52:56 -0700
committerJan Svoboda <jan_svoboda@apple.com>2025-05-19 12:57:54 -0700
commit72b2219b3e2319e29831e4e9b07c440444f3add6 (patch)
tree642d37b95354df419c9e19630c583a5ce268849b /clang/lib/Frontend
parent10d198b32cd0b6aaeeaf1a6217611797c01f47f7 (diff)
downloadllvm-72b2219b3e2319e29831e4e9b07c440444f3add6.zip
llvm-72b2219b3e2319e29831e4e9b07c440444f3add6.tar.gz
llvm-72b2219b3e2319e29831e4e9b07c440444f3add6.tar.bz2
Revert "[clang][modules] Timestamp-less validation API (#139987)"
This reverts commit 7a242387c950c7060143da6da0e6fb91f36bb458. Even after 175f8a44, the Modules/fmodules-validate-once-per-build-session.c test is not fixed on the clang-armv8-quick build bot. (Failure occurs on line 114.)
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp12
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp4
2 files changed, 5 insertions, 11 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 57681b2..5a79fe0 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -829,10 +829,9 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromASTFile(
AST->SourceMgr = new SourceManager(AST->getDiagnostics(),
AST->getFileManager(),
UserFilesAreVolatile);
+ AST->ModCache = createCrossProcessModuleCache();
AST->HSOpts = std::make_unique<HeaderSearchOptions>(HSOpts);
AST->HSOpts->ModuleFormat = std::string(PCHContainerRdr.getFormats().front());
- AST->ModCache =
- createCrossProcessModuleCache(AST->HSOpts->BuildSessionTimestamp);
AST->HeaderInfo.reset(new HeaderSearch(AST->getHeaderSearchOpts(),
AST->getSourceManager(),
AST->getDiagnostics(),
@@ -1549,8 +1548,7 @@ ASTUnit::create(std::shared_ptr<CompilerInvocation> CI,
AST->UserFilesAreVolatile = UserFilesAreVolatile;
AST->SourceMgr = new SourceManager(AST->getDiagnostics(), *AST->FileMgr,
UserFilesAreVolatile);
- AST->ModCache = createCrossProcessModuleCache(
- AST->Invocation->getHeaderSearchOpts().BuildSessionTimestamp);
+ AST->ModCache = createCrossProcessModuleCache();
return AST;
}
@@ -1747,8 +1745,6 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromCompilerInvocation(
AST->IncludeBriefCommentsInCodeCompletion
= IncludeBriefCommentsInCodeCompletion;
AST->Invocation = std::move(CI);
- AST->ModCache = createCrossProcessModuleCache(
- AST->Invocation->getHeaderSearchOpts().BuildSessionTimestamp);
AST->FileSystemOpts = FileMgr->getFileSystemOpts();
AST->FileMgr = FileMgr;
AST->UserFilesAreVolatile = UserFilesAreVolatile;
@@ -1838,6 +1834,7 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromCommandLine(
AST->FileMgr = new FileManager(AST->FileSystemOpts, VFS);
AST->StorePreamblesInMemory = StorePreamblesInMemory;
AST->PreambleStoragePath = PreambleStoragePath;
+ AST->ModCache = createCrossProcessModuleCache();
AST->OnlyLocalDecls = OnlyLocalDecls;
AST->CaptureDiagnostics = CaptureDiagnostics;
AST->TUKind = TUKind;
@@ -1846,8 +1843,6 @@ std::unique_ptr<ASTUnit> ASTUnit::LoadFromCommandLine(
= IncludeBriefCommentsInCodeCompletion;
AST->UserFilesAreVolatile = UserFilesAreVolatile;
AST->Invocation = CI;
- AST->ModCache = createCrossProcessModuleCache(
- AST->Invocation->getHeaderSearchOpts().BuildSessionTimestamp);
AST->SkipFunctionBodies = SkipFunctionBodies;
if (ForSerialization)
AST->WriterData.reset(new ASTWriterData(*AST->ModCache));
@@ -2383,6 +2378,7 @@ bool ASTUnit::serialize(raw_ostream &OS) {
SmallString<128> Buffer;
llvm::BitstreamWriter Stream(Buffer);
+ IntrusiveRefCntPtr<ModuleCache> ModCache = createCrossProcessModuleCache();
ASTWriter Writer(Stream, Buffer, *ModCache, {});
return serializeUnit(Writer, Buffer, getSema(), OS);
}
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index b3a23e6..503d364 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -72,9 +72,7 @@ CompilerInstance::CompilerInstance(
ModuleCache *ModCache)
: ModuleLoader(/*BuildingModule=*/ModCache),
Invocation(std::move(Invocation)),
- ModCache(ModCache ? ModCache
- : createCrossProcessModuleCache(
- getHeaderSearchOpts().BuildSessionTimestamp)),
+ ModCache(ModCache ? ModCache : createCrossProcessModuleCache()),
ThePCHContainerOperations(std::move(PCHContainerOps)) {
assert(this->Invocation && "Invocation must not be null");
}