Add some comparison operators to compare the Attribute object with the AttrKind value.
[oota-llvm.git] / lib / VMCore / Attributes.cpp
index e8c6b2a01c8200fac3b0145bbc83b35486c2c7d9..f17a9b70f7b389ba950b05e6a092d1c6334c4cd0 100644 (file)
@@ -88,6 +88,14 @@ unsigned Attribute::getStackAlignment() const {
   return 1U << ((pImpl->getStackAlignment() >> 26) - 1);
 }
 
+bool Attribute::operator==(AttrKind K) const {
+  return pImpl && pImpl->contains(K);
+}
+
+bool Attribute::operator!=(AttrKind K) const {
+  return !(pImpl && pImpl->contains(K));
+}
+
 uint64_t Attribute::getBitMask() const {
   return pImpl ? pImpl->getBitMask() : 0;
 }
@@ -473,8 +481,8 @@ uint64_t AttributeSet::getBitMask(unsigned Index) const {
 }
 
 /// getAttributes - The attributes for the specified index are returned.
-/// Attribute for the result are denoted with Idx = 0.  Function notes are
-/// denoted with idx = ~0.
+/// Attributes for the result are denoted with Idx = 0.  Function attributes are
+/// denoted with Idx = ~0.
 Attribute AttributeSet::getAttributes(unsigned Idx) const {
   if (AttrList == 0) return Attribute();