mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
ModuleInterface: sanitize long version numbers when collecting user versions from textual interface files
Some Swift module versions are beyond the scope of llvm::VersionTuple(), thus we need to sanitize the most trivial bits so that we can handle most cases in versioned canImport query.
This commit is contained in:
@@ -1067,6 +1067,10 @@ swift::extractUserModuleVersionFromInterface(StringRef moduleInterfacePath) {
|
||||
// Check the version number specified via -user-module-version.
|
||||
StringRef current(args[I]), next(args[I + 1]);
|
||||
if (current == "-user-module-version") {
|
||||
// Sanitize versions that are too long
|
||||
while(next.count('.') > 3) {
|
||||
next = next.rsplit('.').first;
|
||||
}
|
||||
result.tryParse(next);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user