mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-27 15:14:31 +00:00
[NFC] Simplify some CallBase attribute methods
This commit is contained in:
1 parent
0f45c16f2c
commit
331cfc53fe
1 file changed
+19
-51
@@ -1487,16 +1487,12 @@ public:
|
||||
|
||||
/// 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 @@ public:
|
||||
/// 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.
|
||||
|
||||
Reference in new issue
Block a user