fix for CFG bug reported by Benedikt N on mailing list, plus test case
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4077 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
e3564dce02
commit
9aa9187edc
|
@ -19,6 +19,19 @@ public class MonitorTest {
|
|||
}
|
||||
}
|
||||
|
||||
void sync3() {
|
||||
Object a = new Object();
|
||||
Object b = new Object();
|
||||
Object c = new Object();
|
||||
synchronized (a) {
|
||||
synchronized (b) {
|
||||
synchronized (c) {
|
||||
dummy();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dummy() {
|
||||
}
|
||||
}
|
|
@ -153,4 +153,15 @@ public class CFGTest extends WalaTestCase {
|
|||
Assert.assertTrue(succs.contains(6));
|
||||
Assert.assertTrue(succs.contains(7));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSync3() {
|
||||
MethodReference mr = StringStuff.makeMethodReference("cfg.MonitorTest.sync3()V");
|
||||
|
||||
IMethod m = cha.resolveMethod(mr);
|
||||
AnalysisCache cache = new AnalysisCache();
|
||||
IR ir = cache.getIR(m);
|
||||
SSACFG controlFlowGraph = ir.getControlFlowGraph();
|
||||
Assert.assertEquals(1, controlFlowGraph.getSuccNodeCount(controlFlowGraph.getBlockForInstruction(33)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -320,9 +320,10 @@ public class ShrikeCFG extends AbstractCFG<IInstruction, ShrikeCFG.BasicBlock> {
|
|||
System.err.println(" gotoAllHandlers " + b);
|
||||
}
|
||||
addExceptionalEdgeTo(b);
|
||||
// if the handler catches all exceptions, we don't need to add an edge to the exit
|
||||
// if the handler catches all exceptions, we don't need to add an edge to the exit or any other handlers
|
||||
if (hs[j].getCatchClass() == null) {
|
||||
needEdgeToExitForAllHandlers = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
TypeReference caughtException = null;
|
||||
|
|
Loading…
Reference in New Issue