mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Sema] Define availability via compiler flag
Introduce availability macros defined by a frontend flag.
This feature makes it possible to set the availability
versions at the moment of compilation instead of having
it hard coded in the sources. It can be used by projects
with a need to change the availability depending on the
compilation context while using the same sources.
The availability macro is defined with the `-define-availability` flag:
swift MyLib.swift -define-availability "_iOS8Aligned:macOS 10.10, iOS 8.0" ..
The macro can be used in code instead of a platform name and version:
@available(_iOS8Aligned, *)
public func foo() {}
rdar://problem/65612624
This commit is contained in:
@@ -111,6 +111,9 @@ namespace swift {
|
||||
/// when using RequireExplicitAvailability.
|
||||
std::string RequireExplicitAvailabilityTarget;
|
||||
|
||||
// Availability macros definitions to be expanded at parsing.
|
||||
SmallVector<StringRef, 4> AvailabilityMacros;
|
||||
|
||||
/// If false, '#file' evaluates to the full path rather than a
|
||||
/// human-readable string.
|
||||
bool EnableConcisePoundFile = false;
|
||||
|
||||
Reference in New Issue
Block a user