From 2a60c4424cf0c5269a4b21ab28c64db35347fcc4 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Wed, 27 Jan 2016 03:45:25 +0000 Subject: [PATCH] Function: Slightly simplify code by using existing hasFnAttribute() convenience function llvm-svn: 258907 --- llvm/include/llvm/IR/Function.h | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h index 4afe44c1befa..fae7b3931b87 100644 --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -262,8 +262,7 @@ public: /// @brief Determine if the function does not access memory. bool doesNotAccessMemory() const { - return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, - Attribute::ReadNone); + return hasFnAttribute(Attribute::ReadNone); } void setDoesNotAccessMemory() { addFnAttr(Attribute::ReadNone); @@ -271,9 +270,7 @@ public: /// @brief Determine if the function does not access or only reads memory. bool onlyReadsMemory() const { - return doesNotAccessMemory() || - AttributeSets.hasAttribute(AttributeSet::FunctionIndex, - Attribute::ReadOnly); + return doesNotAccessMemory() || hasFnAttribute(Attribute::ReadOnly); } void setOnlyReadsMemory() { addFnAttr(Attribute::ReadOnly); @@ -282,16 +279,14 @@ public: /// @brief Determine if the call can access memmory only using pointers based /// on its arguments. bool onlyAccessesArgMemory() const { - return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, - Attribute::ArgMemOnly); + return hasFnAttribute(Attribute::ArgMemOnly); } void setOnlyAccessesArgMemory() { addFnAttr(Attribute::ArgMemOnly); } /// @brief Determine if the function may only access memory that is /// inaccessible from the IR. bool onlyAccessesInaccessibleMemory() const { - return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, - Attribute::InaccessibleMemOnly); + return hasFnAttribute(Attribute::InaccessibleMemOnly); } void setOnlyAccessesInaccessibleMemory() { addFnAttr(Attribute::InaccessibleMemOnly); @@ -300,8 +295,7 @@ public: /// @brief Determine if the function may only access memory that is // either inaccessible from the IR or pointed to by its arguments. bool onlyAccessesInaccessibleMemOrArgMem() const { - return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, - Attribute::InaccessibleMemOrArgMemOnly); + return hasFnAttribute(Attribute::InaccessibleMemOrArgMemOnly); } void setOnlyAccessesInaccessibleMemOrArgMem() { addFnAttr(Attribute::InaccessibleMemOrArgMemOnly); @@ -309,8 +303,7 @@ public: /// @brief Determine if the function cannot return. bool doesNotReturn() const { - return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, - Attribute::NoReturn); + return hasFnAttribute(Attribute::NoReturn); } void setDoesNotReturn() { addFnAttr(Attribute::NoReturn);