diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-15 07:29:08 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-15 07:29:08 +0000 |
commit | 07aae2e7d58fe23e370e0cbb9e1a3def99434c36 (patch) | |
tree | 9961bc6b914ce55768f0ea5d168fb892894ca9db /lib/VMCore | |
parent | ad4643f54ba52d1f93426a9853934df8ce3271a0 (diff) |
Add an enum for the return and function indexes into the AttrListPtr object. This gets rid of some magic numbers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/Core.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/Instructions.cpp | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index 6643ad6e9a4..9eb7e10840a 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -1383,7 +1383,7 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) { const AttrListPtr PAL = Func->getAttributes(); Attributes::Builder B(PA); const AttrListPtr PALnew = - PAL.addAttr(Func->getContext(), ~0U, + PAL.addAttr(Func->getContext(), AttrListPtr::FunctionIndex, Attributes::get(Func->getContext(), B)); Func->setAttributes(PALnew); } @@ -1393,7 +1393,7 @@ void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) { const AttrListPtr PAL = Func->getAttributes(); Attributes::Builder B(PA); const AttrListPtr PALnew = - PAL.removeAttr(Func->getContext(), ~0U, + PAL.removeAttr(Func->getContext(), AttrListPtr::FunctionIndex, Attributes::get(Func->getContext(), B)); Func->setAttributes(PALnew); } diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index e807edc5126..13c4a5d2574 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -343,10 +343,11 @@ void CallInst::removeAttribute(unsigned i, Attributes attr) { } bool CallInst::hasFnAttr(Attributes::AttrVal A) const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(A)) + if (AttributeList.getParamAttributes(AttrListPtr::FunctionIndex) + .hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(A); + return F->getParamAttributes(AttrListPtr::FunctionIndex).hasAttribute(A); return false; } @@ -571,10 +572,11 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) { } bool InvokeInst::hasFnAttr(Attributes::AttrVal A) const { - if (AttributeList.getParamAttributes(~0U).hasAttribute(A)) + if (AttributeList.getParamAttributes(AttrListPtr::FunctionIndex). + hasAttribute(A)) return true; if (const Function *F = getCalledFunction()) - return F->getParamAttributes(~0U).hasAttribute(A); + return F->getParamAttributes(AttrListPtr::FunctionIndex).hasAttribute(A); return false; } |