Skip to content

Commit 6fb6bdf

Browse files
committed
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
1 parent 8adfb38 commit 6fb6bdf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/include/llvm/CodeGen/MachineRegisterInfo.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -968,10 +968,10 @@ class MachineRegisterInfo {
968968
/// returns defs. If neither are true then you are silly and it always
969969
/// returns end(). If SkipDebug is true it skips uses marked Debug
970970
/// when incrementing.
971-
template<bool ReturnUses, bool ReturnDefs, bool SkipDebug,
972-
bool ByOperand, bool ByInstr, bool ByBundle>
973-
class defusechain_iterator
974-
: public std::iterator<std::forward_iterator_tag, MachineInstr, ptrdiff_t> {
971+
template <bool ReturnUses, bool ReturnDefs, bool SkipDebug, bool ByOperand,
972+
bool ByInstr, bool ByBundle>
973+
class defusechain_iterator : public std::iterator<std::forward_iterator_tag,
974+
MachineOperand, ptrdiff_t> {
975975
friend class MachineRegisterInfo;
976976

977977
MachineOperand *Op = nullptr;
@@ -1008,10 +1008,10 @@ class MachineRegisterInfo {
10081008
}
10091009

10101010
public:
1011-
using reference = std::iterator<std::forward_iterator_tag,
1012-
MachineInstr, ptrdiff_t>::reference;
1013-
using pointer = std::iterator<std::forward_iterator_tag,
1014-
MachineInstr, ptrdiff_t>::pointer;
1011+
using reference = std::iterator<std::forward_iterator_tag, MachineOperand,
1012+
ptrdiff_t>::reference;
1013+
using pointer = std::iterator<std::forward_iterator_tag, MachineOperand,
1014+
ptrdiff_t>::pointer;
10151015

10161016
defusechain_iterator() = default;
10171017

0 commit comments

Comments
 (0)