}
Attributes operator & (const Attributes &A) const;
- Attributes &operator |= (const Attributes &A);
Attributes &operator &= (const Attributes &A);
uint64_t Raw() const;
/// addAttr - Add the specified attribute at the specified index to this
/// attribute list. Since attribute lists are immutable, this
/// returns the new list.
- AttrListPtr addAttr(unsigned Idx, Attributes Attrs) const;
+ AttrListPtr addAttr(LLVMContext &C, unsigned Idx, Attributes Attrs) const;
/// removeAttr - Remove the specified attribute at the specified index from
/// this attribute list. Since attribute lists are immutable, this
Function *F = (*I)->getFunction();
const AttrListPtr &PAL = F->getAttributes();
- const AttrListPtr &NPAL = PAL.addAttr(~0, Attributes::get(NewAttributes));
+ const AttrListPtr &NPAL = PAL.addAttr(F->getContext(), ~0,
+ Attributes::get(NewAttributes));
if (PAL != NPAL) {
MadeChange = true;
F->setAttributes(NPAL);
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
+ AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u,
+ Attributes::get(B));
RetainRVCallee =
M->getOrInsertFunction("objc_retainAutoreleasedReturnValue", FTy,
Attributes);
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
+ AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u,
+ Attributes::get(B));
AutoreleaseRVCallee =
M->getOrInsertFunction("objc_autoreleaseReturnValue", FTy,
Attributes);
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
+ AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u,
+ Attributes::get(B));
ReleaseCallee =
M->getOrInsertFunction(
"objc_release",
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
+ AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u,
+ Attributes::get(B));
RetainCallee =
M->getOrInsertFunction(
"objc_retain",
Type *Params[] = { PointerType::getUnqual(Type::getInt8Ty(C)) };
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
+ AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u,
+ Attributes::get(B));
AutoreleaseCallee =
M->getOrInsertFunction(
"objc_autorelease",
Attributes::Builder BNoCapture;
BNoCapture.addAttribute(Attributes::NoCapture);
AttrListPtr Attributes = AttrListPtr()
- .addAttr(~0u, Attributes::get(BNoUnwind))
- .addAttr(1, Attributes::get(BNoCapture));
+ .addAttr(M->getContext(), ~0u, Attributes::get(BNoUnwind))
+ .addAttr(M->getContext(), 1, Attributes::get(BNoCapture));
StoreStrongCallee =
M->getOrInsertFunction(
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
+ AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u,
+ Attributes::get(B));
RetainAutoreleaseCallee =
M->getOrInsertFunction("objc_retainAutorelease", FTy, Attributes);
}
FunctionType *FTy = FunctionType::get(I8X, Params, /*isVarArg=*/false);
Attributes::Builder B;
B.addAttribute(Attributes::NoUnwind);
- AttrListPtr Attributes = AttrListPtr().addAttr(~0u, Attributes::get(B));
+ AttrListPtr Attributes = AttrListPtr().addAttr(M->getContext(), ~0u,
+ Attributes::get(B));
RetainAutoreleaseRVCallee =
M->getOrInsertFunction("objc_retainAutoreleaseReturnValue", FTy,
Attributes);
Anew->addAttr( OldFunc->getAttributes()
.getParamAttributes(I->getArgNo() + 1));
NewFunc->setAttributes(NewFunc->getAttributes()
- .addAttr(0, OldFunc->getAttributes()
+ .addAttr(NewFunc->getContext(), 0,
+ OldFunc->getAttributes()
.getRetAttributes()));
NewFunc->setAttributes(NewFunc->getAttributes()
- .addAttr(~0, OldFunc->getAttributes()
+ .addAttr(NewFunc->getContext(), ~0,
+ OldFunc->getAttributes()
.getFnAttributes()));
}
Attributes Attributes::operator & (const Attributes &A) const {
return Attributes(Raw() & A.Raw());
}
-Attributes &Attributes::operator |= (const Attributes &A) {
- Attrs.Bits |= A.Raw();
- return *this;
-}
Attributes &Attributes::operator &= (const Attributes &A) {
Attrs.Bits &= A.Raw();
return *this;
return AttrList->Attrs[i].Attrs;
}
-AttrListPtr AttrListPtr::addAttr(unsigned Idx, Attributes Attrs) const {
+AttrListPtr AttrListPtr::addAttr(LLVMContext &C, unsigned Idx,
+ Attributes Attrs) const {
Attributes OldAttrs = getAttributes(Idx);
#ifndef NDEBUG
// FIXME it is not obvious how this should work for alignment.
// If there are attributes already at this index, merge them in.
if (i != e && OldAttrList[i].Index == Idx) {
- Attrs |= OldAttrList[i].Attrs;
+ Attrs =
+ Attributes::get(C, Attributes::Builder(Attrs).
+ addAttributes(OldAttrList[i].Attrs));
++i;
}
void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA) {
Function *Func = unwrap<Function>(Fn);
const AttrListPtr PAL = Func->getAttributes();
- const AttrListPtr PALnew = PAL.addAttr(~0U, Attributes(PA));
+ const AttrListPtr PALnew = PAL.addAttr(Func->getContext(), ~0U,
+ Attributes(PA));
Func->setAttributes(PALnew);
}
LLVMAttribute PA) {
CallSite Call = CallSite(unwrap<Instruction>(Instr));
Call.setAttributes(
- Call.getAttributes().addAttr(index, Attributes(PA)));
+ Call.getAttributes().addAttr(Call->getContext(), index, Attributes(PA)));
}
void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
CallSite Call = CallSite(unwrap<Instruction>(Instr));
Attributes::Builder B;
B.addAlignmentAttr(align);
- Call.setAttributes(Call.getAttributes().addAttr(index, Attributes::get(B)));
+ Call.setAttributes(Call.getAttributes().addAttr(Call->getContext(), index,
+ Attributes::get(B)));
}
/*--.. Operations on call instructions (only) ..............................--*/
void Function::addAttribute(unsigned i, Attributes attr) {
AttrListPtr PAL = getAttributes();
- PAL = PAL.addAttr(i, attr);
+ PAL = PAL.addAttr(getContext(), i, attr);
setAttributes(PAL);
}
void CallInst::addAttribute(unsigned i, Attributes attr) {
AttrListPtr PAL = getAttributes();
- PAL = PAL.addAttr(i, attr);
+ PAL = PAL.addAttr(getContext(), i, attr);
setAttributes(PAL);
}
void InvokeInst::addAttribute(unsigned i, Attributes attr) {
AttrListPtr PAL = getAttributes();
- PAL = PAL.addAttr(i, attr);
+ PAL = PAL.addAttr(getContext(), i, attr);
setAttributes(PAL);
}