mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Intro distinct compiler revision string for serialization
This commit is contained in:
@@ -167,9 +167,14 @@ StringRef getSwiftRevision();
|
||||
/// and \c getCurrentCompilerTag returns the version tuple in string format.
|
||||
bool isCurrentCompilerTagged();
|
||||
|
||||
/// Retrieves the distribtion tag of the running compiler, if any.
|
||||
/// Retrieves the distribution tag of the running compiler, if any.
|
||||
StringRef getCurrentCompilerTag();
|
||||
|
||||
/// Retrieves the distribution tag of the running compiler for serialization,
|
||||
/// if any. This can hold more information than \c getCurrentCompilerTag
|
||||
/// depending on the vendor.
|
||||
StringRef getCurrentCompilerSerializationTag();
|
||||
|
||||
} // end namespace version
|
||||
} // end namespace swift
|
||||
|
||||
|
||||
@@ -297,5 +297,13 @@ StringRef getCurrentCompilerTag() {
|
||||
#endif
|
||||
}
|
||||
|
||||
StringRef getCurrentCompilerSerializationTag() {
|
||||
#ifdef SWIFT_COMPILER_VERSION
|
||||
return SWIFT_COMPILER_VERSION;
|
||||
#else
|
||||
return StringRef();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // end namespace version
|
||||
} // end namespace swift
|
||||
|
||||
@@ -370,7 +370,7 @@ static ValidationInfo validateControlBlock(
|
||||
if (forcedDebugRevision ||
|
||||
(requiresRevisionMatch && version::isCurrentCompilerTagged())) {
|
||||
StringRef compilerRevision = forcedDebugRevision ?
|
||||
forcedDebugRevision : version::getCurrentCompilerTag();
|
||||
forcedDebugRevision : version::getCurrentCompilerSerializationTag();
|
||||
if (moduleRevision != compilerRevision) {
|
||||
result.status = Status::RevisionIncompatible;
|
||||
|
||||
|
||||
@@ -1011,7 +1011,7 @@ void Serializer::writeHeader(const SerializationOptions &options) {
|
||||
static const char* forcedDebugRevision =
|
||||
::getenv("SWIFT_DEBUG_FORCE_SWIFTMODULE_REVISION");
|
||||
auto revision = forcedDebugRevision ?
|
||||
forcedDebugRevision : version::getCurrentCompilerTag();
|
||||
forcedDebugRevision : version::getCurrentCompilerSerializationTag();
|
||||
Revision.emit(ScratchRecord, revision);
|
||||
|
||||
IsOSSA.emit(ScratchRecord, options.IsOSSA);
|
||||
|
||||
Reference in New Issue
Block a user