[PATCH] D35419: [CodeGen] Add begin-end iterators to MachineInstr

Eric Christopher via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 10:07:07 PDT 2017


echristo added inline comments.


================
Comment at: lib/Target/ARM/ARMMCInstLower.cpp:156
 
-  for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
-    const MachineOperand &MO = MI->getOperand(i);
-
+  for (auto MO : *MI) {
     MCOperand MCOp;
----------------
rovka wrote:
> Unless I'm missing something (Friday evening etc etc), you can use 
> ```
> for (const auto &MO : MI->operands())
> ``` 
> to the same effect.
Agreed, and it's more clear what you mean here.


https://reviews.llvm.org/D35419





More information about the llvm-commits mailing list