summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-05-06 17:41:54 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-05-06 17:41:54 +0000
commit06cf33fbea70f2672e814d82ad9005b9f9e6c6e8 (patch)
tree49b97516fcbd1921645bf26a225aa311b114aa23 /llvm/lib/IR/Attributes.cpp
parente7f46558a46878901072dc5cb452f3c2bd0ac181 (diff)
downloadbcm5719-llvm-06cf33fbea70f2672e814d82ad9005b9f9e6c6e8.tar.gz
bcm5719-llvm-06cf33fbea70f2672e814d82ad9005b9f9e6c6e8.zip
Add missing dereferenceable_or_null getters
Summary: Add missing dereferenceable_or_null getters required for http://reviews.llvm.org/D9253 change. Separated from the D9253 review. Patch by Artur Pilipenko! Reviewers: sanjoy Reviewed By: sanjoy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D9499 llvm-svn: 236615
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index be5b74f59a2..7c9468cb158 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -532,6 +532,13 @@ uint64_t AttributeSetNode::getDereferenceableBytes() const {
return 0;
}
+uint64_t AttributeSetNode::getDereferenceableOrNullBytes() const {
+ for (iterator I = begin(), E = end(); I != E; ++I)
+ if (I->hasAttribute(Attribute::DereferenceableOrNull))
+ return I->getDereferenceableOrNullBytes();
+ return 0;
+}
+
std::string AttributeSetNode::getAsString(bool InAttrGrp) const {
std::string Str;
for (iterator I = begin(), E = end(); I != E; ++I) {
@@ -957,6 +964,11 @@ uint64_t AttributeSet::getDereferenceableBytes(unsigned Index) const {
return ASN ? ASN->getDereferenceableBytes() : 0;
}
+uint64_t AttributeSet::getDereferenceableOrNullBytes(unsigned Index) const {
+ AttributeSetNode *ASN = getAttributes(Index);
+ return ASN ? ASN->getDereferenceableOrNullBytes() : 0;
+}
+
std::string AttributeSet::getAsString(unsigned Index,
bool InAttrGrp) const {
AttributeSetNode *ASN = getAttributes(Index);
OpenPOWER on IntegriCloud