soot.dava.toolkits.base.AST.structuredAnalysis
Class UnreachableCodeFinder

java.lang.Object
  extended by soot.dava.toolkits.base.AST.structuredAnalysis.StructuredAnalysis
      extended by soot.dava.toolkits.base.AST.structuredAnalysis.UnreachableCodeFinder

public class UnreachableCodeFinder
extends StructuredAnalysis


Nested Class Summary
 class UnreachableCodeFinder.UnreachableCodeFlowSet
           
 
Field Summary
static boolean DEBUG
           
 
Fields inherited from class soot.dava.toolkits.base.AST.structuredAnalysis.StructuredAnalysis
DEBUG_IF, DEBUG_STATEMENTS, DEBUG_TRY, DEBUG_WHILE, MERGETYPE
 
Constructor Summary
UnreachableCodeFinder(Object analyze)
           
 
Method Summary
 Object cloneFlowSet(Object flowSet)
          Make a clone of the flowset The implementor should know when they want a shallow or deep clone
 DavaFlowSet emptyFlowSet()
           
 Object handleBreak(String label, Object output, ASTNode node)
          Need to handleBreak stmts There can be explicit breaks (in which case label is non null) There can always be implicit breaks ASTNode is non null
 Object ifNotReachableReturnInputElseProcessBodyAndReturnTrue(ASTNode node, Object input)
           
 boolean isConstructReachable(Object construct)
           
 boolean isReachable(Object input)
           
 Object newInitialFlow()
           
 Object processAbruptStatements(Stmt s, DavaFlowSet input)
          Whenever a statement has to be processed the first step is to invoke this method.
 Object processASTDoWhileNode(ASTDoWhileNode node, Object input)
           
 Object processASTForLoopNode(ASTForLoopNode node, Object input)
           
 Object processASTIfElseNode(ASTIfElseNode node, Object input)
           
 Object processASTIfNode(ASTIfNode node, Object input)
           
 Object processASTLabeledBlockNode(ASTLabeledBlockNode node, Object input)
           
 Object processASTStatementSequenceNode(ASTStatementSequenceNode node, Object input)
           
 Object processASTSwitchNode(ASTSwitchNode node, Object input)
           
 Object processASTSynchronizedBlockNode(ASTSynchronizedBlockNode node, Object input)
           
 Object processASTTryNode(ASTTryNode node, Object input)
           
 Object processASTUnconditionalLoopNode(ASTUnconditionalLoopNode node, Object input)
           
 Object processASTWhileNode(ASTWhileNode node, Object input)
           
 Object processStatement(Stmt s, Object input)
          Specific stmts within AST Constructs are processed through this method.
 Object processSwitchKey(Value key, Object input)
          Deal with the key in the switch construct
 Object processSynchronizedLocal(Local local, Object input)
          To deal with the local used for synch blocks
 Object processUnaryBinaryCondition(ASTUnaryBinaryCondition cond, Object input)
          To have maximum flexibility in analyzing conditions the analysis API breaks down the aggregated conditions to simple unary or binary conditions user defined code can then deal with each condition separatly.
 void setMergeType()
           
 
Methods inherited from class soot.dava.toolkits.base.AST.structuredAnalysis.StructuredAnalysis
debug, debug, getAfterSet, getBeforeSet, getLabel, handleContinue, isDifferent, merge, mergeExplicitAndImplicit, print, process, processASTMethodNode, processASTNode, processCondition, processSingleSubBodyNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static boolean DEBUG
Constructor Detail

UnreachableCodeFinder

public UnreachableCodeFinder(Object analyze)
Method Detail

setMergeType

public void setMergeType()
Specified by:
setMergeType in class StructuredAnalysis

newInitialFlow

public Object newInitialFlow()
Specified by:
newInitialFlow in class StructuredAnalysis

emptyFlowSet

public DavaFlowSet emptyFlowSet()
Specified by:
emptyFlowSet in class StructuredAnalysis

cloneFlowSet

public Object cloneFlowSet(Object flowSet)
Description copied from class: StructuredAnalysis
Make a clone of the flowset The implementor should know when they want a shallow or deep clone

Specified by:
cloneFlowSet in class StructuredAnalysis

processUnaryBinaryCondition

