code cleanup of nullpointer analysis

- replace tabs with whitespace
- adjust documentation to refer to renamed stuff
This commit is contained in:
Juergen Graf 2012-03-30 13:43:57 +02:00
parent acde4add28
commit 34674387e6
11 changed files with 1329 additions and 1342 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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())");
}

View File

@ -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";
}
}

View File

@ -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) {

View File

@ -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) {