code cleanup of nullpointer analysis
- replace tabs with whitespace - adjust documentation to refer to renamed stuff
This commit is contained in:
parent
acde4add28
commit
34674387e6
|
@ -57,7 +57,7 @@ public interface ExceptionPruningAnalysis<I, T extends IBasicBlock<I>> {
|
|||
/**
|
||||
* Returns the state of a node. The node has to be part of the cfg.
|
||||
* @param bb Node
|
||||
* @return EdgeState
|
||||
* @return NullPointerState
|
||||
*/
|
||||
NullPointerState getState(T bb);
|
||||
|
||||
|
|
|
@ -34,17 +34,11 @@ public class ExplodedCFGNullPointerAnalysis implements ExceptionPruningAnalysis<
|
|||
this.mState = (mState == null ? MethodState.DEFAULT : mState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see jsdg.exceptions.ExceptionPrunedCFGAnalysis#getOriginal()
|
||||
*/
|
||||
public ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> getOriginal() {
|
||||
return ExplodedControlFlowGraph.make(ir);
|
||||
}
|
||||
/*
|
||||
* @see com.ibm.wala.cfg.exc.ExceptionPrunedCFGAnalysis#compute(com.ibm.wala.util.MonitorUtil.IProgressMonitor)
|
||||
*/
|
||||
public int compute(IProgressMonitor progress) throws UnsoundGraphException, CancelException {
|
||||
ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> orig = getOriginal();
|
||||
ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> orig = ExplodedControlFlowGraph.make(ir);
|
||||
|
||||
intra = new IntraprocNullPointerAnalysis<IExplodedBasicBlock>(ir, orig, ignoredExceptions, initialState, mState);
|
||||
intra.run(progress);
|
||||
|
@ -53,14 +47,14 @@ public class ExplodedCFGNullPointerAnalysis implements ExceptionPruningAnalysis<
|
|||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see jsdg.exceptions.ExceptionPrunedCFGAnalysis#getPruned()
|
||||
* @see jsdg.exceptions.ExceptionPrunedCFGAnalysis#getCFG()
|
||||
*/
|
||||
public ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> getCFG() {
|
||||
if (intra == null) {
|
||||
throw new IllegalStateException("Run compute(IProgressMonitor) first.");
|
||||
}
|
||||
|
||||
return intra.getPrunedCfg();
|
||||
return intra.getPrunedCFG();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -71,7 +65,7 @@ public class ExplodedCFGNullPointerAnalysis implements ExceptionPruningAnalysis<
|
|||
throw new IllegalStateException("Run compute(IProgressMonitor) first.");
|
||||
}
|
||||
|
||||
ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> cfg = intra.getPrunedCfg();
|
||||
ControlFlowGraph<SSAInstruction, IExplodedBasicBlock> cfg = intra.getPrunedCFG();
|
||||
|
||||
boolean hasException = false;
|
||||
for (IExplodedBasicBlock bb : cfg) {
|
||||
|
|
|
@ -120,7 +120,7 @@ public class IntraprocNullPointerAnalysis<T extends ISSABasicBlock> {
|
|||
return deleted;
|
||||
}
|
||||
|
||||
ControlFlowGraph<SSAInstruction, T> getPrunedCfg() {
|
||||
ControlFlowGraph<SSAInstruction, T> getPrunedCFG() {
|
||||
if (pruned == null) {
|
||||
throw new IllegalStateException("Run analysis first! (call run())");
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ public class NullPointerState extends AbstractVariable<NullPointerState> {
|
|||
}
|
||||
|
||||
/**
|
||||
* This is the meet operator for the EdgeState variables.
|
||||
* This is the meet operator for the NullPointerState variables.
|
||||
* <pre>
|
||||
* ? == unknown, 1 == not null, 0 == null, * == both
|
||||
*
|
||||
|
@ -156,7 +156,7 @@ public class NullPointerState extends AbstractVariable<NullPointerState> {
|
|||
}
|
||||
|
||||
/**
|
||||
* This is a intersect operator for the EdgeState variables. It is used by the
|
||||
* This is a intersect operator for the NullPointerState variables. It is used by the
|
||||
* phi values.
|
||||
* <pre>
|
||||
* ? == unknown, 1 == not null, 0 == null, * == both
|
||||
|
@ -301,7 +301,7 @@ public class NullPointerState extends AbstractVariable<NullPointerState> {
|
|||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EdgeStateMeet";
|
||||
return "NullPointerStateMeet";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class ParameterState extends AbstractVariable<ParameterState> {
|
|||
* Inital state is UNKNOWN.
|
||||
* Lattice: UNKNOWN < { NULL, NOT_NULL } < BOTH
|
||||
*
|
||||
* public enum State { UNKNOWN, BOTH, NULL, NOT_NULL }; as defined in EdgeState
|
||||
* public enum State { UNKNOWN, BOTH, NULL, NOT_NULL }; as defined in NullPointerState
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -42,9 +42,9 @@ public class ParameterState extends AbstractVariable<ParameterState> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor to make a <code>ParameteState</code> out of a regular <code>EdgeState</code>.
|
||||
* Constructor to make a <code>ParameteState</code> out of a regular <code>NullPointerState</code>.
|
||||
*
|
||||
* @param state The <code>EdgeState</code> to parse.
|
||||
* @param state The <code>NullPointerState</code> to parse.
|
||||
* @param parameterNumbers The numbers of parameters in <code>state</code>
|
||||
*/
|
||||
public ParameterState(NullPointerState state, int[] parameterNumbers) {
|
||||
|
|
|
@ -27,18 +27,11 @@ public class SSACFGNullPointerAnalysis implements ExceptionPruningAnalysis<SSAIn
|
|||
this.mState = (mState == null ? MethodState.DEFAULT : mState);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see jsdg.exceptions.ExceptionPrunedCFGAnalysis#getOriginal()
|
||||
*/
|
||||
public ControlFlowGraph<SSAInstruction, ISSABasicBlock> getOriginal() {
|
||||
return ir.getControlFlowGraph();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see com.ibm.wala.cfg.exc.ExceptionPruningAnalysis#compute(com.ibm.wala.util.MonitorUtil.IProgressMonitor)
|
||||
*/
|
||||
public int compute(IProgressMonitor progress) throws UnsoundGraphException, CancelException {
|
||||
ControlFlowGraph<SSAInstruction, ISSABasicBlock> orig = getOriginal();
|
||||
ControlFlowGraph<SSAInstruction, ISSABasicBlock> orig = ir.getControlFlowGraph();
|
||||
|
||||
intra = new IntraprocNullPointerAnalysis<ISSABasicBlock>(ir, orig, ignoredExceptions, initialState, mState);
|
||||
intra.run(progress);
|
||||
|
@ -54,7 +47,7 @@ public class SSACFGNullPointerAnalysis implements ExceptionPruningAnalysis<SSAIn
|
|||
throw new IllegalStateException("Run compute(IProgressMonitor) first.");
|
||||
}
|
||||
|
||||
return intra.getPrunedCfg();
|
||||
return intra.getPrunedCFG();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -65,7 +58,7 @@ public class SSACFGNullPointerAnalysis implements ExceptionPruningAnalysis<SSAIn
|
|||
throw new IllegalStateException("Run compute(IProgressMonitor) first.");
|
||||
}
|
||||
|
||||
ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg = intra.getPrunedCfg();
|
||||
ControlFlowGraph<SSAInstruction, ISSABasicBlock> cfg = intra.getPrunedCFG();
|
||||
|
||||
boolean hasException = false;
|
||||
for (ISSABasicBlock bb : cfg) {
|
||||
|
|
Loading…
Reference in New Issue