[llvm] 331cfc5 - [NFC] Simplify some CallBase attribute methods
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 20 09:51:52 PDT 2021
Author: Arthur Eubanks
Date: 2021-08-20T09:46:31-07:00
New Revision: 331cfc53febc3f9b7e987070567a04a839bc2dc3
URL: https://github.com/llvm/llvm-project/commit/331cfc53febc3f9b7e987070567a04a839bc2dc3
DIFF: https://github.com/llvm/llvm-project/commit/331cfc53febc3f9b7e987070567a04a839bc2dc3.diff
LOG: [NFC] Simplify some CallBase attribute methods
Added:
Modified:
llvm/include/llvm/IR/InstrTypes.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/InstrTypes.h b/llvm/include/llvm/IR/InstrTypes.h
index ed4fa878b2b1..4b0608d38260 100644
--- a/llvm/include/llvm/IR/InstrTypes.h
+++ b/llvm/include/llvm/IR/InstrTypes.h
@@ -1487,16 +1487,12 @@ class CallBase : public Instruction {
/// adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attribute::AttrKind Kind) {
- AttributeList PAL = getAttributes();
- PAL = PAL.addAttribute(getContext(), i, Kind);
- setAttributes(PAL);
+ Attrs = Attrs.addAttribute(getContext(), i, Kind);
}
/// adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attribute Attr) {
- AttributeList PAL = getAttributes();
- PAL = PAL.addAttribute(getContext(), i, Attr);
- setAttributes(PAL);
+ Attrs = Attrs.addAttribute(getContext(), i, Attr);
}
/// Adds the attribute to the function.
@@ -1522,104 +1518,76 @@ class CallBase : public Instruction {
/// Adds the attribute to the indicated argument
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) {
assert(ArgNo < getNumArgOperands() && "Out of bounds");
- AttributeList PAL = getAttributes();
- PAL = PAL.addParamAttribute(getContext(), ArgNo, Kind);
- setAttributes(PAL);
+ Attrs = Attrs.addParamAttribute(getContext(), ArgNo, Kind);
}
/// Adds the attribute to the indicated argument
void addParamAttr(unsigned ArgNo, Attribute Attr) {
assert(ArgNo < getNumArgOperands() && "Out of bounds");
- AttributeList PAL = getAttributes();
- PAL = PAL.addParamAttribute(getContext(), ArgNo, Attr);
- setAttributes(PAL);
+ Attrs = Attrs.addParamAttribute(getContext(), ArgNo, Attr);
}
/// removes the attribute from the list of attributes.
void removeAttribute(unsigned i, Attribute::AttrKind Kind) {
- AttributeList PAL = getAttributes();
- PAL = PAL.removeAttribute(getContext(), i, Kind);
- setAttributes(PAL);
+ Attrs = Attrs.removeAttribute(getContext(), i, Kind);
}
/// removes the attribute from the list of attributes.
void removeAttribute(unsigned i, StringRef Kind) {
- AttributeList PAL = getAttributes();
- PAL = PAL.removeAttribute(getContext(), i, Kind);
- setAttributes(PAL);
+ Attrs = Attrs.removeAttribute(getContext(), i, Kind);
}
/// Removes the attributes from the function
- void removeFnAttrs(const AttrBuilder &Attrs) {
- AttributeList PAL = getAttributes();
- PAL = PAL.removeFnAttributes(getContext(), Attrs);
- setAttributes(PAL);
+ void removeFnAttrs(const AttrBuilder &AttrsToRemove) {
+ Attrs = Attrs.removeFnAttributes(getContext(), AttrsToRemove);
}
/// Removes the attribute from the function
void removeFnAttr(Attribute::AttrKind Kind) {
- AttributeList PAL = getAttributes();
- PAL = PAL.removeFnAttribute(getContext(), Kind);
- setAttributes(PAL);
+ Attrs = Attrs.removeFnAttribute(getContext(), Kind);
}
/// Removes the attribute from the return value
void removeRetAttr(Attribute::AttrKind Kind) {
- AttributeList PAL = getAttributes();
- PAL = PAL.removeRetAttribute(getContext(), Kind);
- setAttributes(PAL);
+ Attrs = Attrs.removeRetAttribute(getContext(), Kind);
}
/// Removes the attributes from the return value
- void removeRetAttrs(const AttrBuilder &Attrs) {
- AttributeList PAL = getAttributes();
- PAL = PAL.removeRetAttributes(getContext(), Attrs);
- setAttributes(PAL);
+ void removeRetAttrs(const AttrBuilder &AttrsToRemove) {
+ Attrs = Attrs.removeRetAttributes(getContext(), AttrsToRemove);
}
/// Removes the attribute from the given argument
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) {
assert(ArgNo < getNumArgOperands() && "Out of bounds");
- AttributeList PAL = getAttributes();
- PAL = PAL.removeParamAttribute(getContext(), ArgNo, Kind);
- setAttributes(PAL);
+ Attrs = Attrs.removeParamAttribute(getContext(), ArgNo, Kind);
}
/// Removes the attribute from the given argument
void removeParamAttr(unsigned ArgNo, StringRef Kind) {
assert(ArgNo < getNumArgOperands() && "Out of bounds");
- AttributeList PAL = getAttributes();
- PAL = PAL.removeParamAttribute(getContext(), ArgNo, Kind);
- setAttributes(PAL);
+ Attrs = Attrs.removeParamAttribute(getContext(), ArgNo, Kind);
}
/// Removes the attributes from the given argument
- void removeParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs) {
- AttributeList PAL = getAttributes();
- PAL = PAL.removeParamAttributes(getContext(), ArgNo, Attrs);
- setAttributes(PAL);
+ void removeParamAttrs(unsigned ArgNo, const AttrBuilder &AttrsToRemove) {
+ Attrs = Attrs.removeParamAttributes(getContext(), ArgNo, AttrsToRemove);
}
/// adds the dereferenceable attribute to the list of attributes.
void addDereferenceableParamAttr(unsigned i, uint64_t Bytes) {
- AttributeList PAL = getAttributes();
- PAL = PAL.addDereferenceableParamAttr(getContext(), i, Bytes);
- setAttributes(PAL);
+ Attrs = Attrs.addDereferenceableParamAttr(getContext(), i, Bytes);
}
/// adds the dereferenceable attribute to the list of attributes.
void addDereferenceableRetAttr(uint64_t Bytes) {
- AttributeList PAL = getAttributes();
- PAL = PAL.addDereferenceableRetAttr(getContext(), Bytes);
- setAttributes(PAL);
+ Attrs = Attrs.addDereferenceableRetAttr(getContext(), Bytes);
}
/// adds the dereferenceable_or_null attribute to the list of
/// attributes.
void addDereferenceableOrNullAttr(unsigned i, uint64_t Bytes) {
- AttributeList PAL = getAttributes();
- PAL = PAL.addDereferenceableOrNullAttr(getContext(), i, Bytes);
- setAttributes(PAL);
+ Attrs = Attrs.addDereferenceableOrNullAttr(getContext(), i, Bytes);
}
/// Determine whether the return value has the given attribute.
More information about the llvm-commits
mailing list