From 328d1b65002e68ae65ffef05eed19122cbf721f5 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Sat, 2 Mar 2013 01:20:18 +0000 Subject: Modify {Call,Invoke}Inst::addAttribute to take an AttrKind. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176397 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/Instructions.cpp | 13 ++++--------- lib/Transforms/Utils/SimplifyLibCalls.cpp | 3 +-- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/IR/Instructions.cpp b/lib/IR/Instructions.cpp index 8a0a465..2e3a525 100644 --- a/lib/IR/Instructions.cpp +++ b/lib/IR/Instructions.cpp @@ -331,12 +331,9 @@ CallInst::CallInst(const CallInst &CI) SubclassOptionalData = CI.SubclassOptionalData; } -void CallInst::addAttribute(unsigned i, Attribute attr) { +void CallInst::addAttribute(unsigned i, Attribute::AttrKind attr) { AttributeSet PAL = getAttributes(); - AttrBuilder B(attr); - LLVMContext &Context = getContext(); - PAL = PAL.addAttributes(Context, i, - AttributeSet::get(Context, i, B)); + PAL = PAL.addAttribute(getContext(), i, attr); setAttributes(PAL); } @@ -593,11 +590,9 @@ bool InvokeInst::paramHasAttr(unsigned i, Attribute::AttrKind A) const { return false; } -void InvokeInst::addAttribute(unsigned i, Attribute attr) { +void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind attr) { AttributeSet PAL = getAttributes(); - AttrBuilder B(attr); - PAL = PAL.addAttributes(getContext(), i, - AttributeSet::get(getContext(), i, B)); + PAL = PAL.addAttribute(getContext(), i, attr); setAttributes(PAL); } diff --git a/lib/Transforms/Utils/SimplifyLibCalls.cpp b/lib/Transforms/Utils/SimplifyLibCalls.cpp index 9b39bf4..8ff87ee 100644 --- a/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -798,8 +798,7 @@ struct StrToOpt : public LibCallOptimization { if (isa(EndPtr)) { // With a null EndPtr, this function won't capture the main argument. // It would be readonly too, except that it still may write to errno. - CI->addAttribute(1, Attribute::get(Callee->getContext(), - Attribute::NoCapture)); + CI->addAttribute(1, Attribute::NoCapture); } return 0; -- cgit v1.1