From: Bill Wendling Date: Tue, 16 Oct 2012 05:23:44 +0000 (+0000) Subject: Use the Attributes::get method which takes an AttrVal value directly to simplify... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6375560645177168099f1a1d96be8fa4718aa8e;p=clang 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/cfe/trunk@166010 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 629c01d9f3..a8483d70b2 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -1131,9 +1131,8 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, // Name the struct return argument. if (CGM.ReturnTypeUsesSRet(FI)) { AI->setName("agg.result"); - llvm::AttrBuilder B; - B.addAttribute(llvm::Attributes::NoAlias); - AI->addAttr(llvm::Attributes::get(getLLVMContext(), B)); + AI->addAttr(llvm::Attributes::get(getLLVMContext(), + llvm::Attributes::NoAlias)); ++AI; } @@ -1202,11 +1201,9 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, assert(AI != Fn->arg_end() && "Argument mismatch!"); llvm::Value *V = AI; - if (Arg->getType().isRestrictQualified()) { - llvm::AttrBuilder B; - B.addAttribute(llvm::Attributes::NoAlias); - AI->addAttr(llvm::Attributes::get(getLLVMContext(), B)); - } + if (Arg->getType().isRestrictQualified()) + AI->addAttr(llvm::Attributes::get(getLLVMContext(), + llvm::Attributes::NoAlias)); // Ensure the argument is the correct type. if (V->getType() != ArgI.getCoerceToType()) diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index c89171db55..4a165ce46e 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -63,13 +63,11 @@ private: // Add the non-lazy-bind attribute, since objc_msgSend is likely to // be called a lot. llvm::Type *params[] = { ObjectPtrTy, SelectorPtrTy }; - llvm::AttrBuilder B; - B.addAttribute(llvm::Attributes::NonLazyBind); return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, params, true), "objc_msgSend", llvm::Attributes::get(CGM.getLLVMContext(), - B)); + llvm::Attributes::NonLazyBind)); } /// void objc_msgSend_stret (id, SEL, ...) @@ -583,13 +581,11 @@ public: llvm::Constant *getSetJmpFn() { // This is specifically the prototype for x86. llvm::Type *params[] = { CGM.Int32Ty->getPointerTo() }; - llvm::AttrBuilder B; - B.addAttribute(llvm::Attributes::NonLazyBind); return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty, params, false), "_setjmp", llvm::Attributes::get(CGM.getLLVMContext(), - B)); + llvm::Attributes::NonLazyBind)); } public: diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index dc441d9c5b..7c65b3c437 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -1632,10 +1632,9 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { llvm::InlineAsm::get(FTy, AsmString, Constraints, HasSideEffect, /* IsAlignStack */ false, AsmDialect); llvm::CallInst *Result = Builder.CreateCall(IA, Args); - llvm::AttrBuilder B; - B.addAttribute(llvm::Attributes::NoUnwind); Result->addAttribute(llvm::AttrListPtr::FunctionIndex, - llvm::Attributes::get(getLLVMContext(), B)); + llvm::Attributes::get(getLLVMContext(), + llvm::Attributes::NoUnwind)); // Slap the source location of the inline asm into a !srcloc metadata on the // call. FIXME: Handle metadata for MS-style inline asms. diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index bb63cb33ba..674a97d88c 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -950,11 +950,9 @@ static llvm::Constant *getGuardAcquireFn(CodeGenModule &CGM, llvm::FunctionType *FTy = llvm::FunctionType::get(CGM.getTypes().ConvertType(CGM.getContext().IntTy), GuardPtrTy, /*isVarArg=*/false); - llvm::AttrBuilder B; - B.addAttribute(llvm::Attributes::NoUnwind); return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_acquire", llvm::Attributes::get(CGM.getLLVMContext(), - B)); + llvm::Attributes::NoUnwind)); } static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM, @@ -962,11 +960,9 @@ static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM, // void __cxa_guard_release(__guard *guard_object); llvm::FunctionType *FTy = llvm::FunctionType::get(CGM.VoidTy, GuardPtrTy, /*isVarArg=*/false); - llvm::AttrBuilder B; - B.addAttribute(llvm::Attributes::NoUnwind); return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_release", llvm::Attributes::get(CGM.getLLVMContext(), - B)); + llvm::Attributes::NoUnwind)); } static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM, @@ -974,11 +970,9 @@ static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM, // void __cxa_guard_abort(__guard *guard_object); llvm::FunctionType *FTy = llvm::FunctionType::get(CGM.VoidTy, GuardPtrTy, /*isVarArg=*/false); - llvm::AttrBuilder B; - B.addAttribute(llvm::Attributes::NoUnwind); return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_abort", llvm::Attributes::get(CGM.getLLVMContext(), - B)); + llvm::Attributes::NoUnwind)); } namespace {