diff options
| author | Bill Wendling <isanbard@gmail.com> | 2012-12-30 01:38:39 +0000 |
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2012-12-30 01:38:39 +0000 |
| commit | b1d12619c994c6d5266ba57e0f52c99cd637e7d8 (patch) | |
| tree | 92729b0ddde5c786ac02a9a8960a087dd6379a16 /llvm/lib/VMCore/Attributes.cpp | |
| parent | b137c9e551097297d4e1980b79abbce8c7be38c7 (diff) | |
| download | bcm5719-llvm-b1d12619c994c6d5266ba57e0f52c99cd637e7d8.tar.gz bcm5719-llvm-b1d12619c994c6d5266ba57e0f52c99cd637e7d8.zip | |
Add a few (as yet unused) query methods to determine if the attribute that's
stored here is of a certain kind. This is in preparation for when an Attribute
object represents a single attribute, instead of a bitmask of attributes.
llvm-svn: 171247
Diffstat (limited to 'llvm/lib/VMCore/Attributes.cpp')
| -rw-r--r-- | llvm/lib/VMCore/Attributes.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Attributes.cpp b/llvm/lib/VMCore/Attributes.cpp index a1e0856971d..52405f25ae6 100644 --- a/llvm/lib/VMCore/Attributes.cpp +++ b/llvm/lib/VMCore/Attributes.cpp @@ -302,7 +302,21 @@ AttributeImpl::AttributeImpl(LLVMContext &C, uint64_t data) { Data = ConstantInt::get(Type::getInt64Ty(C), data); } +bool AttributeImpl::contains(Attribute::AttrKind Kind) const { + if (ConstantInt *CI = dyn_cast<ConstantInt>(Data)) + return CI->getZExtValue() == Kind; + return false; +} + +bool AttributeImpl::contains(StringRef Kind) const { + if (ConstantDataArray *CDA = dyn_cast<ConstantDataArray>(Data)) + if (CDA->isString()) + return CDA->getAsString() == Kind; + return false; +} + uint64_t AttributeImpl::getBitMask() const { + // FIXME: Remove this. return cast<ConstantInt>(Data)->getZExtValue(); } |

