Author: rnk Date: Tue May 2 17:07:37 2017 New Revision: 301981 URL: http://llvm.org/viewvc/llvm-project?rev=301981&view=rev Log: Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"
This time, I fixed, built, and tested clang. This reverts r301712. Modified: cfe/trunk/lib/CodeGen/CGCall.cpp cfe/trunk/lib/CodeGen/CodeGenModule.cpp cfe/trunk/lib/CodeGen/TargetInfo.cpp Modified: cfe/trunk/lib/CodeGen/CGCall.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=301981&r1=301980&r2=301981&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CGCall.cpp (original) +++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue May 2 17:07:37 2017 @@ -1756,9 +1756,7 @@ void CodeGenModule::AddDefaultFnAttrs(ll ConstructDefaultFnAttrList(F.getName(), F.hasFnAttribute(llvm::Attribute::OptimizeNone), /* AttrOnCallsite = */ false, FuncAttrs); - llvm::AttributeList AS = llvm::AttributeList::get( - getLLVMContext(), llvm::AttributeList::FunctionIndex, FuncAttrs); - F.addAttributes(llvm::AttributeList::FunctionIndex, AS); + F.addAttributes(llvm::AttributeList::FunctionIndex, FuncAttrs); } void CodeGenModule::ConstructAttributeList( Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=301981&r1=301980&r2=301981&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue May 2 17:07:37 2017 @@ -892,10 +892,7 @@ void CodeGenModule::SetLLVMFunctionAttri CodeGenOpts.getInlining() == CodeGenOptions::OnlyAlwaysInlining) B.addAttribute(llvm::Attribute::NoInline); - F->addAttributes( - llvm::AttributeList::FunctionIndex, - llvm::AttributeList::get(F->getContext(), - llvm::AttributeList::FunctionIndex, B)); + F->addAttributes(llvm::AttributeList::FunctionIndex, B); return; } @@ -961,9 +958,7 @@ void CodeGenModule::SetLLVMFunctionAttri B.addAttribute(llvm::Attribute::MinSize); } - F->addAttributes(llvm::AttributeList::FunctionIndex, - llvm::AttributeList::get( - F->getContext(), llvm::AttributeList::FunctionIndex, B)); + F->addAttributes(llvm::AttributeList::FunctionIndex, B); unsigned alignment = D->getMaxAlignment() / Context.getCharWidth(); if (alignment) @@ -2029,9 +2024,7 @@ llvm::Constant *CodeGenModule::GetOrCrea SetFunctionAttributes(GD, F, IsIncompleteFunction, IsThunk); if (ExtraAttrs.hasAttributes(llvm::AttributeList::FunctionIndex)) { llvm::AttrBuilder B(ExtraAttrs, llvm::AttributeList::FunctionIndex); - F->addAttributes(llvm::AttributeList::FunctionIndex, - llvm::AttributeList::get( - VMContext, llvm::AttributeList::FunctionIndex, B)); + F->addAttributes(llvm::AttributeList::FunctionIndex, B); } if (!DontDefer) { Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=301981&r1=301980&r2=301981&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Tue May 2 17:07:37 2017 @@ -1901,10 +1901,7 @@ void X86_32TargetCodeGenInfo::setTargetA // Now add the 'alignstack' attribute with a value of 16. llvm::AttrBuilder B; B.addStackAlignmentAttr(16); - Fn->addAttributes( - llvm::AttributeList::FunctionIndex, - llvm::AttributeList::get(CGM.getLLVMContext(), - llvm::AttributeList::FunctionIndex, B)); + Fn->addAttributes(llvm::AttributeList::FunctionIndex, B); } if (FD->hasAttr<AnyX86InterruptAttr>()) { llvm::Function *Fn = cast<llvm::Function>(GV); @@ -5449,10 +5446,7 @@ public: // the backend to perform a realignment as part of the function prologue. llvm::AttrBuilder B; B.addStackAlignmentAttr(8); - Fn->addAttributes( - llvm::AttributeList::FunctionIndex, - llvm::AttributeList::get(CGM.getLLVMContext(), - llvm::AttributeList::FunctionIndex, B)); + Fn->addAttributes(llvm::AttributeList::FunctionIndex, B); } }; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits