Add a way to add a kind-value string pair to an attribute.
[oota-llvm.git] / lib / IR / Attributes.cpp
index 48743fae692d52122c691a2b7f5ca4e2674e5f77..894ff7dda1fe2c503439956d9f9380f0ae8fba52 100644 (file)
@@ -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;