@@ -719,8 +719,6 @@ enum class AvailableVersionComparison {
719719
720720// / Defines the @available attribute.
721721class AvailableAttr : public DeclAttribute {
722- AvailabilityDomain Domain;
723-
724722public:
725723 enum class Kind : uint8_t {
726724 // / The attribute does not specify `deprecated`, `unavailable`,
@@ -744,11 +742,44 @@ class AvailableAttr : public DeclAttribute {
744742 const llvm::VersionTuple &Obsoleted, SourceRange ObsoletedRange,
745743 bool Implicit, bool IsSPI);
746744
747- // / The optional message.
745+ private:
746+ friend class SemanticAvailableAttr ;
747+
748+ AvailabilityDomain Domain;
749+
748750 const StringRef Message;
751+ const StringRef Rename;
752+
753+ const std::optional<llvm::VersionTuple> Introduced;
754+ const SourceRange IntroducedRange;
755+ const std::optional<llvm::VersionTuple> Deprecated;
756+ const SourceRange DeprecatedRange;
757+ const std::optional<llvm::VersionTuple> Obsoleted;
758+ const SourceRange ObsoletedRange;
759+
760+ public:
761+ // / Returns the parsed version for `introduced:`.
762+ std::optional<llvm::VersionTuple> getRawIntroduced () const {
763+ return Introduced;
764+ }
765+
766+ // / Returns the parsed version for `deprecated:`.
767+ std::optional<llvm::VersionTuple> getRawDeprecated () const {
768+ return Deprecated;
769+ }
770+
771+ // / Returns the parsed version for `obsoleted:`.
772+ std::optional<llvm::VersionTuple> getRawObsoleted () const {
773+ return Obsoleted;
774+ }
749775
750- // / An optional replacement string to emit in a fixit. This allows simple
751- // / declaration renames to be applied by Xcode.
776+ // / Returns the parsed string for `message:`, which will be presented with
777+ // / diagnostics about the availability of the decl.
778+ StringRef getMessage () const { return Message; }
779+
780+ // / Returns the parsed string for `rename:`, which is an optional replacement
781+ // / string to emit in a fixit. This allows simple declaration renames to be
782+ // / applied by Xcode.
752783 // /
753784 // / This should take the form of an operator, identifier, or full function
754785 // / name, optionally with a prefixed type, similar to the syntax used for
@@ -758,25 +789,7 @@ class AvailableAttr : public DeclAttribute {
758789 // / referred to by this string. Note that this attribute can have a rename
759790 // / target that was provided directly when synthesized and therefore can have
760791 // / a rename decl even when this string is empty.
761- const StringRef Rename;
762-
763- // / Indicates when the symbol was introduced.
764- const std::optional<llvm::VersionTuple> Introduced;
765-
766- // / Indicates where the Introduced version was specified.
767- const SourceRange IntroducedRange;
768-
769- // / Indicates when the symbol was deprecated.
770- const std::optional<llvm::VersionTuple> Deprecated;
771-
772- // / Indicates where the Deprecated version was specified.
773- const SourceRange DeprecatedRange;
774-
775- // / Indicates when the symbol was obsoleted.
776- const std::optional<llvm::VersionTuple> Obsoleted;
777-
778- // / Indicates where the Obsoleted version was specified.
779- const SourceRange ObsoletedRange;
792+ StringRef getRename () const { return Rename; }
780793
781794 // / Whether this is an unconditionally unavailable entity.
782795 bool isUnconditionallyUnavailable () const ;
@@ -3242,6 +3255,9 @@ class SemanticAvailableAttr final {
32423255 return attr->Introduced ;
32433256 }
32443257
3258+ // / The source range of the `introduced:` component.
3259+ SourceRange getIntroducedSourceRange () const { return attr->IntroducedRange ; }
3260+
32453261 // / Returns the effective range in which the declaration with this attribute
32463262 // / was introduced.
32473263 AvailabilityRange getIntroducedRange (const ASTContext &Ctx) const ;
0 commit comments