diff options
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
| -rw-r--r-- | llvm/lib/IR/Attributes.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 3675bad2fb0..b470fac5782 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -807,6 +807,14 @@ AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, return get(C, Attrs); } +AttributeSet AttributeSet::get(LLVMContext &C, unsigned Index, + ArrayRef<StringRef> Kinds) { + SmallVector<std::pair<unsigned, Attribute>, 8> Attrs; + for (StringRef K : Kinds) + Attrs.push_back(std::make_pair(Index, Attribute::get(C, K))); + return get(C, Attrs); +} + AttributeSet AttributeSet::get(LLVMContext &C, ArrayRef<AttributeSet> Attrs) { if (Attrs.empty()) return AttributeSet(); if (Attrs.size() == 1) return Attrs[0]; @@ -935,6 +943,12 @@ AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Index, return removeAttributes(C, Index, AttributeSet::get(C, Index, Kind)); } +AttributeSet AttributeSet::removeAttribute(LLVMContext &C, unsigned Index, + StringRef Kind) const { + if (!hasAttribute(Index, Kind)) return *this; + return removeAttributes(C, Index, AttributeSet::get(C, Index, Kind)); +} + AttributeSet AttributeSet::removeAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const { if (!pImpl) return AttributeSet(); |

