[ScanDependencies] Do not count optional dependencies when not needed

If a testable module is loaded from a non-testable import, ignore its
optional dependencies because the consumer should not use them. This
matches the behavior of the implicit build or the behavior how
forwarding module is created.
This commit is contained in:
Steven Wu
2024-04-17 12:08:55 -07:00
parent 53ad5de6db
commit 77fefe9a75
3 changed files with 15 additions and 20 deletions

View File

@@ -174,7 +174,7 @@ protected:
static BinaryModuleImports
getImportsOfModule(const ModuleFileSharedCore &loadedModule,
ModuleLoadingBehavior transitiveBehavior,
StringRef packageName);
StringRef packageName, bool isTestableImport);
/// Load the module file into a buffer and also collect its module name.
static std::unique_ptr<llvm::MemoryBuffer>