mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-06 02:29:51 +00:00
Add a way to add a kind-value string pair to an attribute.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187138 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4c9d299d80
commit
9e2ef7780b
@ -250,6 +250,8 @@ public:
|
||||
/// attribute sets are immutable, this returns a new set.
|
||||
AttributeSet addAttribute(LLVMContext &C, unsigned Index,
|
||||
StringRef Kind) const;
|
||||
AttributeSet addAttribute(LLVMContext &C, unsigned Index,
|
||||
StringRef Kind, StringRef Value) const;
|
||||
|
||||
/// \brief Add attributes to the attribute set at the given index. Since
|
||||
/// attribute sets are immutable, this returns a new set.
|
||||
|
@ -190,6 +190,11 @@ public:
|
||||
AttributeSets.addAttribute(getContext(),
|
||||
AttributeSet::FunctionIndex, Kind));
|
||||
}
|
||||
void addFnAttr(StringRef Kind, StringRef Value) {
|
||||
setAttributes(
|
||||
AttributeSets.addAttribute(getContext(),
|
||||
AttributeSet::FunctionIndex, Kind, Value));
|
||||
}
|
||||
|
||||
/// @brief Return true if the function has the attribute.
|
||||
bool hasFnAttribute(Attribute::AttrKind Kind) const {
|
||||
|
@ -645,6 +645,13 @@ AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
|
||||
return addAttributes(C, Index, AttributeSet::get(C, Index, B));
|
||||
}
|
||||
|
||||
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Index,
|
||||
StringRef Kind, StringRef Value) const {
|
||||
llvm::AttrBuilder B;
|
||||
B.addAttribute(Kind, Value);
|
||||
return addAttributes(C, Index, AttributeSet::get(C, Index, B));
|
||||
}
|
||||
|
||||
AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Index,
|
||||
AttributeSet Attrs) const {
|
||||
if (!pImpl) return Attrs;
|
||||
|
Loading…
x
Reference in New Issue
Block a user