summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Attributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/VMCore/Attributes.cpp')
-rw-r--r--llvm/lib/VMCore/Attributes.cpp14
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();
}
OpenPOWER on IntegriCloud