protected void internalTransform(Body b, String phaseName, Map opts) { MHGDominatorsFinder analysis = new MHGDominatorsFinder(new ExceptionalUnitGraph(b)); Iterator it = b.getUnits().iterator(); while (it.hasNext()) { Stmt s = (Stmt) it.next(); List dominators = analysis.getDominators(s); Iterator dIt = dominators.iterator(); while (dIt.hasNext()) { Stmt ds = (Stmt) dIt.next(); String info = ds + " dominates " + s; s.addTag(new LinkTag(info, ds, b.getMethod().getDeclaringClass().getName(), "Dominators")); } } } }
while (liveLocalsIt.hasNext()) { Value v = (Value) liveLocalsIt.next(); s.addTag(new StringTag("Live Variable: " + v, "Live Variable"));
public Body add(soot.jimple.Stmt stmt) { if(list != null) { list.add(stmt); list = null; } stmt.addTag(currentSourceRangeTag()); soot.PatchingChain<Unit> chain = (soot.PatchingChain<Unit>)chains.peek(); if(stmt instanceof IdentityStmt && chain.size() != 0) { IdentityStmt idstmt = (IdentityStmt) stmt; if(!(idstmt.getRightOp() instanceof CaughtExceptionRef)) { soot.Unit s = chain.getFirst(); while(s instanceof IdentityStmt) s = chain.getSuccOf((soot.jimple.Stmt)s); if(s != null) { chain.insertBefore(stmt, (soot.jimple.Stmt)s); return this; } } } chain.add(stmt); return this; }
case 1: { s.addTag(new StringTag(val + ": Null", "NullCheckTag")); vBox.addTag(new ColorTag(ColorTag.RED, "NullCheckTag")); break; s.addTag(new StringTag(val + ": NonNull", "NullCheckTag")); vBox.addTag(new ColorTag(ColorTag.GREEN, "NullCheckTag")); break; s.addTag(new StringTag(val + ": Nullness Unknown", "NullCheckTag")); vBox.addTag(new ColorTag(ColorTag.BLUE, "NullCheckTag")); break; s.addTag(new StringTag(val + ": Nullness Unknown", "NullCheckTag")); vBox.addTag(new ColorTag(ColorTag.BLUE, "NullCheckTag")); break;
/** Put the results of the analysis into tags in cast statements. */ protected void tagCasts() { for (Iterator<Unit> sIt = ((UnitGraph) graph).getBody().getUnits().iterator(); sIt.hasNext();) { final Stmt s = (Stmt) sIt.next(); if (s instanceof AssignStmt) { AssignStmt as = (AssignStmt) s; Value rhs = as.getRightOp(); if (rhs instanceof CastExpr) { CastExpr cast = (CastExpr) rhs; Type t = cast.getCastType(); if (t instanceof RefType) { if (cast.getOp() instanceof Local) { Local l = (Local) cast.getOp(); LocalTypeSet set = (LocalTypeSet) getFlowBefore(s); s.addTag(new CastCheckTag(set.get(set.indexOf(l, (RefType) t)))); } else { NullConstant nc = (NullConstant) cast.getOp(); s.addTag(new CastCheckTag(true)); } } } } } }
Edge e = (Edge) edges.next(); SootMethod m = e.tgt(); s.addTag(new LinkTag("CallGraph: Type: " + e.kind() + " Target Method/Context: " + e.getTgt().toString(), m, m.getDeclaringClass().getName(), "Call Graph"));
s.addTag(t);
stmt.addTag(tag);
s.addTag(nullTag);
/** * @ast method * @aspect Statements * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/Statements.jrag:482 */ public void emitExceptionHandler(Body b) { Local l = b.newTemp(typeThrowable().getSootType()); b.setLine(this); b.add(b.newIdentityStmt(l, b.newCaughtExceptionRef(this), this)); emitFinallyCode(b); //if(hasFinally() && getFinally().canCompleteNormally()) { soot.jimple.Stmt throwStmt = b.newThrowStmt(l, this); throwStmt.addTag(new soot.tagkit.ThrowCreatedByCompilerTag()); b.add(throwStmt); //} } /**
s.addTag(new StringTag("Common sub-expression"));
b.addLabel(label_end()); soot.jimple.Stmt throwStmt = b.newThrowStmt(l, this); throwStmt.addTag(new soot.tagkit.ThrowCreatedByCompilerTag()); b.add(throwStmt);
stmt.addTag(new soot.tagkit.EnclosingTag()); realArgs = 2; invokeList.add(qualifierLocal); stmt.addTag(new soot.tagkit.QualifyingTag()); } else if ((!hasOuterRef) && (hasQualifier) && (counter == 0)) { qualifierLocal = local; realArgs = 1; invokeList.add(qualifierLocal); stmt.addTag(new soot.tagkit.QualifyingTag());
paramRefCount++; soot.jimple.Stmt stmt = soot.jimple.Jimple.v().newIdentityStmt(outerLocal, paramRef); stmt.addTag(new soot.tagkit.EnclosingTag()); body.getUnits().add(stmt);
/** * Catch Formal creation - method parameters */ private soot.Local createCatchFormal(polyglot.ast.Formal formal) { soot.Type sootType = Util.getSootType(formal.type().type()); soot.Local formalLocal = createLocal(formal.localInstance()); soot.jimple.CaughtExceptionRef exceptRef = soot.jimple.Jimple.v().newCaughtExceptionRef(); soot.jimple.Stmt stmt = soot.jimple.Jimple.v().newIdentityStmt(formalLocal, exceptRef); body.getUnits().add(stmt); Util.addLnPosTags(stmt, formal.position()); Util.addLnPosTags(((soot.jimple.IdentityStmt) stmt).getRightOpBox(), formal.position()); String[] names = new String[] { formal.name() }; stmt.addTag(new soot.tagkit.ParamNamesTag(names)); return formalLocal; }
body.getUnits().add(catchAllBeforeThrowNoop); soot.jimple.Stmt throwStmt = soot.jimple.Jimple.v().newThrowStmt(catchAllAssignLocal); throwStmt.addTag(new soot.tagkit.ThrowCreatedByCompilerTag()); body.getUnits().add(throwStmt);
throwStmt.addTag(new soot.tagkit.ThrowCreatedByCompilerTag()); classBody.getUnits().add(throwStmt);
throwStmt.addTag(new soot.tagkit.ThrowCreatedByCompilerTag()); classBody.getUnits().add(throwStmt);