mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ModuleInterfaces] Clear dependencies before checking a different module
Sometimes, if one module we tried failed, we would leave the dependencies from the previous check and fail a different module which would have succeeded. This manifested as the prebuilt-module-cache-forwarding test testing the wrong thing, because it retained a mod-time based dependency in the prebuilt cache, which should have been hash based, and used it.
This commit is contained in:
@@ -913,7 +913,12 @@ class ParseableInterfaceModuleLoaderImpl {
|
||||
bool serializedASTBufferIsUpToDate(
|
||||
StringRef path, const llvm::MemoryBuffer &buf,
|
||||
SmallVectorImpl<FileDependency> &allDeps) {
|
||||
LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << modulePath << "\n");
|
||||
|
||||
// Clear the existing dependencies, because we're going to re-fill them
|
||||
// in validateSerializedAST.
|
||||
allDeps.clear();
|
||||
|
||||
LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << path << "\n");
|
||||
auto validationInfo = serialization::validateSerializedAST(
|
||||
buf.getBuffer(), /*ExtendedValidationInfo=*/nullptr, &allDeps);
|
||||
|
||||
@@ -944,6 +949,13 @@ class ParseableInterfaceModuleLoaderImpl {
|
||||
StringRef path, const ForwardingModule &fwd,
|
||||
SmallVectorImpl<FileDependency> &deps,
|
||||
std::unique_ptr<llvm::MemoryBuffer> &moduleBuffer) {
|
||||
|
||||
// Clear the existing dependencies, because we're going to re-fill them
|
||||
// from the forwarding module.
|
||||
deps.clear();
|
||||
|
||||
LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << path << "\n");
|
||||
|
||||
// First, make sure the underlying module path exists and is valid.
|
||||
auto modBuf = fs.getBufferForFile(fwd.underlyingModulePath);
|
||||
if (!modBuf || !serializedASTLooksValid(*modBuf.get()))
|
||||
|
||||
Reference in New Issue
Block a user