AST: Return a SemanticAvailableAttr from Decl::getDeprecatedAttr().

This commit is contained in:
Allan Shortlidge
2024-12-19 16:00:11 -08:00
parent 2bc0427279
commit 055a9ecd07
6 changed files with 59 additions and 41 deletions

View File

@@ -3215,6 +3215,16 @@ public:
/// `PlatformKind::none` if the attribute is not platform specific.
PlatformKind getPlatform() const { return getDomain().getPlatformKind(); }
/// Whether this is attribute indicates unavailability in all versions.
bool isUnconditionallyUnavailable() const {
return attr->isUnconditionallyUnavailable();
}
/// Whether this is attribute indicates deprecation in all versions.
bool isUnconditionallyDeprecated() const {
return attr->isUnconditionallyDeprecated();
}
/// Whether this is a `noasync` attribute.
bool isNoAsync() const { return attr->isNoAsync(); }

View File

@@ -1416,15 +1416,15 @@ public:
/// Returns true if the declaration is deprecated at the current deployment
/// target.
bool isDeprecated() const { return getDeprecatedAttr() != nullptr; }
bool isDeprecated() const { return getDeprecatedAttr().has_value(); }
/// Returns the first `@available` attribute that indicates that this decl
/// is deprecated on current deployment target, or `nullptr` otherwise.
const AvailableAttr *getDeprecatedAttr() const;
std::optional<SemanticAvailableAttr> getDeprecatedAttr() const;
/// Returns the first `@available` attribute that indicates that this decl
/// will be deprecated in the future, or `nullptr` otherwise.
const AvailableAttr *getSoftDeprecatedAttr() const;
std::optional<SemanticAvailableAttr> getSoftDeprecatedAttr() const;
/// Returns the first @available attribute that indicates this decl is
/// unavailable from asynchronous contexts, or `nullptr` otherwise.