[Driver] Don't suggest using the "major version" for -swift-version (#20563)

This was a nice feature when people said "-swift-version 3.1"...
up until we got "-swift-version 4.2" as an actual valid version.
Just drop the special case.

https://bugs.swift.org/browse/SR-8850
This commit is contained in:
Jordan Rose
2018-12-10 08:41:21 -08:00
committed by GitHub
parent a5947fed63
commit 00ed3e1185
3 changed files with 6 additions and 20 deletions

View File

@@ -100,18 +100,10 @@ static void diagnoseSwiftVersion(Optional<version::Version> &vers, Arg *verArg,
diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
verArg->getAsString(Args), verArg->getValue());
// Check for an unneeded minor version, otherwise just list valid versions
if (vers.hasValue() && !vers.getValue().empty() &&
vers.getValue().asMajorVersion().getEffectiveLanguageVersion()) {
diags.diagnose(SourceLoc(), diag::note_swift_version_major,
vers.getValue()[0]);
} else {
// Note valid versions instead
auto validVers = version::Version::getValidEffectiveVersions();
auto versStr =
"'" + llvm::join(validVers.begin(), validVers.end(), "', '") + "'";
diags.diagnose(SourceLoc(), diag::note_valid_swift_versions, versStr);
}
// Note valid versions.
auto validVers = version::Version::getValidEffectiveVersions();
auto versStr = "'" + llvm::join(validVers, "', '") + "'";
diags.diagnose(SourceLoc(), diag::note_valid_swift_versions, versStr);
}
/// Create a new Regex instance out of the string value in \p RpassArg.