mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Basic][Serialization] Intro and use isCurrentCompilerTagged
This commit is contained in:
@@ -184,6 +184,11 @@ std::string getSwiftFullVersion(Version effectiveLanguageVersion =
|
||||
/// this Swift was built.
|
||||
StringRef getSwiftRevision();
|
||||
|
||||
/// Is the running compiler built with a version tag for distribution?
|
||||
/// When true, \c Version::getCurrentCompilerVersion returns a valid version
|
||||
/// and \c getSwiftRevision returns the version tuple in string format.
|
||||
bool isCurrentCompilerTagged();
|
||||
|
||||
} // end namespace version
|
||||
} // end namespace swift
|
||||
|
||||
|
||||
@@ -446,5 +446,13 @@ StringRef getSwiftRevision() {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isCurrentCompilerTagged() {
|
||||
#ifdef SWIFT_COMPILER_VERSION
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // end namespace version
|
||||
} // end namespace swift
|
||||
|
||||
@@ -313,7 +313,7 @@ static ValidationInfo validateControlBlock(
|
||||
// env var is set (for testing).
|
||||
static const char* forceDebugPreSDKRestriction =
|
||||
::getenv("SWIFT_DEBUG_FORCE_SWIFTMODULE_PER_SDK");
|
||||
if (version::Version::getCurrentCompilerVersion().empty() &&
|
||||
if (!version::isCurrentCompilerTagged() &&
|
||||
!forceDebugPreSDKRestriction) {
|
||||
break;
|
||||
}
|
||||
@@ -354,7 +354,7 @@ static ValidationInfo validateControlBlock(
|
||||
::getenv("SWIFT_DEBUG_FORCE_SWIFTMODULE_REVISION");
|
||||
|
||||
bool isCompilerTagged = forcedDebugRevision ||
|
||||
!version::Version::getCurrentCompilerVersion().empty();
|
||||
version::isCurrentCompilerTagged();
|
||||
|
||||
StringRef moduleRevision = blobData;
|
||||
if (isCompilerTagged) {
|
||||
|
||||
Reference in New Issue
Block a user