Skip to content

Commit

Permalink
Give MachineFunctionAnalysis a destructor so it can verify that
Browse files Browse the repository at this point in the history
that it released its allocated memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77775 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Dan Gohman committed Aug 1, 2009
1 parent 8a0336a commit f940833
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/llvm/CodeGen/MachineFunctionAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct MachineFunctionAnalysis : public FunctionPass {
static char ID;
explicit MachineFunctionAnalysis(TargetMachine &tm,
CodeGenOpt::Level OL = CodeGenOpt::Default);

~MachineFunctionAnalysis();

MachineFunction &getMF() const { return *MF; }
CodeGenOpt::Level getOptLevel() const { return OptLevel; }
Expand Down
4 changes: 4 additions & 0 deletions lib/CodeGen/MachineFunctionAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f940833

Please sign in to comment.