diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-01-22 21:15:51 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-01-22 21:15:51 +0000 |
commit | defaca00b8087d452df2b783250a48a32658a910 (patch) | |
tree | dcc4e29343864e54bcfd33035512ca7d6e2bef74 /lib/Transforms | |
parent | 5de048ec30f9ef9f56c89f9fdb50022beca6ae88 (diff) |
More encapsulation work.
Use the AttributeSet when we're talking about more than one attribute. Add a
function that adds a single attribute. No functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/PruneEH.cpp | 8 | ||||
-rw-r--r-- | lib/Transforms/Scalar/ObjCARC.cpp | 38 |
2 files changed, 24 insertions, 22 deletions
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp index d872f0cfba..98c2602dde 100644 --- a/lib/Transforms/IPO/PruneEH.cpp +++ b/lib/Transforms/IPO/PruneEH.cpp @@ -146,9 +146,11 @@ bool PruneEH::runOnSCC(CallGraphSCC &SCC) { Function *F = (*I)->getFunction(); const AttributeSet &PAL = F->getAttributes(); - const AttributeSet &NPAL = PAL.addAttr(F->getContext(), ~0, - Attribute::get(F->getContext(), - NewAttributes)); + const AttributeSet &NPAL = + PAL.addFnAttributes(F->getContext(), + AttributeSet::get(F->getContext(), + AttributeSet::FunctionIndex, + NewAttributes)); if (PAL != NPAL) { MadeChange = true; F->setAttributes(NPAL); diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp index a63e0e0f44..1c054f9b0b 100644 --- a/lib/Transforms/Scalar/ObjCARC.cpp +++ b/lib/Transforms/Scalar/ObjCARC.cpp @@ -1914,8 +1914,8 @@ Constant *ObjCARCOpt::getRetainRVCallee(Module *M) { Type *Params[] = { I8X }; FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false); AttributeSet Attribute = - AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex, - Attribute::get(C, Attribute::NoUnwind)); + AttributeSet().addAttribute(M->getContext(), AttributeSet::FunctionIndex, + Attribute::NoUnwind); RetainRVCallee = M->getOrInsertFunction("objc_retainAutoreleasedReturnValue", FTy, Attribute); @@ -1930,8 +1930,8 @@ Constant *ObjCARCOpt::getAutoreleaseRVCallee(Module *M) { Type *Params[] = { I8X }; FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false); AttributeSet Attribute = - AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex, - Attribute::get(C, Attribute::NoUnwind)); + AttributeSet().addAttribute(M->getContext(), AttributeSet::FunctionIndex, + Attribute::NoUnwind); AutoreleaseRVCallee = M->getOrInsertFunction("objc_autoreleaseReturnValue", FTy, Attribute); @@ -1944,8 +1944,8 @@ Constant *ObjCARCOpt::getReleaseCallee(Module *M) { LLVMContext &C = M->getContext(); Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) }; AttributeSet Attribute = - AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex, - Attribute::get(C, Attribute::NoUnwind)); + AttributeSet().addAttribute(M->getContext(), AttributeSet::FunctionIndex, + Attribute::NoUnwind); ReleaseCallee = M->getOrInsertFunction( "objc_release", @@ -1960,8 +1960,8 @@ Constant *ObjCARCOpt::getRetainCallee(Module *M) { LLVMContext &C = M->getContext(); Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) }; AttributeSet Attribute = - AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex, - Attribute::get(C, Attribute::NoUnwind)); + AttributeSet().addAttribute(M->getContext(), AttributeSet::FunctionIndex, + Attribute::NoUnwind); RetainCallee = M->getOrInsertFunction( "objc_retain", @@ -1991,8 +1991,8 @@ Constant *ObjCARCOpt::getAutoreleaseCallee(Module *M) { LLVMContext &C = M->getContext(); Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) }; AttributeSet Attribute = - AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex, - Attribute::get(C, Attribute::NoUnwind)); + AttributeSet().addAttribute(M->getContext(), AttributeSet::FunctionIndex, + Attribute::NoUnwind); AutoreleaseCallee = M->getOrInsertFunction( "objc_autorelease", @@ -4105,16 +4105,16 @@ Constant *ObjCARCContract::getStoreStrongCallee(Module *M) { Type *I8XX = PointerType::getUnqual(I8X); Type *Params[] = { I8XX, I8X }; - AttributeSet Attribute = AttributeSet() - .addAttr(M->getContext(), AttributeSet::FunctionIndex, - Attribute::get(C, Attribute::NoUnwind)) - .addAttr(M->getContext(), 1, Attribute::get(C, Attribute::NoCapture)); + AttributeSet Attr = AttributeSet() + .addAttribute(M->getContext(), AttributeSet::FunctionIndex, + Attribute::NoUnwind) + .addAttribute(M->getContext(), 1, Attribute::NoCapture); StoreStrongCallee = M->getOrInsertFunction( "objc_storeStrong", FunctionType::get(Type::getVoidTy(C), Params, /*isVarArg=*/false), - Attribute); + Attr); } return StoreStrongCallee; } @@ -4126,8 +4126,8 @@ Constant *ObjCARCContract::getRetainAutoreleaseCallee(Module *M) { Type *Params[] = { I8X }; FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false); AttributeSet Attribute = - AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex, - Attribute::get(C, Attribute::NoUnwind)); + AttributeSet().addAttribute(M->getContext(), AttributeSet::FunctionIndex, + Attribute::NoUnwind); RetainAutoreleaseCallee = M->getOrInsertFunction("objc_retainAutorelease", FTy, Attribute); } @@ -4141,8 +4141,8 @@ Constant *ObjCARCContract::getRetainAutoreleaseRVCallee(Module *M) { Type *Params[] = { I8X }; FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false); AttributeSet Attribute = - AttributeSet().addAttr(M->getContext(), AttributeSet::FunctionIndex, - Attribute::get(C, Attribute::NoUnwind)); + AttributeSet().addAttribute(M->getContext(), AttributeSet::FunctionIndex, + Attribute::NoUnwind); RetainAutoreleaseRVCallee = M->getOrInsertFunction("objc_retainAutoreleaseReturnValue", FTy, Attribute); |