Define the 'reference' type for the OperandType and ResultType iterators so that they can be used with llvm::enumerate.

PiperOrigin-RevId: 254422623
This commit is contained in:
River Riddle 2019-06-21 10:26:57 -07:00 committed by jpienaar
parent 87a88d5353
commit 1de41ebb6c
1 changed files with 4 additions and 0 deletions

View File

@ -535,6 +535,8 @@ class OperandTypeIterator final
static Type unwrap(Value *value) { return value->getType(); }
public:
using reference = Type;
/// Initializes the operand type iterator to the specified operand iterator.
OperandTypeIterator(OperandIterator it)
: llvm::mapped_iterator<OperandIterator, Type (*)(Value *)>(it, &unwrap) {
@ -586,6 +588,8 @@ class ResultTypeIterator final
static Type unwrap(Value *value) { return value->getType(); }
public:
using reference = Type;
/// Initializes the result type iterator to the specified result iterator.
ResultTypeIterator(ResultIterator it)
: llvm::mapped_iterator<ResultIterator, Type (*)(Value *)>(it, &unwrap) {}