1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Add some additonal attribute helper functions. Test will be on follow

up putback to clang for mips16.

llvm-svn: 176968
This commit is contained in:
Reed Kotler 2013-03-13 20:20:08 +00:00
parent 44444f0162
commit 6f984e6349
3 changed files with 20 additions and 0 deletions

View File

@ -247,6 +247,11 @@ public:
AttributeSet addAttribute(LLVMContext &C, unsigned Idx,
Attribute::AttrKind Attr) const;
/// \brief Add an attribute to the attribute set at the given index. Since
/// attribute sets are immutable, this returns a new set.
AttributeSet addAttribute(LLVMContext &C, unsigned Idx,
StringRef Kind) const;
/// \brief Add attributes to the attribute set at the given index. Since
/// attribute sets are immutable, this returns a new set.
AttributeSet addAttributes(LLVMContext &C, unsigned Idx,

View File

@ -181,6 +181,14 @@ public:
AttributeSet::FunctionIndex, N));
}
/// addFnAttr - Add function attributes to this function.
///
void addFnAttr(StringRef Kind) {
setAttributes(
AttributeSets.addAttribute(getContext(),
AttributeSet::FunctionIndex, Kind));
}
/// \brief Return true if the function has the attribute.
bool hasFnAttribute(Attribute::AttrKind Kind) const {
return AttributeSets.hasAttribute(AttributeSet::FunctionIndex, Kind);

View File

@ -649,6 +649,13 @@ AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Idx,
return addAttributes(C, Idx, AttributeSet::get(C, Idx, Attr));
}
AttributeSet AttributeSet::addAttribute(LLVMContext &C, unsigned Idx,
StringRef Kind) const {
llvm::AttrBuilder B;
B.addAttribute(Kind);
return addAttributes(C, Idx, AttributeSet::get(C, Idx, B));
}
AttributeSet AttributeSet::addAttributes(LLVMContext &C, unsigned Idx,
AttributeSet Attrs) const {
if (!pImpl) return Attrs;