================
@@ -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);
+ if (DepSource.empty())
+ return false;
+ auto DepCmd = getCDB().getCompileCommand(DepSource);
+ if (!DepCmd)
+ return false;
+ const std::string DepPublishedPath = getPublishedModuleFilePath(
+ Dep, getModuleFilesDirectory(DepSource, *DepCmd, getCDB()));
+ llvm::sys::fs::file_status DepStatus;
+ // Dependencies that clangd didn't publish, like module files from the
+ // build system, are validated by the AST reader instead.
----------------
ArcsinX wrote:
Is it really true? Can you please give a link where this validation happens?
https://github.com/llvm/llvm-project/pull/234181
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits