[LLVMdev] [PATCH]: Add range iterators to Extract/InsertValueInst indices

Daniel Berlin dberlin at dberlin.org
Tue Mar 3 00:22:39 PST 2015


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>


More information about the llvm-dev mailing list