[ParseableInterface] Don't report out-of-date dependencies to the parent dependency tracker

We previously added dependencies to the tracker inline while validating a cached
module's dependencies were up to date. If one of its dependencies ended up being
out of date though, we shouldn't have added the previous dependencies, as that
means the dependency list itself was also out of date.

This patch changes the behavior to only add the module's dependencies once we've
verified they're all up to date.
This commit is contained in:
Nathan Hawes
2019-04-02 16:16:15 -07:00
parent 58d622d796
commit 7144dab15a
2 changed files with 41 additions and 5 deletions

View File

@@ -726,8 +726,6 @@ class ParseableInterfaceModuleLoaderImpl {
SmallString<128> SDKRelativeBuffer;
for (auto &in : deps) {
StringRef fullPath = getFullDependencyPath(in, SDKRelativeBuffer);
if (dependencyTracker)
dependencyTracker->addDependency(fullPath, /*isSystem*/in.isSDKRelative());
if (!dependencyIsUpToDate(in, fullPath)) {
LLVM_DEBUG(llvm::dbgs() << "Dep " << fullPath
<< " is directly out of date\n");
@@ -950,7 +948,9 @@ class ParseableInterfaceModuleLoaderImpl {
}
/// Looks up the best module to load for a given interface, and returns a
/// buffer of the module's contents. See the main comment in
/// buffer of the module's contents. Also reports the module's dependencies
/// to the parent \c dependencyTracker if it came from the cache, or was built
/// from the given interface. See the main comment in
/// \c ParseableInterfaceModuleLoader.h for an explanation of the module
/// loading strategy.
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
@@ -998,6 +998,15 @@ class ParseableInterfaceModuleLoaderImpl {
if (writeForwardingModule(module, cachedOutputPath, allDeps))
return std::make_error_code(std::errc::not_supported);
// Report the module's dependencies to the dependencyTracker
if (dependencyTracker) {
SmallString<128> SDKRelativeBuffer;
for (auto &dep: allDeps) {
StringRef fullPath = getFullDependencyPath(dep, SDKRelativeBuffer);
dependencyTracker->addDependency(fullPath, dep.isSDKRelative());
}
}
return std::move(module.moduleBuffer);
}