diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2025-05-09 10:32:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-09 10:32:48 -0700 |
commit | 94ae5f9e877be7490687c35ec9883ff9746721d6 (patch) | |
tree | e923f1cb1c6e0d7048f802d8799c4661a13ca608 /clang/lib/Serialization/ModuleManager.cpp | |
parent | a6385a87a2e5537f0790494ebe8bb4c3cc9506b9 (diff) | |
download | llvm-94ae5f9e877be7490687c35ec9883ff9746721d6.zip llvm-94ae5f9e877be7490687c35ec9883ff9746721d6.tar.gz llvm-94ae5f9e877be7490687c35ec9883ff9746721d6.tar.bz2 |
[clang][modules][deps] Implicit modules are out of date when their explicit imports are (#138920)
The dependency scanner mixes implicitly- and explicitly-built modules.
When an implicitly-built module imports an explicitly-built one, we
never run the modification time validation checks, resulting in an
out-of-date module cache. This PR fixes that by only skipping the
modification time validation checks when both the imported module and
its importer are built explicitly.
rdar://150230022
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
-rw-r--r-- | clang/lib/Serialization/ModuleManager.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Serialization/ModuleManager.cpp b/clang/lib/Serialization/ModuleManager.cpp index e3d7ff4..7f3f246 100644 --- a/clang/lib/Serialization/ModuleManager.cpp +++ b/clang/lib/Serialization/ModuleManager.cpp @@ -110,10 +110,12 @@ ModuleManager::addModule(StringRef FileName, ModuleKind Type, // Look for the file entry. This only fails if the expected size or // modification time differ. OptionalFileEntryRef Entry; - const bool IgnoreModTime = - (Type == MK_ExplicitModule || Type == MK_PrebuiltModule); + bool IgnoreModTime = Type == MK_ExplicitModule || Type == MK_PrebuiltModule; + if (ImportedBy) + IgnoreModTime &= ImportedBy->Kind == MK_ExplicitModule || + ImportedBy->Kind == MK_PrebuiltModule; if (IgnoreModTime) { - // If we're not expecting to pull this file out of the module cache, it + // If neither this file nor the importer are in the module cache, this file // might have a different mtime due to being moved across filesystems in // a distributed build. The size must still match, though. (As must the // contents, but we can't check that.) |