mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SE-0020: Swift Language Version Build Configuration
Introduce a new "swift" build configuration that guards declarations
and statements with a language version - if the current language version
of the compiler is at least that version, the block will parse as normal.
For inactive blocks, the code will not be parsed an no diagnostics will
be emitted there.
Example:
#if swift(>=2.2)
print("Active")
#else
this code will not parse or emit diagnostics
#endif
https://github.com/apple/swift-evolution/blob/master/proposals/0020-if-swift-version.md
rdar://problem/19823607
This commit is contained in:
@@ -97,15 +97,19 @@ public:
|
||||
/// Parse a generic version string of the format [0-9]+(.[0-9]+)*
|
||||
///
|
||||
/// Version components can be any unsigned 64-bit number.
|
||||
static Version parseVersionString(llvm::StringRef VersionString,
|
||||
SourceLoc Loc,
|
||||
DiagnosticEngine *Diags);
|
||||
static Optional<Version> parseVersionString(llvm::StringRef VersionString,
|
||||
SourceLoc Loc,
|
||||
DiagnosticEngine *Diags);
|
||||
|
||||
/// Returns a version from the currently defined SWIFT_COMPILER_VERSION.
|
||||
///
|
||||
/// If SWIFT_COMPILER_VERSION is undefined, this will return the empty
|
||||
/// compiler version.
|
||||
static Version getCurrentCompilerVersion();
|
||||
|
||||
/// Returns a version from the currently defined SWIFT_VERSION_MAJOR and
|
||||
/// SWIFT_VERSION_MAJOR.
|
||||
static Version getCurrentLanguageVersion();
|
||||
};
|
||||
|
||||
bool operator>=(const Version &lhs, const Version &rhs);
|
||||
|
||||
Reference in New Issue
Block a user