mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[Attributes] Use single method to fetch type from AttributeSet (NFC)
While it is nice to have separate methods in the public AttributeSet API, we can fetch the type from the internal AttributeSetNode using a generic API for all type attribute kinds.
This commit is contained in:
parent
c64b97d8cf
commit
0b8ca13018
@ -255,11 +255,7 @@ public:
|
||||
std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const;
|
||||
std::pair<unsigned, unsigned> getVScaleRangeArgs() const;
|
||||
std::string getAsString(bool InAttrGrp) const;
|
||||
Type *getByValType() const;
|
||||
Type *getStructRetType() const;
|
||||
Type *getByRefType() const;
|
||||
Type *getPreallocatedType() const;
|
||||
Type *getInAllocaType() const;
|
||||
Type *getAttributeType(Attribute::AttrKind Kind) const;
|
||||
|
||||
using iterator = const Attribute *;
|
||||
|
||||
|
@ -689,23 +689,23 @@ uint64_t AttributeSet::getDereferenceableOrNullBytes() const {
|
||||
}
|
||||
|
||||
Type *AttributeSet::getByRefType() const {
|
||||
return SetNode ? SetNode->getByRefType() : nullptr;
|
||||
return SetNode ? SetNode->getAttributeType(Attribute::ByRef) : nullptr;
|
||||
}
|
||||
|
||||
Type *AttributeSet::getByValType() const {
|
||||
return SetNode ? SetNode->getByValType() : nullptr;
|
||||
return SetNode ? SetNode->getAttributeType(Attribute::ByVal) : nullptr;
|
||||
}
|
||||
|
||||
Type *AttributeSet::getStructRetType() const {
|
||||
return SetNode ? SetNode->getStructRetType() : nullptr;
|
||||
return SetNode ? SetNode->getAttributeType(Attribute::StructRet) : nullptr;
|
||||
}
|
||||
|
||||
Type *AttributeSet::getPreallocatedType() const {
|
||||
return SetNode ? SetNode->getPreallocatedType() : nullptr;
|
||||
return SetNode ? SetNode->getAttributeType(Attribute::Preallocated) : nullptr;
|
||||
}
|
||||
|
||||
Type *AttributeSet::getInAllocaType() const {
|
||||
return SetNode ? SetNode->getInAllocaType() : nullptr;
|
||||
return SetNode ? SetNode->getAttributeType(Attribute::InAlloca) : nullptr;
|
||||
}
|
||||
|
||||
std::pair<unsigned, Optional<unsigned>> AttributeSet::getAllocSizeArgs() const {
|
||||
@ -897,32 +897,8 @@ MaybeAlign AttributeSetNode::getStackAlignment() const {
|
||||
return None;
|
||||
}
|
||||
|
||||
Type *AttributeSetNode::getByValType() const {
|
||||
if (auto A = findEnumAttribute(Attribute::ByVal))
|
||||
return A->getValueAsType();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Type *AttributeSetNode::getStructRetType() const {
|
||||
if (auto A = findEnumAttribute(Attribute::StructRet))
|
||||
return A->getValueAsType();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Type *AttributeSetNode::getByRefType() const {
|
||||
if (auto A = findEnumAttribute(Attribute::ByRef))
|
||||
return A->getValueAsType();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Type *AttributeSetNode::getPreallocatedType() const {
|
||||
if (auto A = findEnumAttribute(Attribute::Preallocated))
|
||||
return A->getValueAsType();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Type *AttributeSetNode::getInAllocaType() const {
|
||||
if (auto A = findEnumAttribute(Attribute::InAlloca))
|
||||
Type *AttributeSetNode::getAttributeType(Attribute::AttrKind Kind) const {
|
||||
if (auto A = findEnumAttribute(Kind))
|
||||
return A->getValueAsType();
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user