diff options
| author | bd-912 <bdunahu@colostate.edu> | 2024-04-20 01:46:24 -0600 | 
|---|---|---|
| committer | bd-912 <bdunahu@colostate.edu> | 2024-04-20 01:46:24 -0600 | 
| commit | 7abe891766135b36e538b26e7d2433d3bf2a40b2 (patch) | |
| tree | d718e980cee0f48ca2d24bd3720be69c49c9dc72 /vaporize/library/ControlFlowGraph.java | |
| parent | b7705e83c2026ff3983fc0b83f9b083d3e8be4c5 (diff) | |
Fix many more issues with goto/branch found with GraphViz
Diffstat (limited to 'vaporize/library/ControlFlowGraph.java')
| -rw-r--r-- | vaporize/library/ControlFlowGraph.java | 21 | 
1 files changed, 21 insertions, 0 deletions
diff --git a/vaporize/library/ControlFlowGraph.java b/vaporize/library/ControlFlowGraph.java index b4c995c..2a8caef 100644 --- a/vaporize/library/ControlFlowGraph.java +++ b/vaporize/library/ControlFlowGraph.java @@ -33,6 +33,24 @@ public class ControlFlowGraph {          return ret;      } +    protected CFGNode getNextNode(CFGNode a) { +        CFGNode ret = null; +        // we return null if the passed node is the last in the list +        for (int i = 0; i < this.nodes.size()-1; ++i) { +            if (this.nodes.get(i).equals(a)) { +                ret = this.nodes.get(i+1); +                break; +            } +        } + +        if (ret == null) +            MinimalLogger.severe(String.format("Could not find a node matching %s", +                                               a.toString())); + +        return ret; + +    } +      protected void addNode(CFGNode node) {          this.nodes.add(node);      } @@ -53,6 +71,9 @@ public class ControlFlowGraph {              source.addDest(dest);              dest.addSource(source);              ret += ";"; +        } else { +            MinimalLogger.info(String.format("Skipping duplicate edge for %d", +                                             source.getInstruction().sourcePos.line));          }          return ret;  | 
