mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add @safe(unchecked) to allow unsafe code within a declaration.
Introduce an attribute to allow unsafe code within the annotated declaration without presenting an unsafe interface to users. This is, by its nature, and unsafe construct, and is used to document where unsafe behavior is encapsulated in safe constructs. There is an optional message that can be used as part of an audit trail.
This commit is contained in:
@@ -3376,6 +3376,15 @@ class Serializer::DeclSerializer : public DeclVisitor<DeclSerializer> {
|
||||
return;
|
||||
}
|
||||
|
||||
case DeclAttrKind::Safe: {
|
||||
auto *theAttr = cast<SafeAttr>(DA);
|
||||
auto abbrCode = S.DeclTypeAbbrCodes[SafeDeclAttrLayout::Code];
|
||||
SafeDeclAttrLayout::emitRecord(S.Out, S.ScratchRecord, abbrCode,
|
||||
theAttr->isImplicit(),
|
||||
theAttr->message);
|
||||
return;
|
||||
}
|
||||
|
||||
case DeclAttrKind::MacroRole: {
|
||||
auto *theAttr = cast<MacroRoleAttr>(DA);
|
||||
auto abbrCode = S.DeclTypeAbbrCodes[MacroRoleDeclAttrLayout::Code];
|
||||
|
||||
Reference in New Issue
Block a user