[llvm-commits] [llvm] r155225 - /llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h

Andrew Trick atrick at apple.com
Fri Apr 20 13:05:19 PDT 2012


Author: atrick
Date: Fri Apr 20 15:05:19 2012
New Revision: 155225

URL: http://llvm.org/viewvc/llvm-project?rev=155225&view=rev
Log:
Allow converting MachineBasicBlock::iterator to const_iterator.

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

Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=155225&r1=155224&r2=155225&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Fri Apr 20 15:05:19 2012
@@ -156,7 +156,10 @@
       assert((!mi || !mi->isInsideBundle()) &&
              "It's not legal to initialize bundle_iterator with a bundled MI");
     }
-    bundle_iterator(const bundle_iterator &I) : MII(I.MII) {}
+    // Template allows conversion from const to nonconst.
+    template<class OtherTy, class OtherIterTy>
+    bundle_iterator(const bundle_iterator<OtherTy, OtherIterTy> &I)
+      : MII(I.getInstrIterator()) {}
     bundle_iterator() : MII(0) {}
 
     Ty &operator*() const { return *MII; }





More information about the llvm-commits mailing list