Java 类soot.jimple.internal.JReturnStmt 实例源码

项目:petablox    文件:Instrumentor.java   
public static boolean isRelevant(Unit q) {
    if(q instanceof JAssignStmt){
        JAssignStmt as=(JAssignStmt)q;
        return
SootUtilities.isFieldLoad(as)||
         SootUtilities.isStoreInst(as) ||
         SootUtilities.isNewStmt(as)||
         SootUtilities.isLoadInst(as)||
         SootUtilities.isFieldStore(as) ||
         SootUtilities.isStaticGet(as)||
         SootUtilities.isStaticPut(as) ||
         SootUtilities.isInvoke(as) ||
         SootUtilities.isNewArrayStmt(as);  
    }
    return
        SootUtilities.isInvoke(q) ||
        (q instanceof JReturnStmt || q instanceof JReturnVoidStmt)||
        q instanceof MonitorStmt;
}
项目:permission-map    文件:GenerateServiceInit.java   
private Type getSystemFetcherReturnType(Body b) {
    ExceptionalUnitGraph g = new ExceptionalUnitGraph(b);
    SmartLocalDefs localDefs = new SmartLocalDefs(g,
            new SimpleLiveLocals(g));
    SimpleLocalUses localUses = new SimpleLocalUses(g, localDefs);

    for (Unit u : b.getUnits()) {
        if (u instanceof JReturnStmt) {
            JReturnStmt ret = (JReturnStmt) u;
            Local l = (Local) ret.getOp();
            List<Unit> defs = localDefs.getDefsOfAt(l, u);
            for (Unit d : defs) {
                if (d instanceof AssignStmt) {
                    AssignStmt ass = (AssignStmt) d;
                    Type t = ass.getRightOp().getType();
                    if (t instanceof NullType) {
                        System.out.println("warning: null type! " + ass);
                    } else {
                        System.out.println("ok: found return type: " + t);
                        return t;
                    }
                }
            }
        }
    }
    System.out.println("warning: no return type found returning void!");
    return VoidType.v();
}
项目:petablox    文件:VisitorHandler.java   
private void visitReturnInsts(JReturnStmt s) {
    if (rivs != null) {
        for (IReturnInstVisitor v : rivs) {
            v.visit(s);
        }
    }
}
项目:petablox    文件:RelMmethRet.java   
@Override
public void visit(JReturnStmt rs) {
    Value op = rs.getOp();
    if (op instanceof Local){
        Local rx = (Local) op;
        if(rx.getType() instanceof RefLikeType) {
            add(ctnrMethod, ZERO, op);
        }
    }
}
项目:petablox    文件:RelPobjRetInst.java   
@Override
public void visit(JReturnStmt jrs) {
    if(jrs.getOp() instanceof Local){
        Local v = (Local)jrs.getOp();
        if(v.getType() instanceof RefLikeType){
            add((Unit) jrs, v);
        }
    }
}
项目:permission-map    文件:GenerateServiceInit.java   
private String getNameFromReturn(Body b) {
    ExceptionalUnitGraph g = new ExceptionalUnitGraph(b);
    SmartLocalDefs localDefs = new SmartLocalDefs(g,
            new SimpleLiveLocals(g));
    SimpleLocalUses localUses = new SimpleLocalUses(g, localDefs);

    for (Unit u : b.getUnits()) {
        if (u instanceof JReturnStmt) {
            JReturnStmt ret = (JReturnStmt) u;
            Local l = (Local) ret.getOp();
            List<Unit> defs = localDefs.getDefsOfAt(l, u);
            for (Unit d : defs) {
                if (d instanceof AssignStmt) {
                    AssignStmt ass = (AssignStmt) d;
                    // if (ass.getRightOp() instanceof NewExpr) {
                    // JNewExpr n = (JNewExpr)ass.getRightOp();
                    Type t = ass.getRightOp().getType();
                    if (t.toString().equals("java.lang.Object")) {

                        if (ass.getRightOp() instanceof InvokeExpr) {
                            InvokeExpr ie = (InvokeExpr) ass.getRightOp();
                            t = ie.getMethodRef().declaringClass()
                                    .getType();
                        } else {

                            List<Unit> defs2 = localDefs.getDefsOfAt(
                                    (Local) ass.getRightOp(), d);
                            Unit u2 = defs2.get(0);
                            if (u2 instanceof AssignStmt) {
                                AssignStmt ass2 = (AssignStmt) u2;
                                t = ass.getRightOp().getType();
                            } else {
                                throw new RuntimeException(
                                        "error: could not find interesting type!");
                            }
                        }
                    }
                    String name = makeManagerName(t);
                    return name;
                    // }
                }
            }
        }
    }
    System.out.println("warning: no name found! " + b);
    return "Unknown" + unknowni++;
}
项目:petablox    文件:RelReturnInst.java   
public void visit(JReturnStmt s) {
    add(s, s.getOp());
}
项目:petablox    文件:IReturnInstVisitor.java   
public void visit(JReturnStmt s);