mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-11 06:38:20 +00:00
Don't add an attribute that already exists and don't remove an attribute that doesn't exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176289 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -645,6 +645,7 @@ AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) {
|
|||||||
|
|
||||||
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Idx,
|
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Idx,
|
||||||
Attribute::AttrKind Attr) const {
|
Attribute::AttrKind Attr) const {
|
||||||
|
if (hasAttribute(Idx, Attr)) return *this;
|
||||||
return addAttributes(C, Idx, AttributeSet::get(C, Idx, Attr));
|
return addAttributes(C, Idx, AttributeSet::get(C, Idx, Attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,6 +700,7 @@ AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Idx,
|
|||||||
|
|
||||||
AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Idx,
|
AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Idx,
|
||||||
Attribute::AttrKind Attr) const {
|
Attribute::AttrKind Attr) const {
|
||||||
|
if (!hasAttribute(Idx, Attr)) return *this;
|
||||||
return removeAttributes(C, Idx, AttributeSet::get(C, Idx, Attr));
|
return removeAttributes(C, Idx, AttributeSet::get(C, Idx, Attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user