summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-16 05:23:31 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-16 05:23:31 +0000
commit46d5dd9b058f31637f2449b2925f13a5707d126d (patch)
tree89dd5bb9b5733ce3f606c74c45a9fa35ace97bee /include
parent76b67df11e5cdb87e954a0ad7d1cd7fd4a502be1 (diff)
Use the Attributes::get method which takes an AttrVal value directly to simplify the code a bit. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Function.h12
-rw-r--r--include/llvm/Instructions.h55
2 files changed, 25 insertions, 42 deletions
diff --git a/include/llvm/Function.h b/include/llvm/Function.h
index 26b148d848a..e211e9ab52a 100644
--- a/include/llvm/Function.h
+++ b/include/llvm/Function.h
@@ -178,9 +178,7 @@ public:
///
void addFnAttr(Attributes::AttrVal N) {
// Function Attributes are stored at ~0 index
- AttrBuilder B;
- B.addAttribute(N);
- addAttribute(~0U, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), N));
}
/// removeFnAttr - Remove function attributes from this function.
@@ -278,9 +276,7 @@ public:
return getParamAttributes(n).hasAttribute(Attributes::NoAlias);
}
void setDoesNotAlias(unsigned n) {
- AttrBuilder B;
- B.addAttribute(Attributes::NoAlias);
- addAttribute(n, Attributes::get(getContext(), B));
+ addAttribute(n, Attributes::get(getContext(), Attributes::NoAlias));
}
/// @brief Determine if the parameter can be captured.
@@ -289,9 +285,7 @@ public:
return getParamAttributes(n).hasAttribute(Attributes::NoCapture);
}
void setDoesNotCapture(unsigned n) {
- AttrBuilder B;
- B.addAttribute(Attributes::NoCapture);
- addAttribute(n, Attributes::get(getContext(), B));
+ addAttribute(n, Attributes::get(getContext(), Attributes::NoCapture));
}
/// copyAttributesFrom - copy all additional attributes (those not needed to
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 97612b6f850..40dbbaabe69 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -1281,9 +1281,8 @@ public:
/// @brief Return true if the call should not be inlined.
bool isNoInline() const { return hasFnAttr(Attributes::NoInline); }
void setIsNoInline() {
- AttrBuilder B;
- B.addAttribute(Attributes::NoInline);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::NoInline));
}
/// @brief Return true if the call can return twice
@@ -1291,9 +1290,8 @@ public:
return hasFnAttr(Attributes::ReturnsTwice);
}
void setCanReturnTwice() {
- AttrBuilder B;
- B.addAttribute(Attributes::ReturnsTwice);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::ReturnsTwice));
}
/// @brief Determine if the call does not access memory.
@@ -1301,9 +1299,8 @@ public:
return hasFnAttr(Attributes::ReadNone);
}
void setDoesNotAccessMemory() {
- AttrBuilder B;
- B.addAttribute(Attributes::ReadNone);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::ReadNone));
}
/// @brief Determine if the call does not access or only reads memory.
@@ -1311,25 +1308,22 @@ public:
return doesNotAccessMemory() || hasFnAttr(Attributes::ReadOnly);
}
void setOnlyReadsMemory() {
- AttrBuilder B;
- B.addAttribute(Attributes::ReadOnly);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::ReadOnly));
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); }
void setDoesNotReturn() {
- AttrBuilder B;
- B.addAttribute(Attributes::NoReturn);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::NoReturn));
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const { return hasFnAttr(Attributes::NoUnwind); }
void setDoesNotThrow() {
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::NoUnwind));
}
/// @brief Determine if the call returns a structure through first
@@ -3036,9 +3030,8 @@ public:
/// @brief Return true if the call should not be inlined.
bool isNoInline() const { return hasFnAttr(Attributes::NoInline); }
void setIsNoInline() {
- AttrBuilder B;
- B.addAttribute(Attributes::NoInline);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::NoInline));
}
/// @brief Determine if the call does not access memory.
@@ -3046,9 +3039,8 @@ public:
return hasFnAttr(Attributes::ReadNone);
}
void setDoesNotAccessMemory() {
- AttrBuilder B;
- B.addAttribute(Attributes::ReadNone);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::ReadNone));
}
/// @brief Determine if the call does not access or only reads memory.
@@ -3056,25 +3048,22 @@ public:
return doesNotAccessMemory() || hasFnAttr(Attributes::ReadOnly);
}
void setOnlyReadsMemory() {
- AttrBuilder B;
- B.addAttribute(Attributes::ReadOnly);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::ReadOnly));
}
/// @brief Determine if the call cannot return.
bool doesNotReturn() const { return hasFnAttr(Attributes::NoReturn); }
void setDoesNotReturn() {
- AttrBuilder B;
- B.addAttribute(Attributes::NoReturn);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::NoReturn));
}
/// @brief Determine if the call cannot unwind.
bool doesNotThrow() const { return hasFnAttr(Attributes::NoUnwind); }
void setDoesNotThrow() {
- AttrBuilder B;
- B.addAttribute(Attributes::NoUnwind);
- addAttribute(AttrListPtr::FunctionIndex, Attributes::get(getContext(), B));
+ addAttribute(AttrListPtr::FunctionIndex,
+ Attributes::get(getContext(), Attributes::NoUnwind));
}
/// @brief Determine if the call returns a structure through first