summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorvoid <void@91177308-0d34-0410-b5e6-96231b3b80d8>2012-09-19 23:35:21 +0000
committervoid <void@91177308-0d34-0410-b5e6-96231b3b80d8>2012-09-19 23:35:21 +0000
commitf5ec6b65103029cc75a1ba69d5d9649f8a48ee16 (patch)
tree78bd638d1f4497e2667f090f141e95df982dc034 /include
parent07e55148581ab9c092f6e3defc5c7a884ca09c96 (diff)
Add predicates for queries on whether an attribute exists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164264 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Attributes.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/include/llvm/Attributes.h b/include/llvm/Attributes.h
index d1497b5005..cf37e93718 100644
--- a/include/llvm/Attributes.h
+++ b/include/llvm/Attributes.h
@@ -106,6 +106,87 @@ public:
Attributes() : Bits(0) { }
explicit Attributes(uint64_t Val) : Bits(Val) { }
/*implicit*/ Attributes(Attribute::AttrConst Val) : Bits(Val.v) { }
+
+ // Attribute query methods.
+ // FIXME: StackAlignment & Alignment attributes have no predicate methods.
+ bool hasAttributes() const { return Bits != 0; }
+
+ bool hasZExtAttr() const {
+ return Bits & Attribute::ZExt_i;
+ }
+ bool hasSExtAttr() const {
+ return Bits & Attribute::SExt_i;
+ }
+ bool hasNoReturnAttr() const {
+ return Bits & Attribute::NoReturn_i;
+ }
+ bool hasInRegAttr() const {
+ return Bits & Attribute::InReg_i;
+ }
+ bool hasStructRetAttr() const {
+ return Bits & Attribute::StructRet_i;
+ }
+ bool hasNoUnwindAttr() const {
+ return Bits & Attribute::NoUnwind_i;
+ }
+ bool hasNoAliasAttr() const {
+ return Bits & Attribute::NoAlias_i;
+ }
+ bool hasByValAttr() const {
+ return Bits & Attribute::ByVal_i;
+ }
+ bool hasNestAttr() const {
+ return Bits & Attribute::Nest_i;
+ }
+ bool hasReadNoneAttr() const {
+ return Bits & Attribute::ReadNone_i;
+ }
+ bool hasReadOnlyAttr() const {
+ return Bits & Attribute::ReadOnly_i;
+ }
+ bool hasNoInlineAttr() const {
+ return Bits & Attribute::NoInline_i;
+ }
+ bool hasAlwaysInlineAttr() const {
+ return Bits & Attribute::AlwaysInline_i;
+ }
+ bool hasOptimizeForSizeAttr() const {
+ return Bits & Attribute::OptimizeForSize_i;
+ }
+ bool hasStackProtectAttr() const {
+ return Bits & Attribute::StackProtect_i;
+ }
+ bool hasStackProtectReqAttr() const {
+ return Bits & Attribute::StackProtectReq_i;
+ }
+ bool hasNoCaptureAttr() const {
+ return Bits & Attribute::NoCapture_i;
+ }
+ bool hasNoRedZoneAttr() const {
+ return Bits & Attribute::NoRedZone_i;
+ }
+ bool hasNoImplicitFloatAttr() const {
+ return Bits & Attribute::NoImplicitFloat_i;
+ }
+ bool hasNakedAttr() const {
+ return Bits & Attribute::Naked_i;
+ }
+ bool hasInlineHintAttr() const {
+ return Bits & Attribute::InlineHint_i;
+ }
+ bool hasReturnsTwiceAttr() const {
+ return Bits & Attribute::ReturnsTwice_i;
+ }
+ bool hasUWTableAttr() const {
+ return Bits & Attribute::UWTable_i;
+ }
+ bool hasNonLazyBindAttr() const {
+ return Bits & Attribute::NonLazyBind_i;
+ }
+ bool hasAddressSafetyAttr() const {
+ return Bits & Attribute::AddressSafety_i;
+ }
+
// This is a "safe bool() operator".
operator const void *() const { return Bits ? this : 0; }
bool isEmptyOrSingleton() const { return (Bits & (Bits - 1)) == 0; }