[NFC] Cleanup/remove some AttributeList setter methods

This commit is contained in:
Arthur Eubanks 2021-08-20 10:28:32 -07:00
parent 25599c3ff9
commit d7df812740
2 changed files with 9 additions and 39 deletions

View File

@ -665,39 +665,17 @@ public:
LLVM_NODISCARD AttributeList addDereferenceableParamAttr(
LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const;
/// Add the dereferenceable_or_null attribute to the attribute set at
/// the given index. Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList addDereferenceableOrNullAttr(
LLVMContext &C, unsigned Index, uint64_t Bytes) const;
/// Add the dereferenceable_or_null attribute to the attribute set at
/// the given arg index. Returns a new list because attribute lists are
/// immutable.
LLVM_NODISCARD AttributeList addDereferenceableOrNullParamAttr(
LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const {
return addDereferenceableOrNullAttr(C, ArgNo + FirstArgIndex, Bytes);
}
/// Add the allocsize attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList
addAllocSizeAttr(LLVMContext &C, unsigned Index, unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg);
LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const;
/// Add the allocsize attribute to the attribute set at the given arg index.
/// Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList
addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg) {
return addAllocSizeAttr(C, ArgNo + FirstArgIndex, ElemSizeArg, NumElemsArg);
}
/// Add the vscale_range attribute to the attribute set at the given index.
/// Returns a new list because attribute lists are immutable.
LLVM_NODISCARD AttributeList addVScaleRangeAttr(LLVMContext &C,
unsigned Index,
unsigned MinValue,
unsigned MaxValue);
const Optional<unsigned> &NumElemsArg);
//===--------------------------------------------------------------------===//
// AttributeList Accessors

View File

@ -1351,28 +1351,20 @@ AttributeList AttributeList::addDereferenceableParamAttr(LLVMContext &C,
}
AttributeList
AttributeList::addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index,
uint64_t Bytes) const {
AttributeList::addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned Index,
uint64_t Bytes) const {
AttrBuilder B;
B.addDereferenceableOrNullAttr(Bytes);
return addAttributes(C, Index, B);
return addParamAttributes(C, Index, B);
}
AttributeList
AttributeList::addAllocSizeAttr(LLVMContext &C, unsigned Index,
unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg) {
AttributeList::addAllocSizeParamAttr(LLVMContext &C, unsigned Index,
unsigned ElemSizeArg,
const Optional<unsigned> &NumElemsArg) {
AttrBuilder B;
B.addAllocSizeAttr(ElemSizeArg, NumElemsArg);
return addAttributes(C, Index, B);
}
AttributeList AttributeList::addVScaleRangeAttr(LLVMContext &C, unsigned Index,
unsigned MinValue,
unsigned MaxValue) {
AttrBuilder B;
B.addVScaleRangeAttr(MinValue, MaxValue);
return addAttributes(C, Index, B);
return addParamAttributes(C, Index, B);
}
//===----------------------------------------------------------------------===//