aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorArthur Eubanks <aeubanks@google.com>2021-08-19 14:02:11 -0700
committerArthur Eubanks <aeubanks@google.com>2021-08-19 14:10:26 -0700
commit44a3241f10558ce86aac7f3b3c87da9f5abf3189 (patch)
tree79fc9aa585b4ffaa3fd0b81a923b7e07943cca28 /llvm/lib/IR/Attributes.cpp
parent10a126325da2475beb39500144023f573bf602b2 (diff)
downloadllvm-44a3241f10558ce86aac7f3b3c87da9f5abf3189.zip
llvm-44a3241f10558ce86aac7f3b3c87da9f5abf3189.tar.gz
llvm-44a3241f10558ce86aac7f3b3c87da9f5abf3189.tar.bz2
[NFC] Replace some attribute methods that use confusing indexes
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 0bb6dbe..d8765cc 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -1335,12 +1335,19 @@ AttributeList AttributeList::removeAttributes(LLVMContext &C,
return getImpl(C, AttrSets);
}
-AttributeList AttributeList::addDereferenceableAttr(LLVMContext &C,
- unsigned Index,
- uint64_t Bytes) const {
+AttributeList AttributeList::addDereferenceableRetAttr(LLVMContext &C,
+ uint64_t Bytes) const {
AttrBuilder B;
B.addDereferenceableAttr(Bytes);
- return addAttributes(C, Index, B);
+ return addRetAttributes(C, B);
+}
+
+AttributeList AttributeList::addDereferenceableParamAttr(LLVMContext &C,
+ unsigned Index,
+ uint64_t Bytes) const {
+ AttrBuilder B;
+ B.addDereferenceableAttr(Bytes);
+ return addParamAttributes(C, Index, B);
}
AttributeList
@@ -1459,12 +1466,21 @@ MaybeAlign AttributeList::getStackAlignment(unsigned Index) const {
return getAttributes(Index).getStackAlignment();
}
-uint64_t AttributeList::getDereferenceableBytes(unsigned Index) const {
- return getAttributes(Index).getDereferenceableBytes();
+uint64_t AttributeList::getRetDereferenceableBytes() const {
+ return getRetAttrs().getDereferenceableBytes();
+}
+
+uint64_t AttributeList::getParamDereferenceableBytes(unsigned Index) const {
+ return getParamAttrs(Index).getDereferenceableBytes();
+}
+
+uint64_t AttributeList::getRetDereferenceableOrNullBytes() const {
+ return getRetAttrs().getDereferenceableOrNullBytes();
}
-uint64_t AttributeList::getDereferenceableOrNullBytes(unsigned Index) const {
- return getAttributes(Index).getDereferenceableOrNullBytes();
+uint64_t
+AttributeList::getParamDereferenceableOrNullBytes(unsigned Index) const {
+ return getParamAttrs(Index).getDereferenceableOrNullBytes();
}
std::string AttributeList::getAsString(unsigned Index, bool InAttrGrp) const {