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:
Erik Eckstein
2021-09-24 09:56:26 +02:00
parent 67c2b75b54
commit beb2bd2a96
13 changed files with 128 additions and 42 deletions

View File

@@ -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: {