use of dk.brics.soot.intermediate.representation.Variable in project soot by Sable.
the class JavaTranslator method makeMethods.
void makeMethods() {
Collection<SootClass> app = Scene.v().getApplicationClasses();
for (SootClass ac : app) {
List<SootMethod> sootMethods = ac.getMethods();
for (SootMethod sm : sootMethods) {
List<Variable> vars = new LinkedList<Variable>();
List<Type> params = sm.getParameterTypes();
for (Type pt : params) {
Variable v = makeVariable(pt);
vars.add(v);
}
Variable[] var_array = (Variable[]) vars.toArray(new Variable[0]);
Method m = new Method(sm.getName(), var_array);
methods.add(m);
methodsignaturToMethod.put(sm.getSignature(), m);
}
}
}
use of dk.brics.soot.intermediate.representation.Variable in project soot by Sable.
the class ExprTranslator method handleSpecialCall.
// any type
boolean handleSpecialCall(InstanceInvokeExpr expr, SootMethod target) {
String mn = target.getName();
int np = target.getParameterCount();
SootClass dc = target.getDeclaringClass();
// Is it a method in a Foo object?
if (isFoo(dc)) {
if (mn.equals("foo") && np == 1) {
Variable lvar = new Variable(Variable.Type.FOO);
Method foo = new Method("foo", new Variable[0]);
FooMethodCall fmc = new FooMethodCall(foo);
fmc.setAssignmentTarget(lvar);
st.addStatement(fmc);
return true;
}
// Unknown Foo method
return false;
}
// Not a special call
return false;
}
use of dk.brics.soot.intermediate.representation.Variable in project soot by Sable.
the class ExprTranslator method translateExpr.
// Called for any type of value
public void translateExpr(Variable var, ValueBox box) {
Value val = box.getValue();
Variable temp = res_var;
res_var = var;
val.apply(this);
res_var = temp;
}
use of dk.brics.soot.intermediate.representation.Variable in project soot by Sable.
the class ExprTranslator method caseSpecialInvokeExpr.
public void caseSpecialInvokeExpr(SpecialInvokeExpr expr) {
// Constructor calls, maybe
Variable bvar = st.getLocalVariable((Local) expr.getBase());
SootMethod m = expr.getMethod();
if (m.getName().equals("<init>")) {
SootClass dc = m.getDeclaringClass();
if (isFoo(dc)) {
FooInit fi = new FooInit();
fi.setAssignmentTarget(bvar);
st.addStatement(fi);
return;
}
}
handleCall(expr, expr.getMethod());
}
use of dk.brics.soot.intermediate.representation.Variable in project soot by Sable.
the class StmtTranslator method handleAssign.
void handleAssign(DefinitionStmt stmt) {
Value lval = stmt.getLeftOp();
Value rval = stmt.getRightOp();
Variable rvar;
if (lval instanceof Local) {
rvar = getLocalVariable((Local) lval);
} else {
rvar = jt.makeVariable(rval);
}
et.translateExpr(rvar, stmt.getRightOpBox());
if (lval instanceof ArrayRef) {
notSupported("We do not support arrays");
} else if (lval instanceof FieldRef) {
notSupported("We do not support field references");
}
}
Aggregations