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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171448 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp
index e6a5327..b847d76 100644
--- a/lib/IR/Attributes.cpp
+++ b/lib/IR/Attributes.cpp
@@ -89,11 +89,11 @@
}
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 @@
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 @@
Data = ConstantDataArray::getString(C, data);
}
-bool AttributeImpl::operator==(Attribute::AttrKind Kind) const {
+bool AttributeImpl::contains(Attribute::AttrKind Kind) const {
if (ConstantInt *CI = dyn_cast<ConstantInt>(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<ConstantDataArray>(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.