aboutsummaryrefslogtreecommitdiffstats
path: root/lib/IR/AttributeImpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/AttributeImpl.h')
-rw-r--r--lib/IR/AttributeImpl.h47
1 files changed, 20 insertions, 27 deletions
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h
index ecdb9280ce..42b4fe36b2 100644
--- a/lib/IR/AttributeImpl.h
+++ b/lib/IR/AttributeImpl.h
@@ -42,34 +42,22 @@ public:
return Vals;
}
- bool contains(Attribute::AttrKind Kind) const;
- bool contains(StringRef Kind) const;
-
- bool hasAttribute(uint64_t A) const;
+ bool hasAttribute(Attribute::AttrKind A) const;
bool hasAttributes() const;
- bool hasAttributes(const Attribute &A) const;
uint64_t getAlignment() const;
uint64_t getStackAlignment() const;
- bool operator==(Attribute::AttrKind Kind) const {
- return contains(Kind);
- }
- bool operator!=(Attribute::AttrKind Kind) const {
- return !contains(Kind);
- }
+ bool operator==(Attribute::AttrKind Kind) const;
+ bool operator!=(Attribute::AttrKind Kind) const;
- bool operator==(StringRef Kind) const {
- return contains(Kind);
- }
- bool operator!=(StringRef Kind) const {
- return !contains(Kind);
- }
+ bool operator==(StringRef Kind) const;
+ bool operator!=(StringRef Kind) const;
uint64_t getBitMask() const; // FIXME: Remove.
- static uint64_t getAttrMask(uint64_t Val);
+ static uint64_t getAttrMask(Attribute::AttrKind Val);
void Profile(FoldingSetNodeID &ID) const {
Profile(ID, Data, Vals);
@@ -87,23 +75,28 @@ public:
/// \class
/// \brief This class represents a set of attributes.
class AttributeSetImpl : public FoldingSetNode {
+ LLVMContext &Context;
+ SmallVector<AttributeWithIndex, 4> AttrList;
+
// AttributesSet is uniqued, these should not be publicly available.
void operator=(const AttributeSetImpl &) LLVM_DELETED_FUNCTION;
AttributeSetImpl(const AttributeSetImpl &) LLVM_DELETED_FUNCTION;
public:
- LLVMContext &Context;
- SmallVector<AttributeWithIndex, 4> Attrs;
-
AttributeSetImpl(LLVMContext &C, ArrayRef<AttributeWithIndex> attrs)
- : Context(C), Attrs(attrs.begin(), attrs.end()) {}
+ : Context(C), AttrList(attrs.begin(), attrs.end()) {}
+
+ LLVMContext &getContext() { return Context; }
+ ArrayRef<AttributeWithIndex> getAttributes() const { return AttrList; }
+ unsigned getNumAttributes() const { return AttrList.size(); }
void Profile(FoldingSetNodeID &ID) const {
- Profile(ID, Attrs);
+ Profile(ID, AttrList);
}
- static void Profile(FoldingSetNodeID &ID, ArrayRef<AttributeWithIndex> Attrs){
- for (unsigned i = 0, e = Attrs.size(); i != e; ++i) {
- ID.AddInteger(Attrs[i].Attrs.getBitMask());
- ID.AddInteger(Attrs[i].Index);
+ static void Profile(FoldingSetNodeID &ID,
+ ArrayRef<AttributeWithIndex> AttrList){
+ for (unsigned i = 0, e = AttrList.size(); i != e; ++i) {
+ ID.AddInteger(AttrList[i].Index);
+ ID.AddInteger(AttrList[i].Attrs.getBitMask());
}
}
};