[Attributes] Make type attribute handling more generic (NFCI)
Followup to D105658 to make AttrBuilder automatically work with new type attributes. TableGen is tweaked to emit First/LastTypeAttr markers, based on which we can handle type attributes programmatically. Differential Revision: https://reviews.llvm.org/D105763
This commit is contained in:
@@ -1642,17 +1642,10 @@ Error BitcodeReader::parseAttributeGroupBlock() {
|
||||
Attribute::AttrKind Kind;
|
||||
if (Error Err = parseAttrKind(Record[++i], &Kind))
|
||||
return Err;
|
||||
if (Kind == Attribute::ByVal) {
|
||||
B.addByValAttr(HasType ? getTypeByID(Record[++i]) : nullptr);
|
||||
} else if (Kind == Attribute::StructRet) {
|
||||
B.addStructRetAttr(HasType ? getTypeByID(Record[++i]) : nullptr);
|
||||
} else if (Kind == Attribute::ByRef) {
|
||||
B.addByRefAttr(getTypeByID(Record[++i]));
|
||||
} else if (Kind == Attribute::Preallocated) {
|
||||
B.addPreallocatedAttr(getTypeByID(Record[++i]));
|
||||
} else if (Kind == Attribute::InAlloca) {
|
||||
B.addInAllocaAttr(HasType ? getTypeByID(Record[++i]) : nullptr);
|
||||
}
|
||||
if (!Attribute::isTypeAttrKind(Kind))
|
||||
return error("Not a type attribute");
|
||||
|
||||
B.addTypeAttr(Kind, HasType ? getTypeByID(Record[++i]) : nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user