void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; }
/// addAttribute - adds the attribute to the list of attributes.
- void addAttribute(unsigned i, Attribute attr);
+ void addAttribute(unsigned i, Attribute::AttrKind attr);
/// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attribute attr);
/// \brief Return true if the call should not be inlined.
bool isNoInline() const { return hasFnAttr(Attribute::NoInline); }
void setIsNoInline() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::NoInline));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::NoInline);
}
/// \brief Return true if the call can return twice
return hasFnAttr(Attribute::ReturnsTwice);
}
void setCanReturnTwice() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::ReturnsTwice));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::ReturnsTwice);
}
/// \brief Determine if the call does not access memory.
return hasFnAttr(Attribute::ReadNone);
}
void setDoesNotAccessMemory() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::ReadNone));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone);
}
/// \brief Determine if the call does not access or only reads memory.
return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly);
}
void setOnlyReadsMemory() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::ReadOnly));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly);
}
/// \brief Determine if the call cannot return.
bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); }
void setDoesNotReturn() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::NoReturn));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::NoReturn);
}
/// \brief Determine if the call cannot unwind.
bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); }
void setDoesNotThrow() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::NoUnwind));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind);
}
/// \brief Determine if the call cannot be duplicated.
bool cannotDuplicate() const {return hasFnAttr(Attribute::NoDuplicate); }
void setCannotDuplicate() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::NoDuplicate));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::NoDuplicate);
}
/// \brief Determine if the call returns a structure through first
void setAttributes(const AttributeSet &Attrs) { AttributeList = Attrs; }
/// addAttribute - adds the attribute to the list of attributes.
- void addAttribute(unsigned i, Attribute attr);
+ void addAttribute(unsigned i, Attribute::AttrKind attr);
/// removeAttribute - removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attribute attr);
/// \brief Return true if the call should not be inlined.
bool isNoInline() const { return hasFnAttr(Attribute::NoInline); }
void setIsNoInline() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::NoInline));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::NoInline);
}
/// \brief Determine if the call does not access memory.
return hasFnAttr(Attribute::ReadNone);
}
void setDoesNotAccessMemory() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::ReadNone));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::ReadNone);
}
/// \brief Determine if the call does not access or only reads memory.
return doesNotAccessMemory() || hasFnAttr(Attribute::ReadOnly);
}
void setOnlyReadsMemory() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::ReadOnly));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::ReadOnly);
}
/// \brief Determine if the call cannot return.
bool doesNotReturn() const { return hasFnAttr(Attribute::NoReturn); }
void setDoesNotReturn() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::NoReturn));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::NoReturn);
}
/// \brief Determine if the call cannot unwind.
bool doesNotThrow() const { return hasFnAttr(Attribute::NoUnwind); }
void setDoesNotThrow() {
- addAttribute(AttributeSet::FunctionIndex,
- Attribute::get(getContext(), Attribute::NoUnwind));
+ addAttribute(AttributeSet::FunctionIndex, Attribute::NoUnwind);
}
/// \brief Determine if the call returns a structure through first
SubclassOptionalData = CI.SubclassOptionalData;
}
-void CallInst::addAttribute(unsigned i, Attribute attr) {
+void CallInst::addAttribute(unsigned i, Attribute::AttrKind attr) {
AttributeSet PAL = getAttributes();
- AttrBuilder B(attr);
- LLVMContext &Context = getContext();
- PAL = PAL.addAttributes(Context, i,
- AttributeSet::get(Context, i, B));
+ PAL = PAL.addAttribute(getContext(), i, attr);
setAttributes(PAL);
}
return false;
}
-void InvokeInst::addAttribute(unsigned i, Attribute attr) {
+void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind attr) {
AttributeSet PAL = getAttributes();
- AttrBuilder B(attr);
- PAL = PAL.addAttributes(getContext(), i,
- AttributeSet::get(getContext(), i, B));
+ PAL = PAL.addAttribute(getContext(), i, attr);
setAttributes(PAL);
}