mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
"-swift-version 3" means Swift 3.1, not 3.0. (#7883)
Put in a general mechanism for mapping user-specified "compatibility versions" to proper "effective versions" (what #if and @available checking should respect). This may still be different from the intrinsic "language version"; right now master is considered a "3.1" compiler with a "Swift 4 mode", and we plan to ship a "4.0" compiler with a "Swift 3 mode" that will have a version number of something like "3.2". rdar://problem/29884401 / SR-3791
This commit is contained in:
@@ -3491,15 +3491,19 @@ static int prepareForDump(const char *Main,
|
||||
options::ModuleCachePath;
|
||||
|
||||
if (!options::SwiftVersion.empty()) {
|
||||
if (auto Version = version::Version::
|
||||
parseVersionString(options::SwiftVersion, SourceLoc(), nullptr)) {
|
||||
if (Version.getValue().isValidEffectiveLanguageVersion())
|
||||
InitInvok.getLangOptions().EffectiveLanguageVersion = Version.getValue();
|
||||
else {
|
||||
llvm::errs() << "Unsupported Swift Version.\n";
|
||||
return 1;
|
||||
using version::Version;
|
||||
bool isValid = false;
|
||||
if (auto Version = Version::parseVersionString(options::SwiftVersion,
|
||||
SourceLoc(), nullptr)) {
|
||||
if (auto Effective = Version.getValue().getEffectiveLanguageVersion()) {
|
||||
InitInvok.getLangOptions().EffectiveLanguageVersion = *Effective;
|
||||
isValid = true;
|
||||
}
|
||||
}
|
||||
if (!isValid) {
|
||||
llvm::errs() << "Unsupported Swift Version.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!options::ResourceDir.empty()) {
|
||||
|
||||
Reference in New Issue
Block a user