[PATCH] D97522: Fix the value_type of defusechain_iterator to match its operator*()

Nicolas Guillemot via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 19:03:34 PST 2021


nlguillemot created this revision.
nlguillemot requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97522

Files:
  llvm/include/llvm/CodeGen/MachineRegisterInfo.h


Index: llvm/include/llvm/CodeGen/MachineRegisterInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineRegisterInfo.h
+++ llvm/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -1008,10 +1008,10 @@
     }
 
   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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97522.326580.patch
Type: text/x-patch
Size: 858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210226/80e4b3bb/attachment.bin>


More information about the llvm-commits mailing list