From 4c20864f947294afcde209c5bf8c6ad9e87351b2 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Fri, 31 Jul 2015 21:37:09 +0000 Subject: [PATCH] -Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated in C++11 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243788 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DependenceAnalysis.h | 8 +++++--- lib/Analysis/DependenceAnalysis.cpp | 7 +++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/llvm/Analysis/DependenceAnalysis.h b/include/llvm/Analysis/DependenceAnalysis.h index a08ce574ea5..21358bddc21 100644 --- a/include/llvm/Analysis/DependenceAnalysis.h +++ b/include/llvm/Analysis/DependenceAnalysis.h @@ -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 DV; friend class DependenceAnalysis; }; diff --git a/lib/Analysis/DependenceAnalysis.cpp b/lib/Analysis/DependenceAnalysis.cpp index 4826ac407d7..16e42ce6231 100644 --- a/lib/Analysis/DependenceAnalysis.cpp +++ b/lib/Analysis/DependenceAnalysis.cpp @@ -233,7 +233,8 @@ FullDependence::FullDependence(Instruction *Source, Instruction *Destination, : Dependence(Source, Destination), Levels(CommonLevels), LoopIndependent(PossiblyLoopIndependent) { Consistent = true; - DV = CommonLevels ? new DVEntry[CommonLevels] : nullptr; + if (CommonLevels) + DV = make_unique(CommonLevels); } // The rest are simple getters that hide the implementation. @@ -3746,9 +3747,7 @@ DependenceAnalysis::depends(Instruction *Src, Instruction *Dst, return nullptr; } - auto Final = make_unique(Result); - Result.DV = nullptr; - return std::move(Final); + return make_unique(std::move(Result)); } -- 2.34.1