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.
llvm-svn: 173196
diff --git a/llvm/lib/Transforms/Scalar/ObjCARC.cpp b/llvm/lib/Transforms/Scalar/ObjCARC.cpp
index a63e0e0..1c054f9 100644
--- a/llvm/lib/Transforms/Scalar/ObjCARC.cpp
+++ b/llvm/lib/Transforms/Scalar/ObjCARC.cpp
@@ -1914,8 +1914,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);