diff options
Diffstat (limited to 'src/cfg/cfg-traversal.h')
-rw-r--r-- | src/cfg/cfg-traversal.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/cfg/cfg-traversal.h b/src/cfg/cfg-traversal.h index abaf63c5b..79c561de0 100644 --- a/src/cfg/cfg-traversal.h +++ b/src/cfg/cfg-traversal.h @@ -79,22 +79,26 @@ struct CFGWalker : public ControlFlowWalker<SubType, VisitorType> { } void link(BasicBlock* from, BasicBlock* to) { - if (!from || !to) + if (!from || !to) { return; // if one of them is not reachable, ignore + } from->out.push_back(to); to->in.push_back(from); } static void doEndBlock(SubType* self, Expression** currp) { auto* curr = (*currp)->cast<Block>(); - if (!curr->name.is()) + if (!curr->name.is()) { return; + } auto iter = self->branches.find(curr); - if (iter == self->branches.end()) + if (iter == self->branches.end()) { return; + } auto& origins = iter->second; - if (origins.size() == 0) + if (origins.size() == 0) { return; + } // we have branches to here, so we need a new block auto* last = self->currBasicBlock; self->startBasicBlock(); @@ -270,8 +274,9 @@ struct CFGWalker : public ControlFlowWalker<SubType, VisitorType> { queue.erase(iter); alive.insert(curr); for (auto* out : curr->out) { - if (!alive.count(out)) + if (!alive.count(out)) { queue.insert(out); + } } } return alive; @@ -305,8 +310,9 @@ struct CFGWalker : public ControlFlowWalker<SubType, VisitorType> { std::map<BasicBlock*, size_t> debugIds; void generateDebugIds() { - if (debugIds.size() > 0) + if (debugIds.size() > 0) { return; + } for (auto& block : basicBlocks) { debugIds[block.get()] = debugIds.size(); } |