From cf63a79818ab7e6de1f48b59f4d521c1aafb9cb8 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sat, 3 May 2014 23:00:35 +0000 Subject: IR: Cleanup AttributeSet::get for AttrBuilder We don't modify the AttrBuilder in AttributeSet::get, make the reference argument const. llvm-svn: 207924 --- llvm/include/llvm/IR/Attributes.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'llvm/include') diff --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h index 43d1fb42588..cb4275337d7 100644 --- a/llvm/include/llvm/IR/Attributes.h +++ b/llvm/include/llvm/IR/Attributes.h @@ -242,7 +242,7 @@ public: static AttributeSet get(LLVMContext &C, ArrayRef Attrs); static AttributeSet get(LLVMContext &C, unsigned Index, ArrayRef Kind); - static AttributeSet get(LLVMContext &C, unsigned Index, AttrBuilder &B); + static AttributeSet get(LLVMContext &C, unsigned Index, const AttrBuilder &B); /// \brief Add an attribute to the attribute set at the given index. Since /// attribute sets are immutable, this returns a new set. @@ -469,6 +469,8 @@ public: typedef std::pair td_type; typedef std::map::iterator td_iterator; typedef std::map::const_iterator td_const_iterator; + typedef llvm::iterator_range td_range; + typedef llvm::iterator_range td_const_range; td_iterator td_begin() { return TargetDepAttrs.begin(); } td_iterator td_end() { return TargetDepAttrs.end(); } @@ -476,6 +478,11 @@ public: td_const_iterator td_begin() const { return TargetDepAttrs.begin(); } td_const_iterator td_end() const { return TargetDepAttrs.end(); } + td_range td_attrs() { return td_range(td_begin(), td_end()); } + td_const_range td_attrs() const { + return td_const_range(td_begin(), td_end()); + } + bool td_empty() const { return TargetDepAttrs.empty(); } bool operator==(const AttrBuilder &B); -- cgit v1.2.3