/** Adds the given object to this Chain. */ @Override public boolean add(E o) { return innerChain.add(o); }
public Local newLocal(String name, soot.Type type) { Local local = Jimple.v().newLocal(name, type); body.getLocals().add(local); if(name.equals("this") && thisName == null) thisName = local; return local; }
public Local newTemp(soot.Type type) { Local local = Jimple.v().newLocal("temp$" + nextTempIndex++, type); body.getLocals().add(local); return local; }
protected soot.Local createLocal(String name, soot.Type sootType) { soot.Local sootLocal = soot.jimple.Jimple.v().newLocal(name, sootType); body.getLocals().add(sootLocal); return sootLocal; } }
private soot.Local createLocal(String name, soot.Type sootType) { soot.Local sootLocal = soot.jimple.Jimple.v().newLocal(name, sootType); body.getLocals().add(sootLocal); return sootLocal; }
public Local get_ControlLocal() { if (controlLocal == null) { controlLocal = new JimpleLocal("controlLocal", IntType.v()); getLocals().add(controlLocal); } return controlLocal; }
Local getLocalCreatingIfNecessary(JimpleBody listBody, String name, Type type) { Local l = getLocalUnsafe(listBody, name); if (l != null) { if (!l.getType().equals(type)) { throw new RuntimeException("The body already declares this local name with a different type."); } } else { l = Jimple.v().newLocal(name, type); listBody.getLocals().add(l); } return l; }
/** * 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); }
public Body addTrap(TypeDecl type, soot.jimple.Stmt firstStmt, soot.jimple.Stmt lastStmt, soot.jimple.Stmt handler) { body.getTraps().add(Jimple.v().newTrap(type.getSootClassDecl(), firstStmt, lastStmt, handler)); return this; }
public void add(Transform t) { if (!t.getPhaseName().startsWith(getPhaseName() + ".")) { throw new RuntimeException("Transforms in pack '" + getPhaseName() + "' must have a phase name " + "that starts with '" + getPhaseName() + ".'."); } PhaseOptions.v().getPM().notifyAddPack(); if (get(t.getPhaseName()) != null) { throw new RuntimeException("Phase " + t.getPhaseName() + " already " + "in pack"); } opts.add(t); }
/** Makes this class a phantom class. */ public void setPhantomClass() { Chain<SootClass> c = Scene.v().getContainingChain(this); if (c != null) { c.remove(this); } Scene.v().getPhantomClasses().add(this); isPhantom = true; }
/** Makes this class a library class. */ public void setLibraryClass() { if (isLibraryClass()) { return; } Chain<SootClass> c = Scene.v().getContainingChain(this); if (c != null) { c.remove(this); } Scene.v().getLibraryClasses().add(this); isPhantom = false; }
/** Makes this class an application class. */ public void setApplicationClass() { if (isApplicationClass()) { return; } Chain<SootClass> c = Scene.v().getContainingChain(this); if (c != null) { c.remove(this); } Scene.v().getApplicationClasses().add(this); isPhantom = false; }
private void insertCastOrBoxingCode(Local lhs, Local rhs, Chain<Unit> newUnits) { // if assigning to a primitive type then there's nothing to do if (lhs.getType() instanceof RefLikeType) { if ((rhs.getType() instanceof RefLikeType)) { // insert cast newUnits.add(Jimple.v().newAssignStmt(lhs, Jimple.v().newCastExpr(rhs, lhs.getType()))); } else { // primitive type in rhs; insert boxing code RefType boxedType = ((PrimType) rhs.getType()).boxedType(); SootMethodRef ref = Scene.v().makeMethodRef(boxedType.getSootClass(), "valueOf", Collections.<Type>singletonList(rhs.getType()), boxedType, true); newUnits.add(Jimple.v().newAssignStmt(lhs, Jimple.v().newStaticInvokeExpr(ref, rhs))); } } }
private void insertCastOrUnboxingCode(Local lhs, Local rhs, Chain<Unit> newUnits) { // if assigning to a reference type then there's nothing to do if (lhs.getType() instanceof PrimType) { if ((rhs.getType() instanceof PrimType)) { // insert cast newUnits.add(Jimple.v().newAssignStmt(lhs, Jimple.v().newCastExpr(rhs, lhs.getType()))); } else { // reference type in rhs; insert unboxing code RefType boxedType = (RefType) rhs.getType(); SootMethodRef ref = Scene.v().makeMethodRef(boxedType.getSootClass(), lhs.getType().toString() + "Value", Collections.<Type>emptyList(), lhs.getType(), false); newUnits.add(Jimple.v().newAssignStmt(lhs, Jimple.v().newVirtualInvokeExpr(rhs, ref))); } } }
private Local insertCast(Value oldvalue, Type oldtype, Type type, Stmt stmt) { Local newlocal1 = Jimple.v().newLocal("tmp", oldtype); Local newlocal2 = Jimple.v().newLocal("tmp", type); stmtBody.getLocals().add(newlocal1); stmtBody.getLocals().add(newlocal2); Unit u = Util.findFirstNonIdentityUnit(this.stmtBody, stmt); stmtBody.getUnits().insertBefore(Jimple.v().newAssignStmt(newlocal1, oldvalue), u); stmtBody.getUnits().insertBefore(Jimple.v().newAssignStmt(newlocal2, Jimple.v().newCastExpr(newlocal1, type)), u); return newlocal2; } }
private Local insertCast(Local oldlocal, Type type, Stmt stmt) { Local newlocal = Jimple.v().newLocal("tmp", type); stmtBody.getLocals().add(newlocal); Unit u = Util.findFirstNonIdentityUnit(this.stmtBody, stmt); stmtBody.getUnits().insertBefore(Jimple.v().newAssignStmt(newlocal, Jimple.v().newCastExpr(oldlocal, type)), u); return newlocal; }
private Local insertCast(Local oldlocal, Type type, Stmt stmt) { Local newlocal = Jimple.v().newLocal("tmp", type); stmtBody.getLocals().add(newlocal); Unit u = Util.findFirstNonIdentityUnit(stmtBody, stmt); stmtBody.getUnits().insertBefore(Jimple.v().newAssignStmt(newlocal, Jimple.v().newCastExpr(oldlocal, type)), u); return newlocal; } }
private Local insertCast(Local oldlocal, Type type, Stmt stmt) { Local newlocal = Jimple.v().newLocal("tmp", type); stmtBody.getLocals().add(newlocal); Unit u = Util.findFirstNonIdentityUnit(stmtBody, stmt); stmtBody.getUnits().insertBefore(Jimple.v().newAssignStmt(newlocal, Jimple.v().newCastExpr(oldlocal, type)), u); return newlocal; } }
private Local insertCastAfter(Local leftlocal, Type lefttype, Type righttype, Stmt stmt) { Local newlocal = Jimple.v().newLocal("tmp", righttype); stmtBody.getLocals().add(newlocal); Unit u = Util.findLastIdentityUnit(this.stmtBody, stmt); stmtBody.getUnits().insertAfter(Jimple.v().newAssignStmt(leftlocal, Jimple.v().newCastExpr(newlocal, lefttype)), u); return newlocal; }