summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AttributeImpl.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-28 00:21:34 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-28 00:21:34 +0000
commit9eb689cf1c1c839a8dcd4afa54e66c45b070e6ae (patch)
tree465a06ad0706751c2d02aa48bc6b8ee0805f201d /llvm/lib/IR/AttributeImpl.h
parentad6217c76f37bf6333bf6a5b35c241bc8e004a79 (diff)
downloadbcm5719-llvm-9eb689cf1c1c839a8dcd4afa54e66c45b070e6ae.tar.gz
bcm5719-llvm-9eb689cf1c1c839a8dcd4afa54e66c45b070e6ae.zip
Remove a use of AttributeWithIndex.
We want to remove AttributeWithIndex because it provides a non-encapsulated view of the AttributeSetImpl object. Instead, use accessor methods and iterators. Eventually, this code can be simplified because the Attribute object will hold only one attribute instead of multiple attributes. llvm-svn: 173641
Diffstat (limited to 'llvm/lib/IR/AttributeImpl.h')
-rw-r--r--llvm/lib/IR/AttributeImpl.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index f9a716cb3c0..8d5de77eed1 100644
--- a/llvm/lib/IR/AttributeImpl.h
+++ b/llvm/lib/IR/AttributeImpl.h
@@ -117,7 +117,8 @@ class AttributeSetImpl : public FoldingSetNode {
LLVMContext &Context;
SmallVector<AttributeWithIndex, 4> AttrList;
- SmallVector<std::pair<uint64_t, AttributeSetNode*>, 4> AttrNodes;
+ typedef std::pair<uint64_t, AttributeSetNode*> IndexAttrPair;
+ SmallVector<IndexAttrPair, 4> AttrNodes;
// AttributesSet is uniqued, these should not be publicly available.
void operator=(const AttributeSetImpl &) LLVM_DELETED_FUNCTION;
@@ -137,7 +138,9 @@ public:
/// is the index of the return, parameter, or function object that the
/// attributes are applied to, not the index into the AttrNodes list where the
/// attributes reside.
- uint64_t getSlotIndex(unsigned Slot) const { return AttrNodes[Slot].first; }
+ uint64_t getSlotIndex(unsigned Slot) const {
+ return AttrNodes[Slot].first;
+ }
/// \brief Retrieve the attributes for the given "slot" in the AttrNode list.
/// \p Slot is an index into the AttrNodes list, not the index of the return /
@@ -147,6 +150,19 @@ public:
return AttributeSet::get(Context, AttrList[Slot]);
}
+ typedef AttributeSetNode::iterator iterator;
+ typedef AttributeSetNode::const_iterator const_iterator;
+
+ iterator begin(unsigned Idx)
+ { return AttrNodes[Idx].second->begin(); }
+ iterator end(unsigned Idx)
+ { return AttrNodes[Idx].second->end(); }
+
+ const_iterator begin(unsigned Idx) const
+ { return AttrNodes[Idx].second->begin(); }
+ const_iterator end(unsigned Idx) const
+ { return AttrNodes[Idx].second->end(); }
+
void Profile(FoldingSetNodeID &ID) const {
Profile(ID, AttrList);
}
OpenPOWER on IntegriCloud