- Attributes() : Attrs(0) {}
- explicit Attributes(LLVMContext &C, ArrayRef<AttrVal> Vals);
- Attributes(const Attributes &A);
- Attributes &operator=(const Attributes &A) {
- Attrs = A.Attrs;
- return *this;
- }
-
- class Builder {
- friend class Attributes;
- uint64_t Bits;
- public:
- Builder() : Bits(0) {}
- explicit Builder(uint64_t B) : Bits(B) {}
- Builder(const Attributes &A) : Bits(A.Raw()) {}
- Builder(const Builder &B) : Bits(B.Bits) {}
-
- void clear() { Bits = 0; }
-
- bool hasAttribute(Attributes::AttrVal A) const;
- bool hasAttributes() const;
- bool hasAttributes(const Attributes &A) const;
- bool hasAlignmentAttr() const;
-
- uint64_t getAlignment() const;
- uint64_t getStackAlignment() const;
-
- Builder &addAttribute(Attributes::AttrVal Val);
- Builder &removeAttribute(Attributes::AttrVal Val);
-
- /// addRawValue - Add the raw value to the internal representation. This
- /// should be used ONLY for decoding bitcode!
- Builder &addRawValue(uint64_t Val);
-
- /// addAlignmentAttr - This turns an int alignment (which must be a power of
- /// 2) into the form used internally in Attributes.
- Builder &addAlignmentAttr(unsigned Align);
-
- /// addStackAlignmentAttr - This turns an int stack alignment (which must be
- /// a power of 2) into the form used internally in Attributes.
- Builder &addStackAlignmentAttr(unsigned Align);
-
- Builder &addAttributes(const Attributes &A);
- Builder &removeAttributes(const Attributes &A);
-
- /// @brief Remove attributes that are used on functions only.
- void removeFunctionOnlyAttrs() {
- removeAttribute(Attributes::NoReturn)
- .removeAttribute(Attributes::NoUnwind)
- .removeAttribute(Attributes::ReadNone)
- .removeAttribute(Attributes::ReadOnly)
- .removeAttribute(Attributes::NoInline)
- .removeAttribute(Attributes::AlwaysInline)
- .removeAttribute(Attributes::OptimizeForSize)
- .removeAttribute(Attributes::StackProtect)
- .removeAttribute(Attributes::StackProtectReq)
- .removeAttribute(Attributes::NoRedZone)
- .removeAttribute(Attributes::NoImplicitFloat)
- .removeAttribute(Attributes::Naked)
- .removeAttribute(Attributes::InlineHint)
- .removeAttribute(Attributes::StackAlignment)
- .removeAttribute(Attributes::UWTable)
- .removeAttribute(Attributes::NonLazyBind)
- .removeAttribute(Attributes::ReturnsTwice)
- .removeAttribute(Attributes::AddressSafety);
- }
-
- bool operator==(const Builder &B) {
- return Bits == B.Bits;
- }
- bool operator!=(const Builder &B) {
- return Bits != B.Bits;
- }
- };