================
@@ -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:
You're right that my previous answer was honestly pretty vague. To understand
why we use requiredSource, we have to understand what the check is actually
for. Yes it is moduleUnitFileName that import dep, but as required module
depends on moduleUnitFileName it is also dependent on these deps, and here we
are checking from the required module whether a module from which it is
dependent, are it's dependencies up to date. If we take them directly from
moduleUnitFileName we change perspective, it may work but this is not the aim
of the check, we want to propagate changes from non direct dependent modules.
https://github.com/llvm/llvm-project/pull/234181
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits