@@ -719,8 +719,6 @@ enum class AvailableVersionComparison {
719
719
720
720
// / Defines the @available attribute.
721
721
class AvailableAttr : public DeclAttribute {
722
- AvailabilityDomain Domain;
723
-
724
722
public:
725
723
enum class Kind : uint8_t {
726
724
// / The attribute does not specify `deprecated`, `unavailable`,
@@ -744,11 +742,44 @@ class AvailableAttr : public DeclAttribute {
744
742
const llvm::VersionTuple &Obsoleted, SourceRange ObsoletedRange,
745
743
bool Implicit, bool IsSPI);
746
744
747
- // / The optional message.
745
+ private:
746
+ friend class SemanticAvailableAttr ;
747
+
748
+ AvailabilityDomain Domain;
749
+
748
750
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
+ }
749
775
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.
752
783
// /
753
784
// / This should take the form of an operator, identifier, or full function
754
785
// / name, optionally with a prefixed type, similar to the syntax used for
@@ -758,25 +789,7 @@ class AvailableAttr : public DeclAttribute {
758
789
// / referred to by this string. Note that this attribute can have a rename
759
790
// / target that was provided directly when synthesized and therefore can have
760
791
// / 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; }
780
793
781
794
// / Whether this is an unconditionally unavailable entity.
782
795
bool isUnconditionallyUnavailable () const ;
@@ -3242,6 +3255,9 @@ class SemanticAvailableAttr final {
3242
3255
return attr->Introduced ;
3243
3256
}
3244
3257
3258
+ // / The source range of the `introduced:` component.
3259
+ SourceRange getIntroducedSourceRange () const { return attr->IntroducedRange ; }
3260
+
3245
3261
// / Returns the effective range in which the declaration with this attribute
3246
3262
// / was introduced.
3247
3263
AvailabilityRange getIntroducedRange (const ASTContext &Ctx) const ;
0 commit comments