[Scummvm-cvs-logs] SF.net SVN: scummvm:[50699] tools/branches/gsoc2010-decompiler/decompiler
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Mon Jul 5 20:45:35 CEST 2010
Revision: 50699
http://scummvm.svn.sourceforge.net/scummvm/?rev=50699&view=rev
Author: pidgeot
Date: 2010-07-05 18:45:34 +0000 (Mon, 05 Jul 2010)
Log Message:
-----------
Attempt at using smart pointers for Group properties - committing to
test with valgrind on other machine
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
tools/branches/gsoc2010-decompiler/decompiler/control_flow.h
tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp
tools/branches/gsoc2010-decompiler/decompiler/graph.h
tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h
Modified: tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp 2010-07-05 18:18:40 UTC (rev 50698)
+++ tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp 2010-07-05 18:45:34 UTC (rev 50699)
@@ -37,7 +37,7 @@
GraphVertex last;
bool addEdge = false;
int id = 0;
- Group *prev = NULL;
+ GroupPtr prev = NULL;
for (ConstInstIterator it = insts.begin(); it != insts.end(); ++it) {
GraphVertex cur = boost::add_vertex(_g);
@@ -84,8 +84,8 @@
void ControlFlow::merge(GraphVertex g1, GraphVertex g2) {
// Update property
- Group *gr1 = GET(g1);
- Group *gr2 = GET(g2);
+ GroupPtr gr1 = GET(g1);
+ GroupPtr gr2 = GET(g2);
gr1->_end = gr2->_end;
PUT(g1, gr1);
@@ -112,11 +112,11 @@
// Remove vertex
boost::remove_vertex(g2, _g);
// Delete old group
- delete gr2;
+ //delete gr2;
}
void ControlFlow::setStackLevel(GraphVertex g, int level) {
- Group *gr = GET(g);
+ GroupPtr gr = GET(g);
if (gr->_stackLevel != -1) {
if (gr->_stackLevel != level)
std::cerr << boost::format("WARNING: Inconsistency in expected stack level for instruction at address 0x%08x (current: %d, requested: %d)\n") % gr->_start->_address % gr->_stackLevel % level;
@@ -150,8 +150,8 @@
if (in_degree(cur, _g) == 0 && out_degree(cur, _g) == 0)
continue;
- Group *grCur = GET(cur);
- Group *grNext = GET(next);
+ GroupPtr grCur = GET(cur);
+ GroupPtr grNext = GET(next);
expectedStackLevel = grCur->_stackLevel;
if (expectedStackLevel > grNext->_stackLevel)
@@ -187,7 +187,7 @@
ConstInstIterator lastInst = _insts.end();
--lastInst;
GraphVertex cur = find(lastInst);
- Group *gr = GET(cur);
+ GroupPtr gr = GET(cur);
while (gr->_prev != NULL) {
bool doMerge = false;
cur = find(gr->_start);
@@ -232,13 +232,13 @@
void ControlFlow::detectWhile() {
VertexRange vr = boost::vertices(_g);
for (VertexIterator v = vr.first; v != vr.second; ++v) {
- Group *gr = GET(*v);
+ GroupPtr gr = GET(*v);
// Undetermined block that ends with conditional jump
if (out_degree(*v, _g) == 2 && gr->_type == kNormal) {
InEdgeRange ier = boost::in_edges(*v, _g);
bool isWhile = false;
for (InEdgeIterator e = ier.first; e != ier.second; ++e) {
- Group *sourceGr = GET(boost::source(*e, _g));
+ GroupPtr sourceGr = GET(boost::source(*e, _g));
// Block has ingoing edge from block later in the code that isn't a do-while condition
if (sourceGr->_start->_address > gr->_start->_address && sourceGr->_type != kDoWhileCond)
isWhile = true;
@@ -252,12 +252,12 @@
void ControlFlow::detectDoWhile() {
VertexRange vr = boost::vertices(_g);
for (VertexIterator v = vr.first; v != vr.second; ++v) {
- Group *gr = GET(*v);
+ GroupPtr gr = GET(*v);
// Undetermined block that ends with conditional jump...
if (out_degree(*v, _g) == 2 && gr->_type == kNormal) {
OutEdgeRange oer = boost::out_edges(*v, _g);
for (OutEdgeIterator e = oer.first; e != oer.second; ++e) {
- Group *targetGr = GET(boost::target(*e, _g));
+ GroupPtr targetGr = GET(boost::target(*e, _g));
// ...to earlier in code
if (targetGr->_start->_address < gr->_start->_address)
gr->_type = kDoWhileCond;
@@ -269,18 +269,18 @@
void ControlFlow::detectBreak() {
VertexRange vr = boost::vertices(_g);
for (VertexIterator v = vr.first; v != vr.second; ++v) {
- Group *gr = GET(*v);
+ GroupPtr gr = GET(*v);
// Undetermined block with unconditional jump...
if (gr->_type == kNormal && (gr->_end->_type == kJump || gr->_end->_type == kJumpRel) && out_degree(*v, _g) == 1) {
OutEdgeIterator oe = boost::out_edges(*v, _g).first;
GraphVertex target = boost::target(*oe, _g);
- Group *targetGr = GET(target);
+ GroupPtr targetGr = GET(target);
// ...to somewhere later in the code...
if (gr->_start->_address >= targetGr->_start->_address)
continue;
InEdgeRange ier = boost::in_edges(target, _g);
for (InEdgeIterator ie = ier.first; ie != ier.second; ++ie) {
- Group *sourceGr = GET(boost::source(*ie, _g));
+ GroupPtr sourceGr = GET(boost::source(*ie, _g));
// ...to block immediately after a do-while condition, or to jump target of a while condition
if ((targetGr->_prev == sourceGr && sourceGr->_type == kDoWhileCond) || sourceGr->_type == kWhileCond) {
if (validateBreakOrContinue(gr, sourceGr))
@@ -294,12 +294,12 @@
void ControlFlow::detectContinue() {
VertexRange vr = boost::vertices(_g);
for (VertexIterator v = vr.first; v != vr.second; ++v) {
- Group *gr = GET(*v);
+ GroupPtr gr = GET(*v);
// Undetermined block with unconditional jump...
if (gr->_type == kNormal && (gr->_end->_type == kJump || gr->_end->_type == kJumpRel) && out_degree(*v, _g) == 1) {
OutEdgeIterator oe = boost::out_edges(*v, _g).first;
GraphVertex target = boost::target(*oe, _g);
- Group *targetGr = GET(target);
+ GroupPtr targetGr = GET(target);
// ...to a while or do-while condition...
if (targetGr->_type == kWhileCond || targetGr->_type == kDoWhileCond) {
bool isContinue = true;
@@ -320,8 +320,8 @@
}
}
-bool ControlFlow::validateBreakOrContinue(Group *gr, Group *condGr) {
- Group *from, *to, *cursor;
+bool ControlFlow::validateBreakOrContinue(GroupPtr gr, GroupPtr condGr) {
+ GroupPtr from, to, cursor;
if (condGr->_type == kDoWhileCond) {
to = condGr;
@@ -338,14 +338,14 @@
OutEdgeRange oerValidate = boost::out_edges(find(cursor->_start), _g);
for (OutEdgeIterator oeValidate = oerValidate.first; oeValidate != oerValidate.second; ++oeValidate) {
GraphVertex vValidate = boost::target(*oeValidate, _g);
- Group *gValidate = GET(vValidate);
+ GroupPtr gValidate = GET(vValidate);
// For all other loops of same type found in range, all targets must fall within that range
if (gValidate->_start->_address < from->_start->_address || gValidate->_start->_address > to->_start->_address )
return false;
InEdgeRange ierValidate = boost::in_edges(vValidate, _g);
for (InEdgeIterator ieValidate = ierValidate.first; ieValidate != ierValidate.second; ++ieValidate) {
- Group *igValidate = GET(boost::source(*ieValidate, _g));
+ GroupPtr igValidate = GET(boost::source(*ieValidate, _g));
// All loops of other type going into range must be placed within range
if (igValidate->_type == ogt && (igValidate->_start->_address < from->_start->_address || igValidate->_start->_address > to->_start->_address ))
return false;
@@ -359,7 +359,7 @@
void ControlFlow::detectIf() {
VertexRange vr = boost::vertices(_g);
for (VertexIterator v = vr.first; v != vr.second; ++v) {
- Group *gr = GET(*v);
+ GroupPtr gr = GET(*v);
// if: Undetermined block with conditional jump
if (gr->_type == kNormal && out_degree(*v, _g) == 2) {
gr->_type = kIfCond;
@@ -367,7 +367,7 @@
OutEdgeRange oer = boost::out_edges(*v, _g);
GraphVertex target;
uint32 maxAddress = 0;
- Group *targetGr;
+ GroupPtr targetGr;
// Find jump target
for (OutEdgeIterator oe = oer.first; oe != oer.second; ++oe) {
targetGr = GET(boost::target(*oe, _g));
@@ -385,7 +385,7 @@
continue;
// ...to later in the code
OutEdgeIterator toe = boost::out_edges(find(targetGr->_prev->_start->_address), _g).first;
- Group *targetTargetGr = GET(boost::target(*toe, _g));
+ GroupPtr targetTargetGr = GET(boost::target(*toe, _g));
if (targetTargetGr->_start->_address > targetGr->_prev->_end->_address) {
targetGr->_startElse = true;
targetTargetGr->_prev->_endElse = true;
Modified: tools/branches/gsoc2010-decompiler/decompiler/control_flow.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/control_flow.h 2010-07-05 18:18:40 UTC (rev 50698)
+++ tools/branches/gsoc2010-decompiler/decompiler/control_flow.h 2010-07-05 18:45:34 UTC (rev 50699)
@@ -108,7 +108,7 @@
* @param condGr The group containing the respective loop condition.
* @returns True if the validation succeeded, false if it did not.
*/
- bool validateBreakOrContinue(Group *gr, Group *targetGr);
+ bool validateBreakOrContinue(GroupPtr gr, GroupPtr targetGr);
/**
* Detects if and else blocks.
Modified: tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp 2010-07-05 18:18:40 UTC (rev 50698)
+++ tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp 2010-07-05 18:45:34 UTC (rev 50699)
@@ -152,9 +152,6 @@
// TODO: Code generation
// Free memory
- VertexRange vr = boost::vertices(g);
- for (VertexIterator v = vr.first; v != vr.second; ++v)
- delete boost::get(boost::vertex_name, g, *v);
delete engine;
} catch (std::exception& e) {
std::cerr << "ERROR: " << e.what() << "\n";
Modified: tools/branches/gsoc2010-decompiler/decompiler/graph.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/graph.h 2010-07-05 18:18:40 UTC (rev 50698)
+++ tools/branches/gsoc2010-decompiler/decompiler/graph.h 2010-07-05 18:45:34 UTC (rev 50699)
@@ -33,6 +33,8 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
+#include <boost/intrusive_ptr.hpp>
+
/**
* Enumeration representing the different kinds of groups.
*/
@@ -45,26 +47,41 @@
kContinue ///< Group is a continue.
};
+struct Group;
+
/**
+ * Pointer to a Group.
+ */
+typedef boost::intrusive_ptr<Group> GroupPtr;
+
+namespace boost {
+ inline void intrusive_ptr_add_ref(Group *p);
+ inline void intrusive_ptr_release(Group *p);
+}
+
+/**
* Structure representing a group of instructions.
*/
struct Group {
- ConstInstIterator _start; ///< First instruction in the group.
- ConstInstIterator _end; ///< Last instruction in the group.
- int _stackLevel; ///< Level of the stack upon entry.
- GroupType _type; ///< Type of the group.
- bool _startElse; ///< Group is start of an else block.
- bool _endElse; ///< Group is end of an else block.
+private:
+ long _refCount; ///< Reference count used for boost::intrusive_ptr.
+ friend void ::boost::intrusive_ptr_add_ref(Group *p);
+ friend void ::boost::intrusive_ptr_release(Group *p);
+
+public:
+ ConstInstIterator _start; ///< First instruction in the group.
+ ConstInstIterator _end; ///< Last instruction in the group.
+ int _stackLevel; ///< Level of the stack upon entry.
+ GroupType _type; ///< Type of the group.
+ bool _startElse; ///< Group is start of an else block.
+ bool _endElse; ///< Group is end of an else block.
Group *_prev; ///< Pointer to the previous group, when ordered by address. Used for short-circuit analysis.
Group *_next; ///< Pointer to the next group, when ordered by address.
-
+
/**
* Parameterless constructor for Group. Required for use with STL and Boost, should not be called manually.
*/
- Group() {
- _stackLevel = -1;
- _type = kNormal;
- }
+ Group() : _refCount(0), _stackLevel(-1), _type(kNormal) { }
/**
* Constructor for Group.
@@ -73,12 +90,12 @@
* @param end Last instruction in the group.
* @param prev Pointer to the previous group, when ordered by address.
*/
- Group(ConstInstIterator start, ConstInstIterator end, Group *prev) {
+ Group(ConstInstIterator start, ConstInstIterator end, GroupPtr prev) : _refCount(0) {
_start = start;
_end = end;
_stackLevel = -1;
_type = kNormal;
- _prev = prev;
+ _prev = prev.get();
_startElse = false;
_endElse = false;
if (_prev != NULL)
@@ -93,7 +110,7 @@
* @param group The Group to output.
* @return The std::ostream used for output.
*/
- friend std::ostream &operator<<(std::ostream &output, Group *group) {
+ friend std::ostream &operator<<(std::ostream &output, GroupPtr group) {
output << "Block type: ";
switch(group->_type) {
case kNormal:
@@ -145,10 +162,27 @@
}
};
+namespace boost {
+ /**
+ * Add a reference to a pointer.
+ */
+ inline void intrusive_ptr_add_ref(Group *p) {
+ ++(p->_refCount);
+ }
+
+ /**
+ * Remove a reference from a pointer.
+ */
+ inline void intrusive_ptr_release(Group *p) {
+ if (--(p->_refCount) == 0)
+ delete p;
+ }
+}
+
/**
* Type representing properties containing a pointer to a Group.
*/
-typedef boost::property<boost::vertex_name_t, Group *> GroupProperty;
+typedef boost::property<boost::vertex_name_t, GroupPtr> GroupProperty;
/**
* Type representing properties containing an index, followed by a GroupProperty.
Modified: tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h 2010-07-05 18:18:40 UTC (rev 50698)
+++ tools/branches/gsoc2010-decompiler/decompiler/test/cfg_test.h 2010-07-05 18:45:34 UTC (rev 50699)
@@ -43,7 +43,7 @@
TS_ASSERT(boost::num_vertices(g) == 4);
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
switch (gr->_start->_address) {
case 0:
TS_ASSERT(boost::in_degree(*it, g) == 0 && boost::out_degree(*it, g) == 1);
@@ -60,7 +60,6 @@
default:
TS_ASSERT(false);
}
- delete gr;
}
delete c;
delete engine;
@@ -77,7 +76,7 @@
TS_ASSERT(boost::num_vertices(g) == 4);
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
switch (gr->_start->_address) {
case 0:
TS_ASSERT(boost::in_degree(*it, g) == 0 && boost::out_degree(*it, g) == 1);
@@ -94,7 +93,6 @@
default:
TS_ASSERT(false);
}
- delete gr;
}
delete c;
delete engine;
@@ -112,7 +110,7 @@
TS_ASSERT(boost::num_vertices(g) == 3);
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
switch (gr->_start->_address) {
case 0:
TS_ASSERT(gr->_end->_address == 2);
@@ -128,7 +126,6 @@
TS_ASSERT(false);
break;
}
- delete gr;
}
delete c;
delete engine;
@@ -144,9 +141,6 @@
c->createGroups();
Graph g = c->getGraph();
TS_ASSERT(boost::num_vertices(g) == 3);
- VertexRange vr = boost::vertices(g);
- for (VertexIterator v = vr.first; v != vr.second; ++v)
- delete boost::get(boost::vertex_name, g, *v);
delete c;
delete engine;
}
@@ -162,10 +156,9 @@
Graph g = c->analyze();
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0)
TS_ASSERT(gr->_type == kWhileCond);
- delete gr;
}
delete c;
delete engine;
@@ -182,10 +175,9 @@
Graph g = c->analyze();
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 3)
TS_ASSERT(gr->_type == kDoWhileCond);
- delete gr;
}
delete c;
delete engine;
@@ -202,10 +194,9 @@
Graph g = c->analyze();
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x14)
TS_ASSERT(gr->_type == kBreak);
- delete gr;
}
delete c;
@@ -218,10 +209,9 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0xA)
TS_ASSERT(gr->_type == kBreak);
- delete gr;
}
delete c;
@@ -234,10 +224,9 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0xD)
TS_ASSERT(gr->_type == kBreak);
- delete gr;
}
delete c;
delete engine;
@@ -254,12 +243,11 @@
Graph g = c->analyze();
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x14)
TS_ASSERT(gr->_type == kContinue);
if (gr->_start->_address == 0x1a)
TS_ASSERT(gr->_type == kNormal);
- delete gr;
}
delete c;
@@ -272,10 +260,9 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0xA)
TS_ASSERT(gr->_type == kContinue);
- delete gr;
}
delete c;
@@ -288,10 +275,9 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0xD)
TS_ASSERT(gr->_type == kContinue);
- delete gr;
}
delete c;
delete engine;
@@ -308,10 +294,9 @@
Graph g = c->analyze();
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x0)
TS_ASSERT(gr->_type == kIfCond);
- delete gr;
}
delete c;
@@ -324,10 +309,9 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x0)
TS_ASSERT(gr->_type == kIfCond);
- delete gr;
}
delete c;
@@ -340,10 +324,9 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x3)
TS_ASSERT(gr->_type == kIfCond);
- delete gr;
}
delete c;
@@ -356,10 +339,9 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x0)
TS_ASSERT(gr->_type == kIfCond);
- delete gr;
}
delete c;
@@ -372,10 +354,9 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x3)
TS_ASSERT(gr->_type == kIfCond);
- delete gr;
}
delete c;
delete engine;
@@ -392,12 +373,11 @@
Graph g = c->analyze();
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x0)
TS_ASSERT(gr->_type == kWhileCond);
if (gr->_start->_address == 0xd)
TS_ASSERT(gr->_type == kDoWhileCond);
- delete gr;
}
delete c;
@@ -410,12 +390,11 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x6)
TS_ASSERT(gr->_type == kDoWhileCond);
if (gr->_start->_address == 0x10)
TS_ASSERT(gr->_type == kDoWhileCond);
- delete gr;
}
delete c;
@@ -428,12 +407,11 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x0)
TS_ASSERT(gr->_type == kWhileCond);
if (gr->_start->_address == 0xa)
TS_ASSERT(gr->_type == kWhileCond);
- delete gr;
}
delete c;
@@ -446,12 +424,11 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x0)
TS_ASSERT(gr->_type == kWhileCond);
if (gr->_start->_address == 0xd)
TS_ASSERT(gr->_type == kWhileCond);
- delete gr;
}
delete c;
@@ -464,12 +441,11 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x0)
TS_ASSERT(gr->_type == kWhileCond);
if (gr->_start->_address == 0x10)
TS_ASSERT(gr->_type == kDoWhileCond);
- delete gr;
}
delete c;
@@ -482,12 +458,11 @@
g = c->analyze();
range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
if (gr->_start->_address == 0x3)
TS_ASSERT(gr->_type == kWhileCond);
if (gr->_start->_address == 0x13)
TS_ASSERT(gr->_type == kDoWhileCond);
- delete gr;
}
delete c;
@@ -507,7 +482,7 @@
Graph g = c->analyze();
VertexRange range = boost::vertices(g);
for (VertexIterator it = range.first; it != range.second; ++it) {
- Group *gr = GET(*it);
+ GroupPtr gr = GET(*it);
switch (gr->_start->_address) {
case 0x6:
TS_ASSERT(gr->_type == kWhileCond);
@@ -545,7 +520,6 @@
TS_ASSERT(!gr->_endElse);
break;
}
- delete gr;
}
delete c;
delete engine;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list