use of soot.jimple.internal.JIfStmt in project soot by Sable.
the class NullnessAnalysis method flowThrough.
/**
* {@inheritDoc}
*/
@Override
protected void flowThrough(AnalysisInfo in, Unit u, List<AnalysisInfo> fallOut, List<AnalysisInfo> branchOuts) {
AnalysisInfo out = new AnalysisInfo(in);
AnalysisInfo outBranch = new AnalysisInfo(in);
Stmt s = (Stmt) u;
// or for an instanceof expression
if (s instanceof JIfStmt) {
JIfStmt ifStmt = (JIfStmt) s;
handleIfStmt(ifStmt, in, out, outBranch);
} else // in case of a monitor statement, we know that if it succeeds, we have a non-null value
if (s instanceof MonitorStmt) {
MonitorStmt monitorStmt = (MonitorStmt) s;
out.put(monitorStmt.getOp(), NON_NULL);
}
// if we have an array ref, set the base to non-null
if (s.containsArrayRef()) {
ArrayRef arrayRef = s.getArrayRef();
handleArrayRef(arrayRef, out);
}
// for field refs, set the receiver object to non-null, if there is one
if (s.containsFieldRef()) {
FieldRef fieldRef = s.getFieldRef();
handleFieldRef(fieldRef, out);
}
// for invoke expr, set the receiver object to non-null, if there is one
if (s.containsInvokeExpr()) {
InvokeExpr invokeExpr = s.getInvokeExpr();
handleInvokeExpr(invokeExpr, out);
}
// x=y, copy the info for y (for locals x,y)
if (s instanceof DefinitionStmt) {
DefinitionStmt defStmt = (DefinitionStmt) s;
if (defStmt.getLeftOp().getType() instanceof RefLikeType) {
handleRefTypeAssignment(defStmt, out);
}
}
// now copy the computed info to all successors
for (Iterator<AnalysisInfo> it = fallOut.iterator(); it.hasNext(); ) {
copy(out, it.next());
}
for (Iterator<AnalysisInfo> it = branchOuts.iterator(); it.hasNext(); ) {
copy(outBranch, it.next());
}
}
Aggregations