bug fix for previous bug fix
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@2570 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
2904150420
commit
a3ac4d3a45
|
@ -70,7 +70,7 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
init();
|
||||
computeI2BMapping();
|
||||
computeEdges();
|
||||
|
||||
|
||||
if (DEBUG) {
|
||||
System.err.println(this);
|
||||
}
|
||||
|
@ -97,8 +97,7 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Compute a mapping from instruction to basic block. Also, compute the blocks
|
||||
* that end with a 'normal' return.
|
||||
* Compute a mapping from instruction to basic block. Also, compute the blocks that end with a 'normal' return.
|
||||
*/
|
||||
private void computeI2BMapping() {
|
||||
instruction2Block = new int[getInstructions().length];
|
||||
|
@ -207,8 +206,7 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return an instruction's basic block in the CFG given the index of the
|
||||
* instruction in the CFG's instruction array.
|
||||
* Return an instruction's basic block in the CFG given the index of the instruction in the CFG's instruction array.
|
||||
*/
|
||||
public BasicBlock getBlockForInstruction(int index) {
|
||||
return getNode(instruction2Block[index]);
|
||||
|
@ -253,11 +251,9 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add any exceptional edges generated by the last instruction in a basic
|
||||
* block.
|
||||
* Add any exceptional edges generated by the last instruction in a basic block.
|
||||
*
|
||||
* @param last
|
||||
* the last instruction in a basic block.
|
||||
* @param last the last instruction in a basic block.
|
||||
*/
|
||||
private void addExceptionalEdges(Instruction last) {
|
||||
IClassHierarchy cha = getMethod().getClassHierarchy();
|
||||
|
@ -307,6 +303,9 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
if (hs[j].getCatchClass() != null) {
|
||||
ClassLoaderReference loader = ShrikeCFG.this.getMethod().getDeclaringClass().getReference().getClassLoader();
|
||||
caughtException = ShrikeUtil.makeTypeReference(loader, hs[j].getCatchClass());
|
||||
if (DEBUG) {
|
||||
System.err.println(" caughtException " + caughtException);
|
||||
}
|
||||
IClass caughtClass = cha.lookupClass(caughtException);
|
||||
if (caughtClass == null) {
|
||||
// conservatively add the edge, and raise a warning
|
||||
|
@ -314,13 +313,14 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
Warnings.add(FailedExceptionResolutionWarning.create(caughtException));
|
||||
// null out caughtException, to avoid attempting to process it
|
||||
caughtException = null;
|
||||
} else {
|
||||
// hs[j].getCatchClass() == null.
|
||||
// this means that the handler catches all exceptions.
|
||||
// add the edge and null out all types
|
||||
addExceptionalEdgeTo(b);
|
||||
exceptionTypes.clear();
|
||||
}
|
||||
} else {
|
||||
// hs[j].getCatchClass() == null.
|
||||
// this means that the handler catches all exceptions.
|
||||
// add the edge and null out all types
|
||||
addExceptionalEdgeTo(b);
|
||||
exceptionTypes.clear();
|
||||
caughtException = null;
|
||||
}
|
||||
if (caughtException != null) {
|
||||
// the set "caught" should be the set of exceptions that MUST
|
||||
|
@ -386,7 +386,6 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
addExceptionalEdge(this, b);
|
||||
}
|
||||
|
||||
|
||||
public int getLastInstructionIndex() {
|
||||
if (this == entry() || this == exit()) {
|
||||
// these are the special end blocks
|
||||
|
@ -472,17 +471,14 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
return s.toString();
|
||||
}
|
||||
|
||||
|
||||
public int getMaxStackHeight() {
|
||||
return method.getMaxStackHeight();
|
||||
}
|
||||
|
||||
|
||||
public int getMaxLocals() {
|
||||
return method.getMaxLocals();
|
||||
}
|
||||
|
||||
|
||||
public Set<ExceptionHandler> getExceptionHandlers() {
|
||||
return exceptionHandlers;
|
||||
}
|
||||
|
@ -501,8 +497,6 @@ public class ShrikeCFG extends AbstractCFG<ShrikeCFG.BasicBlock> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @author sfink
|
||||
*
|
||||
* A warning when we fail to resolve the type of an exception
|
||||
*/
|
||||
private static class FailedExceptionResolutionWarning extends Warning {
|
||||
|
|
Loading…
Reference in New Issue