diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-01-31 02:18:19 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-01-31 02:18:19 +0000 |
commit | 85238aae1a4b6ac67e16560a9855944191f3db5b (patch) | |
tree | 314affc8a0c86f7f6db51951c203ea26fa714513 /lib/IR | |
parent | a070d2a0355c4993240b5206ebc1d517c151331d (diff) | |
download | external_llvm-85238aae1a4b6ac67e16560a9855944191f3db5b.zip external_llvm-85238aae1a4b6ac67e16560a9855944191f3db5b.tar.gz external_llvm-85238aae1a4b6ac67e16560a9855944191f3db5b.tar.bz2 |
Remove Attribute::hasAttributes() and make Attribute::hasAttribute() private.
The Attribute::hasAttributes() is kind of meaningless since an Attribute can
have only one attribute. And we would rather people use the 'operator=='
instead of Attribute::hasAttribute().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174026 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r-- | lib/IR/AttributeImpl.h | 1 | ||||
-rw-r--r-- | lib/IR/Attributes.cpp | 20 |
2 files changed, 6 insertions, 15 deletions
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h index 7be5a16..af9d4fa 100644 --- a/lib/IR/AttributeImpl.h +++ b/lib/IR/AttributeImpl.h @@ -46,7 +46,6 @@ public: AttributeImpl(LLVMContext &C, StringRef data); bool hasAttribute(Attribute::AttrKind A) const; - bool hasAttributes() const; Constant *getAttributeKind() const { return Kind; } ArrayRef<Constant*> getAttributeValues() const { return Vals; } diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp index 98c12b5..2c84a3d 100644 --- a/lib/IR/Attributes.cpp +++ b/lib/IR/Attributes.cpp @@ -82,10 +82,6 @@ bool Attribute::hasAttribute(AttrKind Val) const { return pImpl && pImpl->hasAttribute(Val); } -bool Attribute::hasAttributes() const { - return pImpl && pImpl->hasAttributes(); -} - Constant *Attribute::getAttributeKind() const { return pImpl ? pImpl->getAttributeKind() : 0; } @@ -185,7 +181,7 @@ std::string Attribute::getAsString() const { } bool Attribute::operator==(AttrKind K) const { - return pImpl && *pImpl == K; + return (pImpl && *pImpl == K) || (!pImpl && K == None); } bool Attribute::operator!=(AttrKind K) const { return !(*this == K); @@ -226,10 +222,6 @@ bool AttributeImpl::hasAttribute(Attribute::AttrKind A) const { return (Raw() & getAttrMask(A)) != 0; } -bool AttributeImpl::hasAttributes() const { - return Raw() != 0; -} - uint64_t AttributeImpl::getAlignment() const { uint64_t Mask = Raw() & getAttrMask(Attribute::Alignment); return 1ULL << ((Mask >> 16) - 1); @@ -369,7 +361,7 @@ AttributeSetNode *AttributeSetNode::get(LLVMContext &C, bool AttributeSetNode::hasAttribute(Attribute::AttrKind Kind) const { for (SmallVectorImpl<Attribute>::const_iterator I = AttrList.begin(), E = AttrList.end(); I != E; ++I) - if (I->hasAttribute(Kind)) + if (*I == Kind) return true; return false; } @@ -377,7 +369,7 @@ bool AttributeSetNode::hasAttribute(Attribute::AttrKind Kind) const { unsigned AttributeSetNode::getAlignment() const { for (SmallVectorImpl<Attribute>::const_iterator I = AttrList.begin(), E = AttrList.end(); I != E; ++I) - if (I->hasAttribute(Attribute::Alignment)) + if (*I == Attribute::Alignment) return I->getAlignment(); return 0; } @@ -385,7 +377,7 @@ unsigned AttributeSetNode::getAlignment() const { unsigned AttributeSetNode::getStackAlignment() const { for (SmallVectorImpl<Attribute>::const_iterator I = AttrList.begin(), E = AttrList.end(); I != E; ++I) - if (I->hasAttribute(Attribute::StackAlignment)) + if (*I == Attribute::StackAlignment) return I->getStackAlignment(); return 0; } @@ -454,7 +446,7 @@ AttributeSet AttributeSet::get(LLVMContext &C, for (unsigned i = 0, e = Attrs.size(); i != e; ++i) { assert((!i || Attrs[i-1].first <= Attrs[i].first) && "Misordered Attributes list!"); - assert(Attrs[i].second.hasAttributes() && + assert(Attrs[i].second != Attribute::None && "Pointless attribute!"); } #endif @@ -682,7 +674,7 @@ bool AttributeSet::hasAttrSomewhere(Attribute::AttrKind Attr) const { for (unsigned I = 0, E = pImpl->getNumAttributes(); I != E; ++I) for (AttributeSetImpl::const_iterator II = pImpl->begin(I), IE = pImpl->end(I); II != IE; ++II) - if (II->hasAttribute(Attr)) + if (*II == Attr) return true; return false; |