From c120612daa5eb17d17dd66f468db26e6409ca486 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sat, 1 Aug 2009 04:19:43 +0000 Subject: [PATCH] Give MachineFunctionAnalysis a destructor so it can verify that that it released its allocated memory. llvm-svn: 77775 --- llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h | 2 +- llvm/lib/CodeGen/MachineFunctionAnalysis.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h index 5f1ff56af941..d020a7b4c73b 100644 --- a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h +++ b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h @@ -33,7 +33,7 @@ public: static char ID; explicit MachineFunctionAnalysis(TargetMachine &tm, CodeGenOpt::Level OL = CodeGenOpt::Default); - + ~MachineFunctionAnalysis(); MachineFunction &getMF() const { return *MF; } CodeGenOpt::Level getOptLevel() const { return OptLevel; } diff --git a/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp b/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp index 8b7dba8121dc..ae9d5a99c04d 100644 --- a/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp +++ b/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp @@ -29,6 +29,10 @@ MachineFunctionAnalysis::MachineFunctionAnalysis(TargetMachine &tm, FunctionPass(&ID), TM(tm), OptLevel(OL), MF(0) { } +MachineFunctionAnalysis::~MachineFunctionAnalysis() { + assert(!MF && "MachineFunctionAnalysis left initialized!"); +} + bool MachineFunctionAnalysis::runOnFunction(Function &F) { assert(!MF && "MachineFunctionAnalysis already initialized!"); MF = new MachineFunction(&F, TM);