/** * Constructs a Local with the given name and type. */ public Local newLocal(String name, Type t) { return Jimple.v().newLocal(name, t); }
public void outADeclaration(ADeclaration node) { List localNameList = (List) mProductions.removeLast(); Type type = (Type) mProductions.removeLast(); Iterator it = localNameList.iterator(); List<Local> localList = new ArrayList<Local>(); while (it.hasNext()) { Local l = Jimple.v().newLocal((String) it.next(), type); mLocals.put(l.getName(), l); localList.add(l); } mProductions.addLast(localList); }
public Local newLocal(String name, Type t) { return Jimple.v().newLocal(name, t); }
Local newStackLocal() { Integer idx = nextLocal++; Local l = Jimple.v().newLocal("$stack" + idx, UnknownType.v()); locals.put(idx, l); return l; }
Local newLocal = Jimple.v().newLocal(newName, type); localChain.add(newLocal); locals.add(newName);
public static List<Local> buildParameterLocals(PatchingChain<Unit> units, Collection<Local> locals, List<Type> paramTypes) { List<Local> args = new ArrayList<Local>(); for (int k = 0; k < paramTypes.size(); k++) { Type type = paramTypes.get(k); Local loc = Jimple.v().newLocal("l" + k, type); locals.add(loc); units.add(Jimple.v().newIdentityStmt(loc, Jimple.v().newParameterRef(type, k))); args.add(loc); } return args; }
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; }
private Local getLocal(int idx) { if (idx >= maxLocals) { throw new IllegalArgumentException("Invalid local index: " + idx); } Integer i = idx; Local l = locals.get(i); if (l == null) { String name; if (localVars != null) { name = null; for (LocalVariableNode lvn : localVars) { if (lvn.index == idx) { name = lvn.name; break; } } /* normally for try-catch blocks */ if (name == null) { name = "l" + idx; } } else { name = "l" + idx; } l = Jimple.v().newLocal(name, UnknownType.v()); locals.put(i, l); } return l; }
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; }
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; }
public Pair<Value, Type> createZeroValue() { return new Pair<Value, Type>(Jimple.v().newLocal("<dummy>", UnknownType.v()), UnknownType.v()); } }
public static Local buildThisLocal(PatchingChain<Unit> units, ThisRef tr, Collection<Local> locals) { Local ths = Jimple.v().newLocal("ths", tr.getType()); locals.add(ths); units.add(Jimple.v().newIdentityStmt(ths, Jimple.v().newThisRef((RefType) tr.getType()))); return ths; }
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; } }
/** * Creates a cast at stmt of vold to the given type. * * @param useType * the new type * @param stmt * stmt * @param old * the old local * @return the new local */ protected Local createCast(Type useType, Stmt stmt, Local old) { Jimple jimple = Jimple.v(); Local vnew = jimple.newLocal("tmp", useType); vnew.setName("tmp$" + System.identityHashCode(vnew)); this.tg.set(vnew, useType); this.jb.getLocals().add(vnew); Unit u = Util.findFirstNonIdentityUnit(jb, stmt); this.jb.getUnits().insertBefore(jimple.newAssignStmt(vnew, jimple.newCastExpr(old, useType)), u); return vnew; }
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; }
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; } }