[PATCH] D11911: Initialize base class by move constructor instead of copy constructor

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 09:57:55 PDT 2015


aaron.ballman created this revision.
aaron.ballman added a reviewer: dblaikie.
aaron.ballman added a subscriber: llvm-commits.

The move constructor for FullDependence is initializing the base class via a copy constructor instead of a move constructor. This patch adds a default move constructor to the base class, and makes use of it from the derived class instead of half-moving/half-copying the object.

I'm not certain if this was accidentally forgotten as part of r243791, or was purposeful.

~Aaron

http://reviews.llvm.org/D11911

Files:
  include/llvm/Analysis/DependenceAnalysis.h

Index: include/llvm/Analysis/DependenceAnalysis.h
===================================================================
--- include/llvm/Analysis/DependenceAnalysis.h
+++ include/llvm/Analysis/DependenceAnalysis.h
@@ -71,6 +71,7 @@
   class Dependence {
   protected:
     Dependence(const Dependence &) = default;
+    Dependence(Dependence &&) = default;
 
   public:
     Dependence(Instruction *Source,
@@ -225,7 +226,7 @@
                    unsigned Levels);
 
     FullDependence(FullDependence &&RHS)
-        : Dependence(RHS), Levels(RHS.Levels),
+        : Dependence(std::move(RHS)), Levels(RHS.Levels),
           LoopIndependent(RHS.LoopIndependent), Consistent(RHS.Consistent),
           DV(std::move(RHS.DV)) {}
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11911.31680.patch
Type: text/x-patch
Size: 729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150810/13e823c5/attachment.bin>


More information about the llvm-commits mailing list