aboutsummaryrefslogtreecommitdiff
path: root/src/relooper
diff options
context:
space:
mode:
authorJez Ng <me@jezng.com>2013-06-27 01:06:35 -0700
committerJez Ng <me@jezng.com>2013-06-27 01:06:35 -0700
commit4dd1e475281b2fa94b757b3f40b5849981a73346 (patch)
treeb237a3ae902ea3c16a3e90dced3e811ef7eee958 /src/relooper
parent84e1197b40b2b625b2ee9f6fa417132506f824e8 (diff)
Make DefaultTarget a local variable.
Diffstat (limited to 'src/relooper')
-rw-r--r--src/relooper/Relooper.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp
index 39f1eed3..ca9c6ab1 100644
--- a/src/relooper/Relooper.cpp
+++ b/src/relooper/Relooper.cpp
@@ -104,7 +104,7 @@ void Branch::Render(Block *Target, bool SetLabel) {
int Block::IdCounter = 1; // 0 is reserved for clearings
-Block::Block(const char *CodeInit) : Parent(NULL), Id(Block::IdCounter++), DefaultTarget(NULL), IsCheckedMultipleEntry(false) {
+Block::Block(const char *CodeInit) : Parent(NULL), Id(Block::IdCounter++), IsCheckedMultipleEntry(false) {
Code = strdup(CodeInit);
}
@@ -178,6 +178,8 @@ void Block::Render(bool InLoop) {
}
}
+ Block *DefaultTarget(NULL); // The block we branch to without checking the condition, if none of the other conditions held.
+
// We must do this here, because blocks can be split and even comparing their Ids is not enough. We must check the conditions.
for (BlockBranchMap::iterator iter = ProcessedBranchesOut.begin(); iter != ProcessedBranchesOut.end(); iter++) {
if (!iter->second->Condition) {
@@ -185,7 +187,7 @@ void Block::Render(bool InLoop) {
DefaultTarget = iter->first;
}
}
- assert(DefaultTarget); // Must be a default
+ assert(DefaultTarget); // Since each block *must* branch somewhere, this must be set
ministring RemainingConditions;
bool First = true;