Search in sources :

Example 1 with TrapUnitGraph

use of soot.toolkits.graph.TrapUnitGraph in project soot by Sable.

the class AugmentedStmtGraph method mirror_PredsSuccs.

private void mirror_PredsSuccs(AugmentedStmt as, UnitGraph ug) {
    Stmt s = as.get_Stmt();
    LinkedList<AugmentedStmt> preds = new LinkedList<AugmentedStmt>(), succs = new LinkedList<AugmentedStmt>();
    // mirror the predecessors
    for (Unit u : ug.getPredsOf(s)) {
        AugmentedStmt po = get_AugStmt((Stmt) u);
        if (preds.contains(po) == false)
            preds.add(po);
    }
    // mirror the successors
    for (Unit u : ug.getSuccsOf(s)) {
        AugmentedStmt so = get_AugStmt((Stmt) u);
        if (succs.contains(so) == false)
            succs.add(so);
    }
    // attach the mirrors properly to the AugmentedStmt
    if (ug instanceof BriefUnitGraph) {
        as.bpreds = preds;
        as.bsuccs = succs;
        if (preds.size() == 0)
            bheads.add(as);
        if (succs.size() == 0)
            btails.add(as);
    } else if (ug instanceof TrapUnitGraph) {
        as.cpreds = preds;
        as.csuccs = succs;
        if (preds.size() == 0)
            cheads.add(as);
        if (succs.size() == 0)
            ctails.add(as);
    } else
        throw new RuntimeException("Unknown UnitGraph type: " + ug.getClass());
}
Also used : TrapUnitGraph(soot.toolkits.graph.TrapUnitGraph) BriefUnitGraph(soot.toolkits.graph.BriefUnitGraph) Unit(soot.Unit) LinkedList(java.util.LinkedList) TableSwitchStmt(soot.jimple.TableSwitchStmt) LookupSwitchStmt(soot.jimple.LookupSwitchStmt) Stmt(soot.jimple.Stmt) IfStmt(soot.jimple.IfStmt)

Aggregations

LinkedList (java.util.LinkedList)1 Unit (soot.Unit)1 IfStmt (soot.jimple.IfStmt)1 LookupSwitchStmt (soot.jimple.LookupSwitchStmt)1 Stmt (soot.jimple.Stmt)1 TableSwitchStmt (soot.jimple.TableSwitchStmt)1 BriefUnitGraph (soot.toolkits.graph.BriefUnitGraph)1 TrapUnitGraph (soot.toolkits.graph.TrapUnitGraph)1