mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add "-swift-version <n>" that sets LangOpts.EffectiveLanguageVersion.
This flag switches the "effective language version" of the compiler, at least to any version supported (as of this change: "3" or "3.0"). At the moment nothing uses it except the language version build configuration statements (#if swift(...)) and various other places that report, encode, or otherwise check version numbers. In the future, it's intended as scaffolding for backwards compatibility. Fixes SR-2582
This commit is contained in:
@@ -583,7 +583,8 @@ void Serializer::writeHeader(const SerializationOptions &options) {
|
||||
llvm::raw_svector_ostream versionString(versionStringBuf);
|
||||
versionString << Version::getCurrentLanguageVersion();
|
||||
size_t shortVersionStringLength = versionString.tell();
|
||||
versionString << '/' << version::getSwiftFullVersion();
|
||||
versionString << '/' << version::getSwiftFullVersion(
|
||||
M->getASTContext().LangOpts.EffectiveLanguageVersion);
|
||||
Metadata.emit(ScratchRecord,
|
||||
VERSION_MAJOR, VERSION_MINOR, shortVersionStringLength,
|
||||
versionString.str());
|
||||
@@ -626,12 +627,14 @@ void Serializer::writeDocHeader() {
|
||||
control_block::MetadataLayout Metadata(Out);
|
||||
control_block::TargetLayout Target(Out);
|
||||
|
||||
auto& LangOpts = M->getASTContext().LangOpts;
|
||||
Metadata.emit(ScratchRecord,
|
||||
VERSION_MAJOR, VERSION_MINOR,
|
||||
/*short version string length*/0,
|
||||
version::getSwiftFullVersion());
|
||||
version::getSwiftFullVersion(
|
||||
LangOpts.EffectiveLanguageVersion));
|
||||
|
||||
Target.emit(ScratchRecord, M->getASTContext().LangOpts.Target.str());
|
||||
Target.emit(ScratchRecord, LangOpts.Target.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user