[llvm] r243788 - -Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated in C++11

David Blaikie dblaikie at gmail.com
Fri Jul 31 14:37:09 PDT 2015


Author: dblaikie
Date: Fri Jul 31 16:37:09 2015
New Revision: 243788

URL: http://llvm.org/viewvc/llvm-project?rev=243788&view=rev
Log:
-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated in C++11

Modified:
    llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h
    llvm/trunk/lib/Analysis/DependenceAnalysis.cpp

Modified: llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h?rev=243788&r1=243787&r2=243788&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/DependenceAnalysis.h Fri Jul 31 16:37:09 2015
@@ -69,6 +69,9 @@ namespace llvm {
   /// as singly-linked lists, with the "next" fields stored in the dependence
   /// itelf.
   class Dependence {
+  protected:
+    Dependence(const Dependence &) = default;
+
   public:
     Dependence(Instruction *Source,
                Instruction *Destination) :
@@ -216,11 +219,10 @@ namespace llvm {
   /// (for output, flow, and anti dependences), the dependence implies an
   /// ordering, where the source must precede the destination; in contrast,
   /// input dependences are unordered.
-  class FullDependence : public Dependence {
+  class FullDependence final : public Dependence {
   public:
     FullDependence(Instruction *Src, Instruction *Dst, bool LoopIndependent,
                    unsigned Levels);
-    ~FullDependence() override { delete[] DV; }
 
     /// isLoopIndependent - Returns true if this is a loop-independent
     /// dependence.
@@ -268,7 +270,7 @@ namespace llvm {
     unsigned short Levels;
     bool LoopIndependent;
     bool Consistent; // Init to true, then refine.
-    DVEntry *DV;
+    std::unique_ptr<DVEntry[]> DV;
     friend class DependenceAnalysis;
   };
 

Modified: llvm/trunk/lib/Analysis/DependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DependenceAnalysis.cpp?rev=243788&r1=243787&r2=243788&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/DependenceAnalysis.cpp Fri Jul 31 16:37:09 2015
@@ -233,7 +233,8 @@ FullDependence::FullDependence(Instructi
     : Dependence(Source, Destination), Levels(CommonLevels),
       LoopIndependent(PossiblyLoopIndependent) {
   Consistent = true;
-  DV = CommonLevels ? new DVEntry[CommonLevels] : nullptr;
+  if (CommonLevels)
+    DV = make_unique<DVEntry[]>(CommonLevels);
 }
 
 // The rest are simple getters that hide the implementation.
@@ -3746,9 +3747,7 @@ DependenceAnalysis::depends(Instruction
       return nullptr;
   }
 
-  auto Final = make_unique<FullDependence>(Result);
-  Result.DV = nullptr;
-  return std::move(Final);
+  return make_unique<FullDependence>(std::move(Result));
 }
 
 





More information about the llvm-commits mailing list