[Soot-list] How to create the statement: "v[i] = new Type(); " ?

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Sat Dec 11 17:49:35 EST 2010


Hi Christina.

This is easy - just use two statements:

tmp = new Type();
v[i] = tmp;

It may also be necessary to generate a fresh local "tmp" for this.

Eric
--
Dr. Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



On 11 December 2010 18:36, Cristina Ilie <crysgirlro at yahoo.com> wrote:
> Hi,
>
> How can I to construct the following initialization: "v[i] = new Type();" ?
> (v is an array)
>
> For the statement "x = new DerivType()" it's easy:
>
> SootMethod initMethod =
>                 derivTypeClass.getMethodByName("<init>");
>
> derivUnits.insertBefore(
>                     Jimple.v().newInvokeStmt(
>                             Jimple.v().newSpecialInvokeExpr(
>                                     xVariable,
>                                     initMethod.makeRef())),
>                      stmt);
>
> derivUnits.insertBefore(
>                     Grimp.v().newAssignStmt(
>                             xVariable,
>
> Jimple.v().newNewExpr(derivTypeClass.getType())),
>                     stmt);
>
> But if I have "v[i] = .." instead of  "x = .." then I should to apply the
> "init" invokation on an ArrayRef object:
> "Jimple.v().newArrayRef(vvariable,iVariable).getIndex()" and
> Jimple.v().newInvokeStmt expects a JimpleLocal as the first parameter.
>
> Thank you,
> Cristina
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>


More information about the Soot-list mailing list