General cleanups.
* Remove dead methods.
* Use the 'operator==' method instead of 'contains', which isn't needed.
* Fix some comments.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171523 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h
index ecdb928..42b4fe3 100644
--- a/lib/IR/AttributeImpl.h
+++ b/lib/IR/AttributeImpl.h
@@ -42,34 +42,22 @@
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 @@
/// \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());
}
}
};