Parser: teach canImport to take an additional parameter indicating the minimum module version

canImport should be able to take an additional parameter labeled by either version or
underlyingVersion. We need underlyingVersion for clang modules with Swift overlays because they
have separate version numbers. The library users are usually interested in checking the importability
of the underlying clang module instead of its Swift overlay.

Part of rdar://73992299
This commit is contained in:
Xi Ge
2021-05-01 23:51:26 -07:00
parent d38b23346f
commit bbe5b83de9
15 changed files with 145 additions and 28 deletions

View File

@@ -1629,7 +1629,7 @@ std::error_code ExplicitSwiftModuleLoader::findModuleFilesInDirectory(
}
bool ExplicitSwiftModuleLoader::canImportModule(
ImportPath::Element mID) {
ImportPath::Element mID, llvm::VersionTuple version, bool underlyingVersion) {
StringRef moduleName = mID.Item.str();
auto it = Impl.ExplicitModuleMap.find(moduleName);
// If no provided explicit module matches the name, then it cannot be imported.