[llvm-commits] [llvm] r171294 - in /llvm/trunk: include/llvm/Attributes.h lib/VMCore/Attributes.cpp
Bill Wendling
isanbard at gmail.com
Mon Dec 31 03:51:54 PST 2012
Author: void
Date: Mon Dec 31 05:51:54 2012
New Revision: 171294
URL: http://llvm.org/viewvc/llvm-project?rev=171294&view=rev
Log:
Add some comparison operators to compare the Attribute object with the AttrKind value.
Modified:
llvm/trunk/include/llvm/Attributes.h
llvm/trunk/lib/VMCore/Attributes.cpp
Modified: llvm/trunk/include/llvm/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Attributes.h?rev=171294&r1=171293&r2=171294&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Attributes.h (original)
+++ llvm/trunk/include/llvm/Attributes.h Mon Dec 31 05:51:54 2012
@@ -120,6 +120,10 @@
/// 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 @@
/// 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.
Modified: llvm/trunk/lib/VMCore/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Attributes.cpp?rev=171294&r1=171293&r2=171294&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Attributes.cpp (original)
+++ llvm/trunk/lib/VMCore/Attributes.cpp Mon Dec 31 05:51:54 2012
@@ -88,6 +88,14 @@
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 @@
}
/// 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();
More information about the llvm-commits
mailing list