public static <T> HashChain<T> listToHashChain(List<T> list) { HashChain<T> c = new HashChain<T>(); Iterator<T> it = list.iterator(); while (it.hasNext()) { c.addLast(it.next()); } return c; }
public PegCallGraph(CallGraph cg) { clinitMethods = new HashSet(); chain = new HashChain(); heads = new ArrayList(); tails = new ArrayList(); methodToSuccs = new HashMap(); methodToPreds = new HashMap(); methodToSuccsTrim = new HashMap(); // buildfortest(); buildChainAndSuccs(cg); // testChain(); // testMethodToSucc(); buildPreds(); // trim(); BROKEN // testMethodToPred(); // testClinitMethods(); }
/** * Construct an empty ShimpleBody associated with m. **/ ShimpleBody(SootMethod m, Map options) { super(m); // must happen before SPatchingChain gets created this.options = new ShimpleOptions(options); setSSA(true); isExtendedSSA = this.options.extended(); unitChain = new SPatchingChain(this, new HashChain()); sbb = new ShimpleBodyBuilder(this); }
/** * Add the given class to the list of interfaces which are directly implemented by this class. */ public void addInterface(SootClass interfaceClass) { checkLevel(HIERARCHY); if (implementsInterface(interfaceClass.getName())) { throw new RuntimeException("duplicate interface: " + interfaceClass.getName()); } if (interfaces == null) { interfaces = new HashChain<>(); } interfaces.add(interfaceClass); }
/** * Constructs a ShimpleBody from the given Body and options. * * <p> * Currently available option is "naive-phi-elimination", typically in the "shimple" phase (eg, -p shimple * naive-phi-elimination) which can be useful for understanding the effect of analyses. **/ ShimpleBody(Body body, Map options) { super(body.getMethod()); if (!(body instanceof JimpleBody || body instanceof ShimpleBody)) { throw new RuntimeException("Cannot construct ShimpleBody from given Body type."); } if (Options.v().verbose()) { logger.debug("[" + getMethod().getName() + "] Constructing ShimpleBody..."); } // must happen before SPatchingChain gets created this.options = new ShimpleOptions(options); unitChain = new SPatchingChain(this, new HashChain()); importBodyContentsFrom(body); /* Shimplise body */ sbb = new ShimpleBodyBuilder(this); if (body instanceof ShimpleBody) { rebuild(true); } else { rebuild(false); } }
/** * Adds the given field to this class. */ public void addField(SootField f) { checkLevel(SIGNATURES); if (f.isDeclared()) { throw new RuntimeException("already declared: " + f.getName()); } if (declaresField(f.getName(), f.getType())) { throw new RuntimeException("Field already exists : " + f.getName() + " of type " + f.getType()); } if (fields == null) { fields = new HashChain<>(); } fields.add(f); f.setDeclared(true); f.setDeclaringClass(this); }
public synchronized SootField getOrAddField(SootField f) { checkLevel(SIGNATURES); if (f.isDeclared()) { throw new RuntimeException("already declared: " + f.getName()); } SootField old = getFieldUnsafe(f.getName(), f.getType()); if (old != null) { return old; } if (fields == null) { fields = new HashChain<>(); } fields.add(f); f.setDeclared(true); f.setDeclaringClass(this); return f; }
Chain<Local> capLocals = new HashChain<>(); int i = 0; for (SootField f : capFields) {
Chain<Unit> newUnits = new HashChain<Unit>(); Stmt s = (Stmt) iter.next();
PatchingChain<Unit> units = body.getUnits(); LocalGenerator localGen = new LocalGenerator(body); Chain<Unit> newUnits = new HashChain<Unit>(); SootClass setClass = Scene.v().getSootClass("java.util.Set"); SootMethodRef addMethodRef = setClass.getMethodByName("add").makeRef();
Chain<Unit> newUnits = new HashChain<Unit>();