diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index e8d99e2f5a..15db9fd305 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -990,7 +990,8 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, SRETAttrs.addAttribute(llvm::Attributes::InReg); PAL.push_back(llvm:: AttributeWithIndex::get(Index, - llvm::Attributes::get(SRETAttrs))); + llvm::Attributes::get(getLLVMContext(), + SRETAttrs))); ++Index; // sret disables readnone and readonly @@ -1006,7 +1007,8 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, if (RetAttrs.hasAttributes()) PAL.push_back(llvm:: AttributeWithIndex::get(0, - llvm::Attributes::get(RetAttrs))); + llvm::Attributes::get(getLLVMContext(), + RetAttrs))); for (CGFunctionInfo::const_arg_iterator it = FI.arg_begin(), ie = FI.arg_end(); it != ie; ++it) { @@ -1039,7 +1041,8 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, if (Attrs.hasAttributes()) for (unsigned I = 0; I < Extra; ++I) PAL.push_back(llvm::AttributeWithIndex::get(Index + I, - llvm::Attributes::get(Attrs))); + llvm::Attributes::get(getLLVMContext(), + Attrs))); Index += Extra; } break; @@ -1072,12 +1075,14 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, if (Attrs.hasAttributes()) PAL.push_back(llvm::AttributeWithIndex::get(Index, - llvm::Attributes::get(Attrs))); + llvm::Attributes::get(getLLVMContext(), + Attrs))); ++Index; } if (FuncAttrs.hasAttributes()) PAL.push_back(llvm::AttributeWithIndex::get(~0, - llvm::Attributes::get(FuncAttrs))); + llvm::Attributes::get(getLLVMContext(), + FuncAttrs))); } /// An argument came in as a promoted argument; demote it back to its @@ -1127,7 +1132,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, AI->setName("agg.result"); llvm::Attributes::Builder B; B.addAttribute(llvm::Attributes::NoAlias); - AI->addAttr(llvm::Attributes::get(B)); + AI->addAttr(llvm::Attributes::get(getLLVMContext(), B)); ++AI; } @@ -1199,7 +1204,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, if (Arg->getType().isRestrictQualified()) { llvm::Attributes::Builder B; B.addAttribute(llvm::Attributes::NoAlias); - AI->addAttr(llvm::Attributes::get(B)); + AI->addAttr(llvm::Attributes::get(getLLVMContext(), B)); } // Ensure the argument is the correct type. diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index ec521a988b..c62b1b1073 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -2087,7 +2087,8 @@ void CodeGenFunction::EmitCheck(llvm::Value *Checked, StringRef CheckName, .addAttribute(llvm::Attributes::UWTable); llvm::Value *Fn = CGM.CreateRuntimeFunction(FnType, ("__ubsan_handle_" + CheckName).str(), - llvm::Attributes::get(B)); + llvm::Attributes::get(getLLVMContext(), + B)); llvm::CallInst *HandlerCall = Builder.CreateCall(Fn, Args); HandlerCall->setDoesNotReturn(); HandlerCall->setDoesNotThrow(); diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 22ea521f8e..749d9d4b04 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -68,7 +68,8 @@ private: return CGM.CreateRuntimeFunction(llvm::FunctionType::get(ObjectPtrTy, params, true), "objc_msgSend", - llvm::Attributes::get(B)); + llvm::Attributes::get(CGM.getLLVMContext(), + B)); } /// void objc_msgSend_stret (id, SEL, ...) @@ -587,7 +588,8 @@ public: return CGM.CreateRuntimeFunction(llvm::FunctionType::get(CGM.Int32Ty, params, false), "_setjmp", - llvm::Attributes::get(B)); + llvm::Attributes::get(CGM.getLLVMContext(), + B)); } public: diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 41a96e82e2..3b28a61939 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -1634,7 +1634,7 @@ void CodeGenFunction::EmitAsmStmt(const AsmStmt &S) { llvm::CallInst *Result = Builder.CreateCall(IA, Args); llvm::Attributes::Builder B; B.addAttribute(llvm::Attributes::NoUnwind); - Result->addAttribute(~0, llvm::Attributes::get(B)); + Result->addAttribute(~0, llvm::Attributes::get(getLLVMContext(), B)); // 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/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 7e688585d0..073b59ef8d 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -646,7 +646,8 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, if (unsigned IID = F->getIntrinsicID()) { // If this is an intrinsic function, set the function's attributes // to the intrinsic's attributes. - F->setAttributes(llvm::Intrinsic::getAttributes((llvm::Intrinsic::ID)IID)); + F->setAttributes(llvm::Intrinsic::getAttributes(getLLVMContext(), + (llvm::Intrinsic::ID)IID)); return; } diff --git a/lib/CodeGen/ItaniumCXXABI.cpp b/lib/CodeGen/ItaniumCXXABI.cpp index 4d944301d2..42ca81e6a6 100644 --- a/lib/CodeGen/ItaniumCXXABI.cpp +++ b/lib/CodeGen/ItaniumCXXABI.cpp @@ -953,7 +953,8 @@ static llvm::Constant *getGuardAcquireFn(CodeGenModule &CGM, llvm::Attributes::Builder B; B.addAttribute(llvm::Attributes::NoUnwind); return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_acquire", - llvm::Attributes::get(B)); + llvm::Attributes::get(CGM.getLLVMContext(), + B)); } static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM, @@ -964,7 +965,8 @@ static llvm::Constant *getGuardReleaseFn(CodeGenModule &CGM, llvm::Attributes::Builder B; B.addAttribute(llvm::Attributes::NoUnwind); return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_release", - llvm::Attributes::get(B)); + llvm::Attributes::get(CGM.getLLVMContext(), + B)); } static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM, @@ -975,7 +977,8 @@ static llvm::Constant *getGuardAbortFn(CodeGenModule &CGM, llvm::Attributes::Builder B; B.addAttribute(llvm::Attributes::NoUnwind); return CGM.CreateRuntimeFunction(FTy, "__cxa_guard_abort", - llvm::Attributes::get(B)); + llvm::Attributes::get(CGM.getLLVMContext(), + B)); } namespace { diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index d84d57c2bb..497adcd753 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -970,7 +970,7 @@ void X86_32TargetCodeGenInfo::SetTargetAttributes(const Decl *D, // Now add the 'alignstack' attribute with a value of 16. llvm::Attributes::Builder B; B.addStackAlignmentAttr(16); - Fn->addAttribute(~0U, llvm::Attributes::get(B)); + Fn->addAttribute(~0U, llvm::Attributes::get(CGM.getLLVMContext(), B)); } } }