From f240c4d42ac0c15b5a03068a5be657055d6769f0 Mon Sep 17 00:00:00 2001 From: Brian Gesiak Date: Wed, 5 Dec 2018 15:56:09 +0000 Subject: [PATCH] Revert "[IR] Add NODISCARD to attribute functions" Revert https://reviews.llvm.org/D55217 due to warnings-turned-into-errors in AMGPU targets. I'll fix the warnings first, then re-commit this patch. llvm-svn: 348375 --- llvm/include/llvm/IR/Attributes.h | 117 +++++++++++++++++--------------------- 1 file changed, 53 insertions(+), 64 deletions(-) diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h index 9fc4614..5aaaaf3 100644 --- a/llvm/include/llvm/IR/Attributes.h +++ b/llvm/include/llvm/IR/Attributes.h @@ -230,33 +230,29 @@ public: /// Add an argument attribute. Returns a new set because attribute sets are /// immutable. - LLVM_NODISCARD AttributeSet addAttribute(LLVMContext &C, - Attribute::AttrKind Kind) const; + AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const; /// Add a target-dependent attribute. Returns a new set because attribute sets /// are immutable. - LLVM_NODISCARD AttributeSet addAttribute(LLVMContext &C, StringRef Kind, - StringRef Value = StringRef()) const; + AttributeSet addAttribute(LLVMContext &C, StringRef Kind, + StringRef Value = StringRef()) const; /// Add attributes to the attribute set. Returns a new set because attribute /// sets are immutable. - LLVM_NODISCARD AttributeSet addAttributes(LLVMContext &C, - AttributeSet AS) const; + AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const; /// Remove the specified attribute from this set. Returns a new set because /// attribute sets are immutable. - LLVM_NODISCARD AttributeSet removeAttribute(LLVMContext &C, - Attribute::AttrKind Kind) const; + AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const; /// Remove the specified attribute from this set. Returns a new set because /// attribute sets are immutable. - LLVM_NODISCARD AttributeSet removeAttribute(LLVMContext &C, - StringRef Kind) const; + AttributeSet removeAttribute(LLVMContext &C, StringRef Kind) const; /// Remove the specified attributes from this set. Returns a new set because /// attribute sets are immutable. - LLVM_NODISCARD AttributeSet - removeAttributes(LLVMContext &C, const AttrBuilder &AttrsToRemove) const; + AttributeSet removeAttributes(LLVMContext &C, + const AttrBuilder &AttrsToRemove) const; /// Return the number of attributes in this set. unsigned getNumAttributes() const; @@ -379,140 +375,133 @@ public: /// Add an attribute to the attribute set at the given index. /// Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList addAttribute(LLVMContext &C, unsigned Index, - Attribute::AttrKind Kind) const; + AttributeList addAttribute(LLVMContext &C, unsigned Index, + Attribute::AttrKind Kind) const; /// Add an attribute to the attribute set at the given index. /// Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList - addAttribute(LLVMContext &C, unsigned Index, StringRef Kind, - StringRef Value = StringRef()) const; + AttributeList addAttribute(LLVMContext &C, unsigned Index, StringRef Kind, + StringRef Value = StringRef()) const; /// Add an attribute to the attribute set at the given index. /// Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList addAttribute(LLVMContext &C, unsigned Index, - Attribute A) const; + AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute A) const; /// Add attributes to the attribute set at the given index. /// Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList addAttributes(LLVMContext &C, unsigned Index, - const AttrBuilder &B) const; + AttributeList addAttributes(LLVMContext &C, unsigned Index, + const AttrBuilder &B) const; /// Add an argument attribute to the list. Returns a new list because /// attribute lists are immutable. - LLVM_NODISCARD AttributeList addParamAttribute( - LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const { + AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, + Attribute::AttrKind Kind) const { return addAttribute(C, ArgNo + FirstArgIndex, Kind); } /// Add an argument attribute to the list. Returns a new list because /// attribute lists are immutable. - LLVM_NODISCARD AttributeList - addParamAttribute(LLVMContext &C, unsigned ArgNo, StringRef Kind, - StringRef Value = StringRef()) const { + AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, + StringRef Kind, + StringRef Value = StringRef()) const { return addAttribute(C, ArgNo + FirstArgIndex, Kind, Value); } /// Add an attribute to the attribute list at the given arg indices. Returns a /// new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList addParamAttribute(LLVMContext &C, - ArrayRef ArgNos, - Attribute A) const; + AttributeList addParamAttribute(LLVMContext &C, ArrayRef ArgNos, + Attribute A) const; /// Add an argument attribute to the list. Returns a new list because /// attribute lists are immutable. - LLVM_NODISCARD AttributeList addParamAttributes(LLVMContext &C, - unsigned ArgNo, - const AttrBuilder &B) const { + AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, + const AttrBuilder &B) const { return addAttributes(C, ArgNo + FirstArgIndex, B); } /// Remove the specified attribute at the specified index from this /// attribute list. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList removeAttribute(LLVMContext &C, unsigned Index, - Attribute::AttrKind Kind) const; + AttributeList removeAttribute(LLVMContext &C, unsigned Index, + Attribute::AttrKind Kind) const; /// Remove the specified attribute at the specified index from this /// attribute list. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList removeAttribute(LLVMContext &C, unsigned Index, - StringRef Kind) const; + AttributeList removeAttribute(LLVMContext &C, unsigned Index, + StringRef Kind) const; /// Remove the specified attributes at the specified index from this /// attribute list. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList removeAttributes( - LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const; + AttributeList removeAttributes(LLVMContext &C, unsigned Index, + const AttrBuilder &AttrsToRemove) const; /// Remove all attributes at the specified index from this /// attribute list. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList removeAttributes(LLVMContext &C, - unsigned Index) const; + AttributeList removeAttributes(LLVMContext &C, unsigned Index) const; /// Remove the specified attribute at the specified arg index from this /// attribute list. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList removeParamAttribute( - LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const { + AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, + Attribute::AttrKind Kind) const { return removeAttribute(C, ArgNo + FirstArgIndex, Kind); } /// Remove the specified attribute at the specified arg index from this /// attribute list. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList removeParamAttribute(LLVMContext &C, - unsigned ArgNo, - StringRef Kind) const { + AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, + StringRef Kind) const { return removeAttribute(C, ArgNo + FirstArgIndex, Kind); } /// Remove the specified attribute at the specified arg index from this /// attribute list. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList removeParamAttributes( - LLVMContext &C, unsigned ArgNo, const AttrBuilder &AttrsToRemove) const { + AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, + const AttrBuilder &AttrsToRemove) const { return removeAttributes(C, ArgNo + FirstArgIndex, AttrsToRemove); } /// Remove all attributes at the specified arg index from this /// attribute list. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList removeParamAttributes(LLVMContext &C, - unsigned ArgNo) const { + AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo) const { return removeAttributes(C, ArgNo + FirstArgIndex); } /// \brief Add the dereferenceable attribute to the attribute set at the given /// index. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList addDereferenceableAttr(LLVMContext &C, - unsigned Index, - uint64_t Bytes) const; + AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, + uint64_t Bytes) const; /// \brief Add the dereferenceable attribute to the attribute set at the given /// arg index. Returns a new list because attribute lists are immutable. - LLVM_NODISCARD AttributeList addDereferenceableParamAttr( - LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const { + AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, + uint64_t Bytes) const { return addDereferenceableAttr(C, ArgNo + FirstArgIndex, Bytes); } /// 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; + 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 { + 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 &NumElemsArg); + AttributeList addAllocSizeAttr(LLVMContext &C, unsigned Index, + unsigned ElemSizeArg, + const Optional &NumElemsArg); /// 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 &NumElemsArg) { + AttributeList addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, + unsigned ElemSizeArg, + const Optional &NumElemsArg) { return addAllocSizeAttr(C, ArgNo + FirstArgIndex, ElemSizeArg, NumElemsArg); } -- 2.7.4