"-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:
Jordan Rose
2017-03-03 13:28:01 -08:00
committed by GitHub
parent bc6ea5b00f
commit 3456d04925
7 changed files with 130 additions and 42 deletions

View File

@@ -2957,7 +2957,8 @@ int main(int argc, char *argv[]) {
if (auto swiftVersion =
version::Version::parseVersionString(options::SwiftVersion,
SourceLoc(), nullptr)) {
InitInvok.getLangOptions().EffectiveLanguageVersion = *swiftVersion;
if (auto actual = swiftVersion.getValue().getEffectiveLanguageVersion())
InitInvok.getLangOptions().EffectiveLanguageVersion = actual.getValue();
}
}
InitInvok.getClangImporterOptions().ModuleCachePath =