@@ -211,10 +211,14 @@ class SwiftSourceModuleDependenciesStorage :
211211 // / Details common to Swift textual (interface or source) modules
212212 CommonSwiftTextualModuleDependencyDetails textualModuleDetails;
213213
214+ // / Collection of module imports that were detected to be `@Testable`
215+ llvm::StringSet<> testableImports;
216+
214217 SwiftSourceModuleDependenciesStorage (
215218 ArrayRef<StringRef> extraPCMArgs
216219 ) : ModuleDependencyInfoStorageBase(ModuleDependencyKind::SwiftSource),
217- textualModuleDetails (extraPCMArgs) {}
220+ textualModuleDetails (extraPCMArgs),
221+ testableImports(llvm::StringSet<>()) {}
218222
219223 ModuleDependencyInfoStorageBase *clone () const override {
220224 return new SwiftSourceModuleDependenciesStorage (*this );
@@ -223,6 +227,10 @@ class SwiftSourceModuleDependenciesStorage :
223227 static bool classof (const ModuleDependencyInfoStorageBase *base) {
224228 return base->dependencyKind == ModuleDependencyKind::SwiftSource;
225229 }
230+
231+ void addTestableImport (ImportPath::Module module ) {
232+ testableImports.insert (module .front ().Item .str ());
233+ }
226234};
227235
228236// / Describes the dependencies of a pre-built Swift module (with no .swiftinterface).
@@ -460,6 +468,13 @@ class ModuleDependencyInfo {
460468 storage->resolved = isResolved;
461469 }
462470
471+ // / For a Source dependency, register a `Testable` import
472+ void addTestableImport (ImportPath::Module module );
473+
474+ // / Whether or not a queried module name is a `@Testable` import dependency
475+ // / of this module. Can only return `true` for Swift source modules.
476+ bool isTestableImport (StringRef moduleName) const ;
477+
463478 // / Whether the dependencies are for a Swift module: either Textual, Source, Binary, or Placeholder.
464479 bool isSwiftModule () const ;
465480
0 commit comments