本文整理汇总了Java中soot.toolkits.graph.UnitGraph.getTails方法的典型用法代码示例。如果您正苦于以下问题:Java UnitGraph.getTails方法的具体用法?Java UnitGraph.getTails怎么用?Java UnitGraph.getTails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soot.toolkits.graph.UnitGraph
的用法示例。
在下文中一共展示了UnitGraph.getTails方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internalTransform
import soot.toolkits.graph.UnitGraph; //导入方法依赖的package包/类
protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
if (!b.getMethod().isSynchronized() || b.getMethod().isStatic())
return;
Iterator<Unit> it = b.getUnits().snapshotIterator();
while (it.hasNext()) {
Unit u = it.next();
if (u instanceof IdentityStmt)
continue;
// This the first real statement. If it is not a MonitorEnter
// instruction, we generate one
if (!(u instanceof EnterMonitorStmt)) {
b.getUnits().insertBeforeNoRedirect(Jimple.v().newEnterMonitorStmt(b.getThisLocal()), u);
// We also need to leave the monitor when the method terminates
UnitGraph graph = new ExceptionalUnitGraph(b);
for (Unit tail : graph.getTails())
b.getUnits().insertBefore(Jimple.v().newExitMonitorStmt(b.getThisLocal()), tail);
}
break;
}
}
示例2: anyExitThrowsException
import soot.toolkits.graph.UnitGraph; //导入方法依赖的package包/类
public static boolean anyExitThrowsException(UnitGraph graph, RefType exceptionType) {
for (Unit unit : graph.getTails()) {
ThrowableSet set = UnitThrowAnalysis.v().mightThrow(unit);
if (set.catchableAs(exceptionType)) {
return true;
}
}
return false;
}
示例3: allExitsReturnTrue
import soot.toolkits.graph.UnitGraph; //导入方法依赖的package包/类
public static boolean allExitsReturnTrue(UnitGraph graph) {
for (Unit unit : graph.getTails()) {
if (unit instanceof ReturnStmt) {
ReturnStmt stmt = (ReturnStmt) unit;
if (!stmt.getOp().equals(IntConstant.v(1))) {
return false;
}
}
}
return true;
}