[llvm] r176289 - Don't add an attribute that already exists and don't remove an attribute that doesn't exist.
Bill Wendling
isanbard at gmail.com
Thu Feb 28 11:17:40 PST 2013
Author: void
Date: Thu Feb 28 13:17:40 2013
New Revision: 176289
URL: http://llvm.org/viewvc/llvm-project?rev=176289&view=rev
Log:
Don't add an attribute that already exists and don't remove an attribute that doesn't exist.
Modified:
llvm/trunk/lib/IR/Attributes.cpp
Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=176289&r1=176288&r2=176289&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Thu Feb 28 13:17:40 2013
@@ -645,6 +645,7 @@ AttributeSet AttributeSet::get(LLVMConte
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Idx,
Attribute::AttrKind Attr) const {
+ if (hasAttribute(Idx, Attr)) return *this;
return addAttributes(C, Idx, AttributeSet::get(C, Idx, Attr));
}
@@ -699,6 +700,7 @@ AttributeSet AttributeSet::addAttributes
AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Idx,
Attribute::AttrKind Attr) const {
+ if (!hasAttribute(Idx, Attr)) return *this;
return removeAttributes(C, Idx, AttributeSet::get(C, Idx, Attr));
}
More information about the llvm-commits
mailing list