From 04949fa99810054766741ffb4a186b7014557a54 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 3 Jan 2013 01:54:39 +0000 Subject: Try again to revert the bad patch. The tree was reverted for some unknown reason before the last time. --- Reverse-merging r171442 into '.': U include/llvm/IR/Attributes.h U lib/IR/Attributes.cpp U lib/IR/AttributeImpl.h llvm-svn: 171448 --- llvm/lib/IR/Attributes.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'llvm/lib/IR/Attributes.cpp') diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index e6a5327b5fa..b847d768f3a 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -89,11 +89,11 @@ unsigned Attribute::getStackAlignment() const { } bool Attribute::operator==(AttrKind K) const { - return pImpl && *pImpl == K; + return pImpl && pImpl->contains(K); } bool Attribute::operator!=(AttrKind K) const { - return !(pImpl && *pImpl == K); + return !(pImpl && pImpl->contains(K)); } uint64_t Attribute::getBitMask() const { @@ -293,14 +293,10 @@ AttrBuilder &AttrBuilder::removeAttributes(const Attribute &A){ return *this; } -bool AttrBuilder::operator==(Attribute::AttrKind A) const { +bool AttrBuilder::contains(Attribute::AttrKind A) const { return Bits & AttributeImpl::getAttrMask(A); } -bool AttrBuilder::operator!=(Attribute::AttrKind A) const { - return !(*this == A); -} - bool AttrBuilder::hasAttributes() const { return Bits != 0; } @@ -345,24 +341,18 @@ AttributeImpl::AttributeImpl(LLVMContext &C, StringRef data) { Data = ConstantDataArray::getString(C, data); } -bool AttributeImpl::operator==(Attribute::AttrKind Kind) const { +bool AttributeImpl::contains(Attribute::AttrKind Kind) const { if (ConstantInt *CI = dyn_cast(Data)) return CI->getZExtValue() == Kind; return false; } -bool AttributeImpl::operator!=(Attribute::AttrKind Kind) const { - return !(*this == Kind); -} -bool AttributeImpl::operator==(StringRef Kind) const { +bool AttributeImpl::contains(StringRef Kind) const { if (ConstantDataArray *CDA = dyn_cast(Data)) if (CDA->isString()) return CDA->getAsString() == Kind; return false; } -bool AttributeImpl::operator!=(StringRef Kind) const { - return !(*this == Kind); -} uint64_t AttributeImpl::getBitMask() const { // FIXME: Remove this. -- cgit v1.2.3