summaryrefslogtreecommitdiffstats
path: root/lib/IR
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-02-05 08:09:32 +0000
committerBill Wendling <isanbard@gmail.com>2013-02-05 08:09:32 +0000
commitea59f896a672c2e1ef9f02277bce60257aa60989 (patch)
treeed5d0127c4dc2d60798940bdb27e1670b56d14af /lib/IR
parentca531fd4869a17b7a6b16008b9b85741aa6b61e8 (diff)
downloadexternal_llvm-ea59f896a672c2e1ef9f02277bce60257aa60989.zip
external_llvm-ea59f896a672c2e1ef9f02277bce60257aa60989.tar.gz
external_llvm-ea59f896a672c2e1ef9f02277bce60257aa60989.tar.bz2
Add target-dependent versions of addAttribute/removeAttribute to AttrBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174356 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR')
-rw-r--r--lib/IR/Attributes.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/IR/Attributes.cpp b/lib/IR/Attributes.cpp
index 909f22f..8a0551c 100644
--- a/lib/IR/Attributes.cpp
+++ b/lib/IR/Attributes.cpp
@@ -46,7 +46,7 @@ Attribute Attribute::get(LLVMContext &Context, Constant *Kind, Constant *Val) {
pImpl->AttrsSet.InsertNode(PA, InsertPoint);
}
- // Return the AttributesList that we found or created.
+ // Return the Attribute that we found or created.
return Attribute(PA);
}
@@ -826,6 +826,11 @@ AttrBuilder &AttrBuilder::addAttribute(Attribute Attr) {
return *this;
}
+AttrBuilder &AttrBuilder::addAttribute(StringRef A, StringRef V) {
+ TargetDepAttrs[A] = V;
+ return *this;
+}
+
AttrBuilder &AttrBuilder::removeAttribute(Attribute::AttrKind Val) {
Attrs.erase(Val);
@@ -861,6 +866,13 @@ AttrBuilder &AttrBuilder::removeAttributes(AttributeSet A, uint64_t Index) {
return *this;
}
+AttrBuilder &AttrBuilder::removeAttribute(StringRef A) {
+ std::map<std::string, std::string>::iterator I = TargetDepAttrs.find(A);
+ if (I != TargetDepAttrs.end())
+ TargetDepAttrs.erase(I);
+ return *this;
+}
+
AttrBuilder &AttrBuilder::addAlignmentAttr(unsigned Align) {
if (Align == 0) return *this;