Skip to content

Commit

Permalink
Enable range-for iteration over call/invoke arguments.
Browse files Browse the repository at this point in the history
Similar to r204835



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204836 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
eliben committed Mar 26, 2014
1 parent cf2de5a commit 65a3ced
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion include/llvm/IR/Instructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define LLVM_IR_INSTRUCTIONS_H

#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CallingConv.h"
Expand Down Expand Up @@ -1294,6 +1295,16 @@ class CallInst : public Instruction {
Value *getArgOperand(unsigned i) const { return getOperand(i); }
void setArgOperand(unsigned i, Value *v) { setOperand(i, v); }

/// arg_operands - iteration adapter for range-for loops.
iterator_range<op_iterator> arg_operands() {
return iterator_range<op_iterator>(op_begin(), op_end());
}

/// arg_operands - iteration adapter for range-for loops.
iterator_range<const_op_iterator> arg_operands() const {
return iterator_range<const_op_iterator>(op_begin(), op_end());
}

/// \brief Wrappers for getting the \c Use of a call argument.
const Use &getArgOperandUse(unsigned i) const { return getOperandUse(i); }
Use &getArgOperandUse(unsigned i) { return getOperandUse(i); }
Expand Down Expand Up @@ -2941,7 +2952,17 @@ class InvokeInst : public TerminatorInst {
Value *getArgOperand(unsigned i) const { return getOperand(i); }
void setArgOperand(unsigned i, Value *v) { setOperand(i, v); }

/// \brief Wrappers for getting the \c Use of a call argument.
/// arg_operands - iteration adapter for range-for loops.
iterator_range<op_iterator> arg_operands() {
return iterator_range<op_iterator>(op_begin(), op_end());
}

/// arg_operands - iteration adapter for range-for loops.
iterator_range<const_op_iterator> arg_operands() const {
return iterator_range<const_op_iterator>(op_begin(), op_end());
}

/// \brief Wrappers for getting the \c Use of a invoke argument.
const Use &getArgOperandUse(unsigned i) const { return getOperandUse(i); }
Use &getArgOperandUse(unsigned i) { return getOperandUse(i); }

Expand Down

0 comments on commit 65a3ced

Please sign in to comment.