1 19 20 package soot.shimple; 21 22 import soot.*; 23 import soot.options.Options; 24 import java.util.*; 25 26 33 public class ShimpleTransformer extends SceneTransformer 34 { 35 public ShimpleTransformer( Singletons.Global g ) {} 36 public static ShimpleTransformer v() { return G.v().soot_shimple_ShimpleTransformer(); } 37 38 protected void internalTransform(String phaseName, Map options) 39 { 40 if(Options.v().verbose()) 41 G.v().out.println("Transforming all classes in the Scene to Shimple..."); 42 43 47 Iterator classesIt = Scene.v().getClasses().iterator(); 48 while(classesIt.hasNext()){ 49 SootClass sClass = (SootClass) classesIt.next(); 50 if(sClass.isPhantom()) continue; 51 52 Iterator methodsIt = sClass.getMethods().iterator(); 53 while(methodsIt.hasNext()){ 54 SootMethod method = (SootMethod) methodsIt.next(); 55 if(!method.isConcrete()) continue; 56 57 if(method.hasActiveBody()){ 58 Body body = method.getActiveBody(); 59 ShimpleBody sBody = null; 60 61 if(body instanceof ShimpleBody){ 62 sBody = (ShimpleBody) body; 63 if(!sBody.isSSA()) 64 sBody.rebuild(); 65 } 66 else{ 67 sBody = Shimple.v().newBody(body); 68 } 69 70 method.setActiveBody(sBody); 71 } 72 else{ 73 MethodSource ms = new ShimpleMethodSource(method.getSource()); 74 method.setSource(ms); 75 } 76 } 77 } 78 } 79 } 80 | Popular Tags |