Add the distribution tag to -print-target-info

Ideally this would also update the `--version` output to be overridden
by `SWIFT_TOOLCHAIN_VERSION`, but unfortunately various tools rely on
the current format (eg. swift-build).

(cherry picked from commit 3c098782b4)
This commit is contained in:
Ben Barham
2025-05-21 17:11:32 -07:00
parent fbd2b8d411
commit 1f53e700fa
7 changed files with 24 additions and 23 deletions

View File

@@ -395,7 +395,7 @@ static ValidationInfo validateControlBlock(
// env var is set (for testing).
static const char* forceDebugPreSDKRestriction =
::getenv("SWIFT_DEBUG_FORCE_SWIFTMODULE_PER_SDK");
if (!version::isCurrentCompilerTagged() &&
if (version::getCurrentCompilerSerializationTag().empty() &&
!forceDebugPreSDKRestriction) {
break;
}
@@ -436,10 +436,12 @@ static ValidationInfo validateControlBlock(
::getenv("SWIFT_DEBUG_FORCE_SWIFTMODULE_REVISION");
StringRef moduleRevision = blobData;
StringRef serializationTag =
version::getCurrentCompilerSerializationTag();
if (forcedDebugRevision ||
(requiresRevisionMatch && version::isCurrentCompilerTagged())) {
StringRef compilerRevision = forcedDebugRevision ?
forcedDebugRevision : version::getCurrentCompilerSerializationTag();
(requiresRevisionMatch && !serializationTag.empty())) {
StringRef compilerRevision =
forcedDebugRevision ? forcedDebugRevision : serializationTag;
if (moduleRevision != compilerRevision) {
// The module versions are mismatching, record it and diagnose later.
result.problematicRevision = moduleRevision;