Allow converting MachineBasicBlock::iterator to const_iterator.
authorAndrew Trick <atrick@apple.com>
Fri, 20 Apr 2012 20:05:19 +0000 (20:05 +0000)
committerAndrew Trick <atrick@apple.com>
Fri, 20 Apr 2012 20:05:19 +0000 (20:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155225 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineBasicBlock.h

index ef9c0c200584a9f3194f2d8c9e856383b6d75f41..18df69ee92be2c2cd7d47c161a5e6c09e9e60c20 100644 (file)
@@ -156,7 +156,10 @@ public:
       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; }