[clang-tools-extra] [clangd] Fix prerequisite module stale dependency detection (PR #234181)
SLIMANI Lukas via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 31 07:12:52 PDT 2026
================
@@ -1235,6 +1243,39 @@ void ModulesBuilder::ModulesBuilderImpl::getPrebuiltModuleFile(
}
}
+bool ModulesBuilder::ModulesBuilderImpl::hasNewerDependency(
+ StringRef ModuleName, PathRef PublishedModuleFilePath,
+ PathRef RequiredSource, PathRef ModuleUnitFileName,
+ CachingProjectModules &MDB) {
+ std::vector<std::string> Deps = MDB.getRequiredModules(ModuleUnitFileName);
+ if (Deps.empty())
+ return false;
+
+ llvm::sys::fs::file_status Status;
+ // Without a published module file there is nothing to compare against, so
+ // treat any cached copy as stale.
+ if (llvm::sys::fs::status(PublishedModuleFilePath, Status))
+ return true;
+ const auto ModuleTime = Status.getLastModificationTime();
+
+ return llvm::any_of(Deps, [&](const std::string &Dep) {
+ std::string DepSource = MDB.getSourceForModuleName(Dep, RequiredSource);
----------------
lslimani wrote:
Well from what I've tested the perfs look almost identical without the check and with both versions of it, for the next few days I won't be able to go further but if you think it's really worth investigating we can wait. But in the other case I push the change to `moduleUnitFileName` whenever.
https://github.com/llvm/llvm-project/pull/234181
More information about the cfe-commits
mailing list