@@ -22,23 +22,35 @@ namespace swift {
22
22
// / for the purpose of determining dependencies, but does not attempt to
23
23
// / load the module files.
24
24
class SwiftModuleScanner : public SerializedModuleLoaderBase {
25
- public:
26
- enum ScannerKind { MDS_plain, MDS_placeholder };
27
-
28
25
private:
29
- // / The kind of scanner this is (LLVM-style RTTI)
30
- const ScannerKind kind;
31
-
32
- // / The module we're scanning dependencies of.
33
- Identifier moduleName;
34
-
35
26
// / Scan the given interface file to determine dependencies.
36
27
llvm::ErrorOr<ModuleDependencyInfo>
37
- scanInterfaceFile (Twine moduleInterfacePath, bool isFramework ,
38
- bool isTestableImport);
28
+ scanInterfaceFile (Identifier moduleID, Twine moduleInterfacePath ,
29
+ bool isFramework, bool isTestableImport);
39
30
40
- InterfaceSubContextDelegate &astDelegate;
31
+ // / Scan the given serialized module file to determine dependencies.
32
+ llvm::ErrorOr<ModuleDependencyInfo>
33
+ scanBinaryModuleFile (Identifier moduleID, Twine binaryModulePath,
34
+ bool isFramework, bool isTestableImport,
35
+ bool isCandidateForTextualModule);
36
+
37
+ std::error_code findModuleFilesInDirectory (
38
+ ImportPath::Element ModuleID, const SerializedModuleBaseName &BaseName,
39
+ SmallVectorImpl<char > *ModuleInterfacePath,
40
+ SmallVectorImpl<char > *ModuleInterfaceSourcePath,
41
+ std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
42
+ std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
43
+ std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
44
+ bool SkipBuildingInterface, bool IsFramework,
45
+ bool IsTestableDependencyLookup) override ;
46
+
47
+ virtual void collectVisibleTopLevelModuleNames (
48
+ SmallVectorImpl<Identifier> &names) const override {
49
+ llvm_unreachable (" Not used" );
50
+ }
41
51
52
+ // / AST delegate to be used for textual interface scanning
53
+ InterfaceSubContextDelegate &astDelegate;
42
54
// / Location where pre-built modules are to be built into.
43
55
std::string moduleOutputPath;
44
56
// / Location where pre-built SDK modules are to be built into.
@@ -51,37 +63,19 @@ class SwiftModuleScanner : public SerializedModuleLoaderBase {
51
63
std::optional<ModuleDependencyInfo> dependencies;
52
64
53
65
SwiftModuleScanner (ASTContext &ctx, ModuleLoadingMode LoadMode,
54
- Identifier moduleName,
55
66
InterfaceSubContextDelegate &astDelegate,
56
67
StringRef moduleOutputPath, StringRef sdkModuleOutputPath,
57
- std::vector<std::string> swiftModuleClangCC1CommandLineArgs,
58
- ScannerKind kind = MDS_plain)
68
+ std::vector<std::string> swiftModuleClangCC1CommandLineArgs)
59
69
: SerializedModuleLoaderBase(ctx, nullptr , LoadMode,
60
70
/* IgnoreSwiftSourceInfoFile=*/ true ),
61
- kind (kind), moduleName(moduleName), astDelegate(astDelegate),
71
+ astDelegate (astDelegate),
62
72
moduleOutputPath(moduleOutputPath),
63
73
sdkModuleOutputPath(sdkModuleOutputPath),
64
74
swiftModuleClangCC1CommandLineArgs(swiftModuleClangCC1CommandLineArgs) {}
65
75
66
- std::error_code findModuleFilesInDirectory (
67
- ImportPath::Element ModuleID, const SerializedModuleBaseName &BaseName,
68
- SmallVectorImpl<char > *ModuleInterfacePath,
69
- SmallVectorImpl<char > *ModuleInterfaceSourcePath,
70
- std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
71
- std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
72
- std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
73
- bool SkipBuildingInterface, bool IsFramework,
74
- bool IsTestableDependencyLookup) override ;
75
-
76
- virtual void collectVisibleTopLevelModuleNames (
77
- SmallVectorImpl<Identifier> &names) const override {
78
- llvm_unreachable (" Not used" );
79
- }
80
-
81
- ScannerKind getKind () const { return kind; }
82
- static bool classof (const SwiftModuleScanner *MDS) {
83
- return MDS->getKind () == MDS_plain;
84
- }
76
+ // / Perform a filesystem search for a Swift module with a given name
77
+ llvm::SmallVector<std::pair<ModuleDependencyID, ModuleDependencyInfo>, 1 >
78
+ lookupSwiftModule (Identifier moduleName, bool isTestableImport);
85
79
};
86
80
} // namespace swift
87
81
0 commit comments