Skip to content

Commit 7b4cf7f

Browse files
committed
Add AvailableAttr::isLanguageVersionSpecific
1 parent 66f2027 commit 7b4cf7f

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/swift/AST/Attr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,9 @@ class AvailableAttr : public DeclAttribute {
625625
/// The platform of the availability.
626626
const PlatformKind Platform;
627627

628+
/// Whether this is a language-version-specific entity.
629+
bool isLanguageVersionSpecific() const;
630+
628631
/// Whether this is an unconditionally unavailable entity.
629632
bool isUnconditionallyUnavailable() const;
630633

lib/AST/Attr.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,19 @@ bool AvailableAttr::isActivePlatform(const ASTContext &ctx) const {
667667
return isPlatformActive(Platform, ctx.LangOpts);
668668
}
669669

670+
bool AvailableAttr::isLanguageVersionSpecific() const {
671+
if (PlatformAgnostic ==
672+
PlatformAgnosticAvailabilityKind::SwiftVersionSpecific)
673+
{
674+
assert(Platform == PlatformKind::none &&
675+
(Introduced.hasValue() ||
676+
Deprecated.hasValue() ||
677+
Obsoleted.hasValue()));
678+
return true;
679+
}
680+
return false;
681+
}
682+
670683
bool AvailableAttr::isUnconditionallyUnavailable() const {
671684
switch (PlatformAgnostic) {
672685
case PlatformAgnosticAvailabilityKind::None:

0 commit comments

Comments
 (0)