Skip to content

Commit 5abcc24

Browse files
committed
Move the code to update timestamp later to avoid updating timestamp before the pcm is committed to disk.
1 parent c7bb105 commit 5abcc24

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,14 @@ static bool compileModuleAndReadASTImpl(CompilerInstance &ImportingInstance,
14801480
return false;
14811481
}
14821482

1483+
// The module is built successfully, we can update its timestamp now.
1484+
if (ImportingInstance.getPreprocessor()
1485+
.getHeaderSearchInfo()
1486+
.getHeaderSearchOpts()
1487+
.ModulesValidateOncePerBuildSession) {
1488+
ImportingInstance.getModuleCache().updateModuleTimestamp(ModuleFileName);
1489+
}
1490+
14831491
return readASTAfterCompileModule(ImportingInstance, ImportLoc, ModuleNameLoc,
14841492
Module, ModuleFileName,
14851493
/*OutOfDate=*/nullptr, /*Missing=*/nullptr);

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5461,11 +5461,6 @@ ASTWriter::WriteAST(llvm::PointerUnion<Sema *, Preprocessor *> Subject,
54615461

54625462
WritingAST = false;
54635463

5464-
if (WritingModule && PPRef.getHeaderSearchInfo()
5465-
.getHeaderSearchOpts()
5466-
.ModulesValidateOncePerBuildSession)
5467-
ModCache.updateModuleTimestamp(OutputFile);
5468-
54695464
if (ShouldCacheASTInMemory) {
54705465
// Construct MemoryBuffer and update buffer manager.
54715466
ModCache.getInMemoryModuleCache().addBuiltPCM(

0 commit comments

Comments
 (0)