[llvm] r232297 - IntervalIterator: Add move semantics rather than relying on broken implicit copy ctor (found with -Wdeprecated)

David Blaikie dblaikie at gmail.com
Sat Mar 14 18:21:34 PDT 2015


Author: dblaikie
Date: Sat Mar 14 20:21:34 2015
New Revision: 232297

URL: http://llvm.org/viewvc/llvm-project?rev=232297&view=rev
Log:
IntervalIterator: Add move semantics rather than relying on broken implicit copy ctor (found with -Wdeprecated)

We were just getting lucky because the copy ctor would be elided by RVO.

Modified:
    llvm/trunk/include/llvm/Analysis/IntervalIterator.h

Modified: llvm/trunk/include/llvm/Analysis/IntervalIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IntervalIterator.h?rev=232297&r1=232296&r2=232297&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/IntervalIterator.h (original)
+++ llvm/trunk/include/llvm/Analysis/IntervalIterator.h Sat Mar 14 20:21:34 2015
@@ -105,6 +105,12 @@ public:
     }
   }
 
+  IntervalIterator(IntervalIterator &&x)
+      : IntStack(std::move(x.IntStack)), Visited(std::move(x.Visited)),
+        OrigContainer(x.OrigContainer), IOwnMem(x.IOwnMem) {
+    x.IOwnMem = false;
+  }
+
   IntervalIterator(IntervalPartition &IP, bool OwnMemory) : IOwnMem(OwnMemory) {
     OrigContainer = &IP;
     if (!ProcessInterval(IP.getRootInterval())) {





More information about the llvm-commits mailing list