mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: support @_effects attribute with custom strings.
In addition to the predefined cases, like "readnone", "readonly", etc. support providing a custom string, which will be parsed later. Also, allow multiple effects attributes to be put onto a function.
This commit is contained in:
@@ -4426,9 +4426,15 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {
|
||||
|
||||
case decls_block::Effects_DECL_ATTR: {
|
||||
unsigned kind;
|
||||
serialization::decls_block::EffectsDeclAttrLayout::readRecord(scratch,
|
||||
kind);
|
||||
Attr = new (ctx) EffectsAttr((EffectsKind)kind);
|
||||
IdentifierID customStringID;
|
||||
serialization::decls_block::EffectsDeclAttrLayout::
|
||||
readRecord(scratch, kind, customStringID);
|
||||
if (customStringID) {
|
||||
assert((EffectsKind)kind == EffectsKind::Custom);
|
||||
Attr = new (ctx) EffectsAttr(MF.getIdentifier(customStringID).str());
|
||||
} else {
|
||||
Attr = new (ctx) EffectsAttr((EffectsKind)kind);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case decls_block::OriginallyDefinedIn_DECL_ATTR: {
|
||||
|
||||
Reference in New Issue
Block a user