[llvm] r187138 - Add a way to add a kind-value string pair to an attribute.
Bill Wendling
isanbard at gmail.com
Thu Jul 25 11:34:25 PDT 2013
Author: void
Date: Thu Jul 25 13:34:24 2013
New Revision: 187138
URL: http://llvm.org/viewvc/llvm-project?rev=187138&view=rev
Log:
Add a way to add a kind-value string pair to an attribute.
Modified:
llvm/trunk/include/llvm/IR/Attributes.h
llvm/trunk/include/llvm/IR/Function.h
llvm/trunk/lib/IR/Attributes.cpp
Modified: llvm/trunk/include/llvm/IR/Attributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=187138&r1=187137&r2=187138&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Attributes.h (original)
+++ llvm/trunk/include/llvm/IR/Attributes.h Thu Jul 25 13:34:24 2013
@@ -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.
Modified: llvm/trunk/include/llvm/IR/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Function.h?rev=187138&r1=187137&r2=187138&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Function.h (original)
+++ llvm/trunk/include/llvm/IR/Function.h Thu Jul 25 13:34:24 2013
@@ -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 {
Modified: llvm/trunk/lib/IR/Attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Attributes.cpp?rev=187138&r1=187137&r2=187138&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Attributes.cpp (original)
+++ llvm/trunk/lib/IR/Attributes.cpp Thu Jul 25 13:34:24 2013
@@ -645,6 +645,13 @@ AttributeSet AttributeSet::addAttribute(
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;
More information about the llvm-commits
mailing list