From 6e274fd1abcd25db684554815c45b0ea53006e99 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 3 Mar 2015 19:20:18 +0000 Subject: [PATCH] unique_ptrify FullDependenceAnalysis::DV Making this type a little harder to abuse (see workaround relating to use of the implicit copy ctor in the prior commit) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231104 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DependenceAnalysis.h | 5 +---- lib/Analysis/DependenceAnalysis.cpp | 14 +++++--------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/include/llvm/Analysis/DependenceAnalysis.h b/include/llvm/Analysis/DependenceAnalysis.h index e01aa549099..9169b7028b7 100644 --- a/include/llvm/Analysis/DependenceAnalysis.h +++ b/include/llvm/Analysis/DependenceAnalysis.h @@ -221,9 +221,6 @@ namespace llvm { Instruction *Dst, bool LoopIndependent, unsigned Levels); - ~FullDependence() { - delete[] DV; - } /// isLoopIndependent - Returns true if this is a loop-independent /// dependence. @@ -270,7 +267,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 393ee5c516a..d5d2fb2088c 100644 --- a/lib/Analysis/DependenceAnalysis.cpp +++ b/lib/Analysis/DependenceAnalysis.cpp @@ -226,16 +226,12 @@ bool Dependence::isScalar(unsigned level) const { //===----------------------------------------------------------------------===// // FullDependence methods -FullDependence::FullDependence(Instruction *Source, - Instruction *Destination, +FullDependence::FullDependence(Instruction *Source, Instruction *Destination, bool PossiblyLoopIndependent, - unsigned CommonLevels) : - Dependence(Source, Destination), - Levels(CommonLevels), - LoopIndependent(PossiblyLoopIndependent) { - Consistent = true; - DV = CommonLevels ? new DVEntry[CommonLevels] : nullptr; -} + unsigned CommonLevels) + : Dependence(Source, Destination), Levels(CommonLevels), + LoopIndependent(PossiblyLoopIndependent), Consistent(true), + DV(CommonLevels ? new DVEntry[CommonLevels] : nullptr) {} // The rest are simple getters that hide the implementation. -- 2.34.1