- Attribute::AttrKind getEnumKind() const { return Kind; }
- unsigned getAlignment() const { return Align; }
-
- static inline bool classof(const AttributeEntry *AE) {
- return AE->getKindID() == AlignAttrEntry;
- }
- static inline bool classof(const AlignAttributeEntry *) { return true; }
-};
-
-class StringAttributeEntry : public AttributeEntry {
- std::string Kind;
- std::string Val;
-public:
- StringAttributeEntry(StringRef Kind, StringRef Val = StringRef())
- : AttributeEntry(StringAttrEntry), Kind(Kind), Val(Val) {}
-
- StringRef getStringKind() const { return Kind; }
- StringRef getStringValue() const { return Val; }
-
- static inline bool classof(const AttributeEntry *AE) {
- return AE->getKindID() == StringAttrEntry;
- }
- static inline bool classof(const StringAttributeEntry *) { return true; }
-};
-
-//===----------------------------------------------------------------------===//
-/// \class
-/// \brief This class represents a single, uniqued attribute. That attribute
-/// could be a single enum, a tuple, or a string.
-class AttributeImpl : public FoldingSetNode {
- LLVMContext &Context; ///< Global context for uniquing objects
- Constant *Kind; ///< Kind of attribute: enum or string
-
- AttributeEntry *Entry; ///< Holds the kind and value of the attribute
-
- // AttributesImpl is uniqued, these should not be publicly available.
- void operator=(const AttributeImpl &) LLVM_DELETED_FUNCTION;
- AttributeImpl(const AttributeImpl &) LLVM_DELETED_FUNCTION;
-public:
- AttributeImpl(LLVMContext &C, Attribute::AttrKind Kind);
- AttributeImpl(LLVMContext &C, Attribute::AttrKind Kind, unsigned Align);
- AttributeImpl(LLVMContext &C, StringRef Kind, StringRef Val = StringRef());
- ~AttributeImpl();
-
- LLVMContext &getContext() { return Context; }
-
- bool isEnumAttribute() const;
- bool isAlignAttribute() const;
- bool isStringAttribute() const;