Daniel Berlin
2015-Mar-03 08:22 UTC
[LLVMdev] [PATCH]: Add range iterators to Extract/InsertValueInst indices
diff --git a/include/llvm/IR/Instructions.h b/include/llvm/IR/Instructions.h
index 83f9d04..1a77675 100644
--- a/include/llvm/IR/Instructions.h
+++ b/include/llvm/IR/Instructions.h
@@ -1908,6 +1908,9 @@ public:
typedef const unsigned* idx_iterator;
inline idx_iterator idx_begin() const { return Indices.begin(); }
inline idx_iterator idx_end() const { return Indices.end(); }
+ inline iterator_range<idx_iterator> indices() const {
+ return iterator_range<idx_iterator>(idx_begin(), idx_end());
+ }
Value *getAggregateOperand() {
return getOperand(0);
@@ -2019,6 +2022,9 @@ public:
typedef const unsigned* idx_iterator;
inline idx_iterator idx_begin() const { return Indices.begin(); }
inline idx_iterator idx_end() const { return Indices.end(); }
+ inline iterator_range<idx_iterator> indices() const {
+ return iterator_range<idx_iterator>(idx_begin(), idx_end());
+ }
Value *getAggregateOperand() {
return getOperand(0);
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20150303/88cde84a/attachment.html>
Chandler Carruth
2015-Mar-03 08:38 UTC
[LLVMdev] [PATCH]: Add range iterators to Extract/InsertValueInst indices
Looks good. On Tue, Mar 3, 2015 at 12:22 AM, Daniel Berlin <dberlin at dberlin.org> wrote:> diff --git a/include/llvm/IR/Instructions.h > b/include/llvm/IR/Instructions.h > index 83f9d04..1a77675 100644 > --- a/include/llvm/IR/Instructions.h > +++ b/include/llvm/IR/Instructions.h > @@ -1908,6 +1908,9 @@ public: > typedef const unsigned* idx_iterator; > inline idx_iterator idx_begin() const { return Indices.begin(); } > inline idx_iterator idx_end() const { return Indices.end(); } > + inline iterator_range<idx_iterator> indices() const { > + return iterator_range<idx_iterator>(idx_begin(), idx_end()); > + } > > Value *getAggregateOperand() { > return getOperand(0); > @@ -2019,6 +2022,9 @@ public: > typedef const unsigned* idx_iterator; > inline idx_iterator idx_begin() const { return Indices.begin(); } > inline idx_iterator idx_end() const { return Indices.end(); } > + inline iterator_range<idx_iterator> indices() const { > + return iterator_range<idx_iterator>(idx_begin(), idx_end()); > + } > > Value *getAggregateOperand() { > return getOperand(0); >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150303/d44bb90f/attachment.html>