1 19 20 package soot.jimple.toolkits.callgraph; 21 22 import soot.*; 23 import java.util.*; 24 import soot.toolkits.graph.*; 25 import soot.toolkits.scalar.*; 26 import soot.tagkit.*; 27 import soot.jimple.*; 28 29 public class ClinitElimTransformer extends BodyTransformer { 30 31 protected void internalTransform(Body b, String phaseName, Map options){ 32 ClinitElimAnalysis a = new ClinitElimAnalysis( new BriefUnitGraph(b)); 33 34 CallGraph cg = Scene.v().getCallGraph(); 35 36 SootMethod m = b.getMethod(); 37 38 Iterator edgeIt = cg.edgesOutOf(m); 39 40 while (edgeIt.hasNext()){ 41 Edge e = (Edge)edgeIt.next(); 42 if (e.srcStmt() == null) continue; 43 if (!e.isClinit()) continue; 44 FlowSet methods = (FlowSet) a.getFlowBefore(e.srcStmt()); 45 if (methods.contains(e.tgt())){ 46 cg.removeEdge(e); 47 } 48 } 49 } 50 } 51 | Popular Tags |