mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Fixed two double free bugs that caused llc to segfault or run forever.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8191 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -53,10 +53,18 @@ SchedGraphNode::SchedGraphNode(unsigned NID, MachineBasicBlock *mbb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Method: SchedGraphNode Destructor
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Free memory allocated by the SchedGraphNode object.
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
// Do not delete the edges here. The base class will take care of that.
|
||||||
|
// Only handle subclass specific stuff here (where currently there is
|
||||||
|
// none).
|
||||||
|
//
|
||||||
SchedGraphNode::~SchedGraphNode() {
|
SchedGraphNode::~SchedGraphNode() {
|
||||||
// for each node, delete its out-edges
|
|
||||||
std::for_each(beginOutEdges(), endOutEdges(),
|
|
||||||
deleter<SchedGraphEdge>);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -67,11 +75,19 @@ SchedGraph::SchedGraph(MachineBasicBlock &mbb, const TargetMachine& target)
|
|||||||
buildGraph(target);
|
buildGraph(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Method: SchedGraph Destructor
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// This method deletes memory allocated by the SchedGraph object.
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
// Do not delete the graphRoot or graphLeaf here. The base class handles
|
||||||
|
// that bit of work.
|
||||||
|
//
|
||||||
SchedGraph::~SchedGraph() {
|
SchedGraph::~SchedGraph() {
|
||||||
for (const_iterator I = begin(); I != end(); ++I)
|
for (const_iterator I = begin(); I != end(); ++I)
|
||||||
delete I->second;
|
delete I->second;
|
||||||
delete graphRoot;
|
|
||||||
delete graphLeaf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedGraph::dump() const {
|
void SchedGraph::dump() const {
|
||||||
|
@ -53,10 +53,18 @@ SchedGraphNode::SchedGraphNode(unsigned NID, MachineBasicBlock *mbb,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Method: SchedGraphNode Destructor
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// Free memory allocated by the SchedGraphNode object.
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
// Do not delete the edges here. The base class will take care of that.
|
||||||
|
// Only handle subclass specific stuff here (where currently there is
|
||||||
|
// none).
|
||||||
|
//
|
||||||
SchedGraphNode::~SchedGraphNode() {
|
SchedGraphNode::~SchedGraphNode() {
|
||||||
// for each node, delete its out-edges
|
|
||||||
std::for_each(beginOutEdges(), endOutEdges(),
|
|
||||||
deleter<SchedGraphEdge>);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -67,11 +75,19 @@ SchedGraph::SchedGraph(MachineBasicBlock &mbb, const TargetMachine& target)
|
|||||||
buildGraph(target);
|
buildGraph(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Method: SchedGraph Destructor
|
||||||
|
//
|
||||||
|
// Description:
|
||||||
|
// This method deletes memory allocated by the SchedGraph object.
|
||||||
|
//
|
||||||
|
// Notes:
|
||||||
|
// Do not delete the graphRoot or graphLeaf here. The base class handles
|
||||||
|
// that bit of work.
|
||||||
|
//
|
||||||
SchedGraph::~SchedGraph() {
|
SchedGraph::~SchedGraph() {
|
||||||
for (const_iterator I = begin(); I != end(); ++I)
|
for (const_iterator I = begin(); I != end(); ++I)
|
||||||
delete I->second;
|
delete I->second;
|
||||||
delete graphRoot;
|
|
||||||
delete graphLeaf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SchedGraph::dump() const {
|
void SchedGraph::dump() const {
|
||||||
|
Reference in New Issue
Block a user