summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-02-05 23:48:36 +0000
committerBill Wendling <isanbard@gmail.com>2013-02-05 23:48:36 +0000
commitae89a0fbc24aa7cdc1c35aa1b55d3685f7067f4a (patch)
treea00f7a6e56ff3179781db55505881cf791647078 /llvm/lib
parent2de5efe65bf7c5b7a388f27beb6bc4ed84b59cd9 (diff)
downloadbcm5719-llvm-ae89a0fbc24aa7cdc1c35aa1b55d3685f7067f4a.tar.gz
bcm5719-llvm-ae89a0fbc24aa7cdc1c35aa1b55d3685f7067f4a.zip
Add the target-dependent (string) attributes from the AttrBuilder to the AttributeSet.
llvm-svn: 174467
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Attributes.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index d61bd09e2c9..dc1a6573439 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -126,8 +126,13 @@ StringRef Attribute::getValueAsString() const {
return pImpl ? pImpl->getValueAsString() : StringRef();
}
-bool Attribute::hasAttribute(AttrKind Val) const {
- return (pImpl && pImpl->hasAttribute(Val)) || (!pImpl && Val == None);
+bool Attribute::hasAttribute(AttrKind Kind) const {
+ return (pImpl && pImpl->hasAttribute(Kind)) || (!pImpl && Kind == None);
+}
+
+bool Attribute::hasAttribute(StringRef Kind) const {
+ if (!isStringAttribute()) return false;
+ return pImpl && pImpl->hasAttribute(Kind);
}
/// This returns the alignment field of an attribute as a byte alignment value.
@@ -552,6 +557,7 @@ AttributeSet AttributeSet::get(LLVMContext &C, unsigned Idx, AttrBuilder &B) {
if (!B.hasAttributes())
return AttributeSet();
+ // Add target-independent attributes.
SmallVector<std::pair<unsigned, Attribute>, 8> Attrs;
for (AttrBuilder::iterator I = B.begin(), E = B.end(); I != E; ++I) {
Attribute::AttrKind Kind = *I;
@@ -565,6 +571,11 @@ AttributeSet AttributeSet::get(LLVMContext &C, unsigned Idx, AttrBuilder &B) {
Attrs.push_back(std::make_pair(Idx, Attribute::get(C, Kind)));
}
+ // Add target-dependent (string) attributes.
+ for (AttrBuilder::td_iterator I = B.td_begin(), E = B.td_end();
+ I != E; ++I)
+ Attrs.push_back(std::make_pair(Idx, Attribute::get(C, I->first,I->second)));
+
return get(C, Attrs);
}
OpenPOWER on IntegriCloud