Fix the value_type of defusechain_iterator to match its operator*()

defusechain_iterator has an operator*() and operator->() that return
references to a MachineOperand, but its "reference" and "pointer"
typedefs are set as if the iterator returns a MachineInstr reference.
This causes compilation errors when defusechain_iterator is used in
generic code that uses the "reference" and "pointer" typedefs.
This patch fixes this by updating the typedefs to use MachineOperand
instead of MachineInstr.

Reviewed By: mkitzan

Differential Revision: https://reviews.llvm.org/D97522
This commit is contained in:
Nicolas Guillemot 2021-02-25 18:56:51 -08:00
parent 8adfb38224
commit 6fb6bdff37
1 changed files with 8 additions and 8 deletions

View File

@ -968,10 +968,10 @@ public:
/// returns defs. If neither are true then you are silly and it always
/// returns end(). If SkipDebug is true it skips uses marked Debug
/// when incrementing.
template<bool ReturnUses, bool ReturnDefs, bool SkipDebug,
bool ByOperand, bool ByInstr, bool ByBundle>
class defusechain_iterator
: public std::iterator<std::forward_iterator_tag, MachineInstr, ptrdiff_t> {
template <bool ReturnUses, bool ReturnDefs, bool SkipDebug, bool ByOperand,
bool ByInstr, bool ByBundle>
class defusechain_iterator : public std::iterator<std::forward_iterator_tag,
MachineOperand, ptrdiff_t> {
friend class MachineRegisterInfo;
MachineOperand *Op = nullptr;
@ -1008,10 +1008,10 @@ public:
}
public:
using reference = std::iterator<std::forward_iterator_tag,
MachineInstr, ptrdiff_t>::reference;
using pointer = std::iterator<std::forward_iterator_tag,
MachineInstr, ptrdiff_t>::pointer;
using reference = std::iterator<std::forward_iterator_tag, MachineOperand,
ptrdiff_t>::reference;
using pointer = std::iterator<std::forward_iterator_tag, MachineOperand,
ptrdiff_t>::pointer;
defusechain_iterator() = default;