summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-12-31 11:51:54 +0000
committerBill Wendling <isanbard@gmail.com>2012-12-31 11:51:54 +0000
commite10f76c6404492a23b791989951b4b844698691a (patch)
tree9d723fd943141bdcc851730aa2fdc46240415cdc /llvm
parent6e4ebb542417bd92f2d30a2de79ea89005ff82be (diff)
downloadbcm5719-llvm-e10f76c6404492a23b791989951b4b844698691a.tar.gz
bcm5719-llvm-e10f76c6404492a23b791989951b4b844698691a.zip
Add some comparison operators to compare the Attribute object with the AttrKind value.
llvm-svn: 171294
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Attributes.h6
-rw-r--r--llvm/lib/VMCore/Attributes.cpp12
2 files changed, 15 insertions, 3 deletions
diff --git a/llvm/include/llvm/Attributes.h b/llvm/include/llvm/Attributes.h
index caba9633ebc..a8fedb8210b 100644
--- a/llvm/include/llvm/Attributes.h
+++ b/llvm/include/llvm/Attributes.h
@@ -120,6 +120,10 @@ public:
/// alignment value.
unsigned getStackAlignment() const;
+ bool operator==(AttrKind K) const;
+ bool operator!=(AttrKind K) const;
+
+ // FIXME: Remove these 'operator' methods.
bool operator==(const Attribute &A) const {
return pImpl == A.pImpl;
}
@@ -141,7 +145,7 @@ public:
/// that have been decoded from the given integer. This function must stay in
/// sync with 'encodeLLVMAttributesForBitcode'.
static Attribute decodeLLVMAttributesForBitcode(LLVMContext &C,
- uint64_t EncodedAttrs);
+ uint64_t EncodedAttrs);
/// \brief The Attribute is converted to a string of equivalent mnemonic. This
/// is, presumably, for writing out the mnemonics for the assembly writer.
diff --git a/llvm/lib/VMCore/Attributes.cpp b/llvm/lib/VMCore/Attributes.cpp
index e8c6b2a01c8..f17a9b70f7b 100644
--- a/llvm/lib/VMCore/Attributes.cpp
+++ b/llvm/lib/VMCore/Attributes.cpp
@@ -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();
OpenPOWER on IntegriCloud