[llvm] r276902 - CodeGen: Make iterator-to-pointer conversion explicit, NFC

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 11:45:18 PDT 2016


Author: dexonsmith
Date: Wed Jul 27 13:45:18 2016
New Revision: 276902

URL: http://llvm.org/viewvc/llvm-project?rev=276902&view=rev
Log:
CodeGen: Make iterator-to-pointer conversion explicit, NFC

Remove the implicit conversion from MachineInstrBundleIterator to
MachineInstr*, leaving behind an explicit conversion.

I *think* this is the last ilist_iterator-related implicit conversion to
ilist_node subclass.  If I'm right, I can finally dig in and fix the UB
in ilist that these conversions were relying on.

Note that the implicit users of this conversion have already been
removed.  If you have out-of-tree code that doesn't update, you might be
able to buy some time by temporarily reverting this commit.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h?rev=276902&r1=276901&r2=276902&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstrBundleIterator.h Wed Jul 27 13:45:18 2016
@@ -50,8 +50,8 @@ public:
   Ty &operator*() const { return *MII; }
   Ty *operator->() const { return &operator*(); }
 
-  // FIXME: This conversion should be explicit.
-  operator Ty *() const { return MII.getNodePtrUnchecked(); }
+  // FIXME: This should be implemented as "return &operator*()" (or removed).
+  explicit operator Ty *() const { return MII.getNodePtrUnchecked(); }
 
   bool operator==(const MachineInstrBundleIterator &X) const {
     return MII == X.MII;




More information about the llvm-commits mailing list