@@ -46,6 +46,7 @@ bool AvailabilityContext::PlatformInfo::constrainWith(
46
46
CONSTRAIN_BOOL (IsUnavailableInEmbedded, other.IsUnavailableInEmbedded );
47
47
}
48
48
isConstrained |= CONSTRAIN_BOOL (IsDeprecated, other.IsDeprecated );
49
+ isConstrained |= CONSTRAIN_BOOL (AllowsUnsafe, other.AllowsUnsafe );
49
50
50
51
return isConstrained;
51
52
}
@@ -63,6 +64,7 @@ bool AvailabilityContext::PlatformInfo::constrainWith(const Decl *decl) {
63
64
}
64
65
65
66
isConstrained |= CONSTRAIN_BOOL (IsDeprecated, decl->isDeprecated ());
67
+ isConstrained |= CONSTRAIN_BOOL (AllowsUnsafe, decl->allowsUnsafe ());
66
68
67
69
return isConstrained;
68
70
}
@@ -128,7 +130,8 @@ AvailabilityContext::forPlatformRange(const AvailabilityRange &range,
128
130
PlatformInfo platformInfo{range, PlatformKind::none,
129
131
/* IsUnavailable*/ false ,
130
132
/* IsUnavailableInEmbedded*/ false ,
131
- /* IsDeprecated*/ false };
133
+ /* IsDeprecated*/ false ,
134
+ /* AllowsUnsafe*/ false };
132
135
return AvailabilityContext (Storage::get (platformInfo, ctx));
133
136
}
134
137
@@ -151,7 +154,8 @@ AvailabilityContext::get(const AvailabilityRange &platformAvailability,
151
154
? *unavailablePlatform
152
155
: PlatformKind::none,
153
156
unavailablePlatform.has_value (),
154
- /* IsUnavailableInEmbedded*/ false , deprecated};
157
+ /* IsUnavailableInEmbedded*/ false , deprecated,
158
+ /* AllowsUnsafe*/ false };
155
159
return AvailabilityContext (Storage::get (platformInfo, ctx));
156
160
}
157
161
@@ -170,6 +174,10 @@ bool AvailabilityContext::isUnavailableInEmbedded() const {
170
174
return Info->Platform .IsUnavailableInEmbedded ;
171
175
}
172
176
177
+ bool AvailabilityContext::allowsUnsafe () const {
178
+ return Info->Platform .AllowsUnsafe ;
179
+ }
180
+
173
181
bool AvailabilityContext::isDeprecated () const {
174
182
return Info->Platform .IsDeprecated ;
175
183
}
@@ -233,6 +241,9 @@ void AvailabilityContext::print(llvm::raw_ostream &os) const {
233
241
234
242
if (isDeprecated ())
235
243
os << " deprecated" ;
244
+
245
+ if (allowsUnsafe ())
246
+ os << " allows_unsafe" ;
236
247
}
237
248
238
249
void AvailabilityContext::dump () const { print (llvm::errs ()); }
0 commit comments