mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Macros] Serialization and printing for @attached.
This commit is contained in:
@@ -5447,6 +5447,30 @@ llvm::Error DeclDeserializer::deserializeDeclCommon() {
|
||||
break;
|
||||
}
|
||||
|
||||
case decls_block::Attached_DECL_ATTR: {
|
||||
bool isImplicit;
|
||||
uint8_t rawMacroRole;
|
||||
uint64_t numNames;
|
||||
ArrayRef<uint64_t> introducedDeclNames;
|
||||
serialization::decls_block::AttachedDeclAttrLayout::
|
||||
readRecord(scratch, isImplicit, rawMacroRole, numNames,
|
||||
introducedDeclNames);
|
||||
auto role = *getActualMacroRole(rawMacroRole);
|
||||
if (introducedDeclNames.size() != numNames * 2)
|
||||
return MF.diagnoseFatal();
|
||||
SmallVector<MacroIntroducedDeclName, 1> names;
|
||||
for (unsigned i = 0; i < introducedDeclNames.size(); i += 2) {
|
||||
auto kind = getActualMacroIntroducedDeclNameKind(
|
||||
(uint8_t)introducedDeclNames[i]);
|
||||
auto identifier =
|
||||
MF.getIdentifier(IdentifierID(introducedDeclNames[i + 1]));
|
||||
names.push_back(MacroIntroducedDeclName(*kind, identifier));
|
||||
}
|
||||
Attr = AttachedAttr::create(
|
||||
ctx, SourceLoc(), SourceRange(), role, names, isImplicit);
|
||||
break;
|
||||
}
|
||||
|
||||
#define SIMPLE_DECL_ATTR(NAME, CLASS, ...) \
|
||||
case decls_block::CLASS##_DECL_ATTR: { \
|
||||
bool isImplicit; \
|
||||
|
||||
Reference in New Issue
Block a user