@@ -151,10 +151,14 @@ class DeclAttribute : public AttributeBase {
151
151
Value : 32
152
152
);
153
153
154
- SWIFT_INLINE_BITFIELD (AvailableAttr, DeclAttribute, 4 +1 +1 +1 ,
154
+ SWIFT_INLINE_BITFIELD (AvailableAttr, DeclAttribute, 4 +1 +1 +1 + 1 + 1 ,
155
155
// / An `AvailableAttr::Kind` value.
156
156
Kind : 4 ,
157
157
158
+ // / State storage for `SemanticAvailableAttrRequest`.
159
+ HasComputedSemanticAttr : 1 ,
160
+ HasDomain : 1 ,
161
+
158
162
// / State storage for `RenamedDeclRequest`.
159
163
HasComputedRenamedDecl : 1 ,
160
164
HasRenamedDecl : 1 ,
@@ -806,14 +810,15 @@ class AvailableAttr : public DeclAttribute {
806
810
// / Returns the `AvailabilityDomain` associated with the attribute, or
807
811
// / `std::nullopt` if it has either not yet been resolved or could not be
808
812
// / resolved successfully.
809
- std::optional<AvailabilityDomain> getCachedDomain () const { return Domain; }
813
+ std::optional<AvailabilityDomain> getCachedDomain () const {
814
+ if (hasCachedDomain ())
815
+ return Domain;
816
+ return std::nullopt ;
817
+ }
810
818
811
819
// / Returns true if the `AvailabilityDomain` associated with the attribute
812
820
// / has been resolved successfully.
813
- bool hasCachedDomain () const {
814
- // For now, domains are always set on construction of the attribute.
815
- return true ;
816
- }
821
+ bool hasCachedDomain () const { return Bits.AvailableAttr .HasDomain ; }
817
822
818
823
// / Returns the kind of availability the attribute specifies.
819
824
Kind getKind () const { return static_cast <Kind>(Bits.AvailableAttr .Kind ); }
@@ -873,6 +878,17 @@ class AvailableAttr : public DeclAttribute {
873
878
Bits.AvailableAttr .HasComputedRenamedDecl = true ;
874
879
Bits.AvailableAttr .HasRenamedDecl = hasRenamedDecl;
875
880
}
881
+
882
+ private:
883
+ friend class SemanticAvailableAttrRequest ;
884
+
885
+ bool hasComputedSemanticAttr () const {
886
+ return Bits.AvailableAttr .HasComputedSemanticAttr ;
887
+ }
888
+
889
+ void setComputedSemanticAttr () {
890
+ Bits.AvailableAttr .HasComputedSemanticAttr = true ;
891
+ }
876
892
};
877
893
878
894
// / Indicates that the given declaration is visible to Objective-C.
0 commit comments