mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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.
|
/// and \c getCurrentCompilerTag returns the version tuple in string format.
|
||||||
bool isCurrentCompilerTagged();
|
bool isCurrentCompilerTagged();
|
||||||
|
|
||||||
/// Retrieves the distribtion tag of the running compiler, if any.
|
/// Retrieves the distribution tag of the running compiler, if any.
|
||||||
StringRef getCurrentCompilerTag();
|
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 version
|
||||||
} // end namespace swift
|
} // end namespace swift
|
||||||
|
|
||||||
|
|||||||
@@ -297,5 +297,13 @@ StringRef getCurrentCompilerTag() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringRef getCurrentCompilerSerializationTag() {
|
||||||
|
#ifdef SWIFT_COMPILER_VERSION
|
||||||
|
return SWIFT_COMPILER_VERSION;
|
||||||
|
#else
|
||||||
|
return StringRef();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace version
|
} // end namespace version
|
||||||
} // end namespace swift
|
} // end namespace swift
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ static ValidationInfo validateControlBlock(
|
|||||||
if (forcedDebugRevision ||
|
if (forcedDebugRevision ||
|
||||||
(requiresRevisionMatch && version::isCurrentCompilerTagged())) {
|
(requiresRevisionMatch && version::isCurrentCompilerTagged())) {
|
||||||
StringRef compilerRevision = forcedDebugRevision ?
|
StringRef compilerRevision = forcedDebugRevision ?
|
||||||
forcedDebugRevision : version::getCurrentCompilerTag();
|
forcedDebugRevision : version::getCurrentCompilerSerializationTag();
|
||||||
if (moduleRevision != compilerRevision) {
|
if (moduleRevision != compilerRevision) {
|
||||||
result.status = Status::RevisionIncompatible;
|
result.status = Status::RevisionIncompatible;
|
||||||
|
|
||||||
|
|||||||
@@ -1011,7 +1011,7 @@ void Serializer::writeHeader(const SerializationOptions &options) {
|
|||||||
static const char* forcedDebugRevision =
|
static const char* forcedDebugRevision =
|
||||||
::getenv("SWIFT_DEBUG_FORCE_SWIFTMODULE_REVISION");
|
::getenv("SWIFT_DEBUG_FORCE_SWIFTMODULE_REVISION");
|
||||||
auto revision = forcedDebugRevision ?
|
auto revision = forcedDebugRevision ?
|
||||||
forcedDebugRevision : version::getCurrentCompilerTag();
|
forcedDebugRevision : version::getCurrentCompilerSerializationTag();
|
||||||
Revision.emit(ScratchRecord, revision);
|
Revision.emit(ScratchRecord, revision);
|
||||||
|
|
||||||
IsOSSA.emit(ScratchRecord, options.IsOSSA);
|
IsOSSA.emit(ScratchRecord, options.IsOSSA);
|
||||||
|
|||||||
Reference in New Issue
Block a user