public Object processUnaryBinaryCondition(ASTUnaryBinaryCondition cond,
                                          Object input)
Description copied from class: StructuredAnalysis
To have maximum flexibility in analyzing conditions the analysis API breaks down the aggregated conditions to simple unary or binary conditions user defined code can then deal with each condition separatly. To be able to deal with entire aggregated conditions the user should wite their own implementation of the method processCondition

Specified by:
processUnaryBinaryCondition in class StructuredAnalysis

processSynchronizedLocal

public Object processSynchronizedLocal(Local local,
                                       Object input)
Description copied from class: StructuredAnalysis
To deal with the local used for synch blocks

Specified by:
processSynchronizedLocal in class StructuredAnalysis

processSwitchKey

public Object processSwitchKey(Value key,
                               Object input)
Description copied from class: StructuredAnalysis
Deal with the key in the switch construct

Specified by:
processSwitchKey in class StructuredAnalysis

processStatement

public Object processStatement(Stmt s,
                               Object input)
Description copied from class: StructuredAnalysis
Specific stmts within AST Constructs are processed through this method. It will be invoked everytime a stmt is encountered

Specified by:
processStatement in class StructuredAnalysis

processAbruptStatements

public Object processAbruptStatements(Stmt s,
                                      DavaFlowSet input)
Description copied from class: StructuredAnalysis
Whenever a statement has to be processed the first step is to invoke this method. This is to remove the tedious work of adding code to deal with abrupt control flow from the programmer of the analysis. The method invokes the processStatement method for all other statements A programmer can decide to override this method if they want to do something specific

Overrides:
processAbruptStatements in class StructuredAnalysis

handleBreak

public Object handleBreak(String label,
                          Object output,
                          ASTNode node)
Description copied from class: StructuredAnalysis
Need to handleBreak stmts There can be explicit breaks (in which case label is non null) There can always be implicit breaks ASTNode is non null

Overrides:
handleBreak in class StructuredAnalysis

isReachable

public boolean isReachable(Object input)

processASTStatementSequenceNode

public Object processASTStatementSequenceNode(ASTStatementSequenceNode node,
                                              Object input)
Overrides:
processASTStatementSequenceNode in class StructuredAnalysis

processASTLabeledBlockNode

public Object processASTLabeledBlockNode(ASTLabeledBlockNode node,
                                         Object input)
Overrides:
processASTLabeledBlockNode in class StructuredAnalysis

processASTSynchronizedBlockNode

public Object processASTSynchronizedBlockNode(ASTSynchronizedBlockNode node,
                                              Object input)
Overrides:
processASTSynchronizedBlockNode in class StructuredAnalysis

processASTIfElseNode

public Object processASTIfElseNode(ASTIfElseNode node,
                                   Object input)
Overrides:
processASTIfElseNode in class StructuredAnalysis

ifNotReachableReturnInputElseProcessBodyAndReturnTrue

public Object ifNotReachableReturnInputElseProcessBodyAndReturnTrue(ASTNode node,
                                                                    Object input)

processASTIfNode

public Object processASTIfNode(ASTIfNode node,
                               Object input)
Overrides:
processASTIfNode in class StructuredAnalysis

processASTWhileNode

public Object processASTWhileNode(ASTWhileNode node,
                                  Object input)
Overrides:
processASTWhileNode in class StructuredAnalysis

processASTDoWhileNode

public Object processASTDoWhileNode(ASTDoWhileNode node,
                                    Object input)
Overrides:
processASTDoWhileNode in class StructuredAnalysis

processASTUnconditionalLoopNode

public Object processASTUnconditionalLoopNode(ASTUnconditionalLoopNode node,
                                              Object input)
Overrides:
processASTUnconditionalLoopNode in class StructuredAnalysis

processASTForLoopNode

public Object processASTForLoopNode(ASTForLoopNode node,
                                    Object input)
Overrides:
processASTForLoopNode in class StructuredAnalysis

processASTSwitchNode

public Object processASTSwitchNode(ASTSwitchNode node,
                                   Object input)
Overrides:
processASTSwitchNode in class StructuredAnalysis

processASTTryNode

public Object processASTTryNode(ASTTryNode node,
                                Object input)
Overrides:
processASTTryNode in class StructuredAnalysis

isConstructReachable

public boolean isConstructReachable(Object construct)