tip.util
Class LocalDeclCollector

java.lang.Object
  extended by tip.analysis.AnalysisAdapter
      extended by tip.analysis.DepthFirstAdapter
          extended by tip.util.LocalDeclCollector
All Implemented Interfaces:
Analysis

public class LocalDeclCollector
extends DepthFirstAdapter

LocalDeclCollector defines methods for collecting all referred ALocalDecl nodes in the subtree of an AST node or in the subtrees of nodes associated with points in a control flow graph.

Author:
Johnni Winther, jw@brics.dk

Constructor Summary
LocalDeclCollector()
           
 
Method Summary
 void caseALocalDecl(ALocalDecl node)
          Adds the ALocalDecl node to the collection.
 void caseTIdentifier(TIdentifier node)
          Adds ALocalDecl instances of node.decl to the collection.
static Collection<ALocalDecl> collectLocalDecls(Collection<IProgramPoint> points)
          Collects all ALocalDecl nodes referred to in the subtrees of nodes associated with the program points in the set of points.
static Collection<ALocalDecl> collectLocalDecls(ICFG cfg)
          Collects all ALocalDecl nodes referred to in the subtrees of nodes associated with the program points in the control flow graph cfg.
static Collection<ALocalDecl> collectLocalDecls(Node node)
          Collects all ALocalDecl nodes referred to in the subtree of node.
 
Methods inherited from class tip.analysis.DepthFirstAdapter
caseABinopExp, caseABlock, caseABlockStm, caseABody, caseADeclStm, caseADerefExp, caseADivideBinop, caseAEqBinop, caseAFuncDecl, caseAFunctionCallExp, caseAFunctionPtrCallExp, caseAGtBinop, caseAIfThenElseStm, caseAIfThenStm, caseAInputExp, caseAIntConstExp, caseAMallocExp, caseAMinusBinop, caseANullExp, caseAOutputStm, caseAPlusBinop, caseAPointerExp, caseAProgram, caseAReturnStm, caseATimesBinop, caseAVarExp, caseAWhileStm, caseStart, caseAAssignPtrStm, caseAAssignVarStm, defaultIn, defaultInPBinop, defaultInPBlock, defaultInPBody, defaultInPDecl, defaultInPExp, defaultInPProgram, defaultInPStm, defaultOut, defaultOutPBinop, defaultOutPBlock, defaultOutPBody, defaultOutPDecl, defaultOutPExp, defaultOutPProgram, defaultOutPStm, defaultPBinop, defaultPBlock, defaultPBody, defaultPDecl, defaultPExp, defaultPProgram, defaultPStm, inABinopExp, inABlock, inABlockStm, inABody, inADeclStm, inADerefExp, inADivideBinop, inAEqBinop, inAFuncDecl, inAFunctionCallExp, inAFunctionPtrCallExp, inAGtBinop, inAIfThenElseStm, inAIfThenStm, inAInputExp, inAIntConstExp, inALocalDecl, inAMallocExp, inAMinusBinop, inANullExp, inAOutputStm, inAPlusBinop, inAPointerExp, inAProgram, inAReturnStm, inATimesBinop, inAVarExp, inAWhileStm, inStart, inAAssignPtrStm, inAAssignVarStm, outABinopExp, outABlock, outABlockStm, outABody, outADeclStm, outADerefExp, outADivideBinop, outAEqBinop, outAFuncDecl, outAFunctionCallExp, outAFunctionPtrCallExp, outAGtBinop, outAIfThenElseStm, outAIfThenStm, outAInputExp, outAIntConstExp, outALocalDecl, outAMallocExp, outAMinusBinop, outANullExp, outAOutputStm, outAPlusBinop, outAPointerExp, outAProgram, outAReturnStm, outATimesBinop, outAVarExp, outAWhileStm, outStart, outAAssignPtrStm, outAAssignVarStm
 
Methods inherited from class tip.analysis.AnalysisAdapter
caseEOF, caseTAnd, caseTAssign, caseTComma, caseTCommentBlock, caseTCommentSingle, caseTDiv, caseTElse, caseTEq, caseTGt, caseTIf, caseTInput, caseTIntegerConst, caseTLBrace, caseTLPar, caseTMalloc, caseTMinus, caseTNull, caseTOutput, caseTPlus, caseTRBrace, caseTReturn, caseTRPar, caseTSemicolon, caseTStar, caseTVar, caseTWhile, caseTWhiteSpace, defaultNode, defaultToken, getIn, getOut, setIn, setOut
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalDeclCollector

public LocalDeclCollector()
Method Detail

caseTIdentifier

public void caseTIdentifier(TIdentifier node)
Adds ALocalDecl instances of node.decl to the collection.

Specified by:
caseTIdentifier in interface Analysis
Overrides:
caseTIdentifier in class AnalysisAdapter
Parameters:
node - the visited TIdentifier

caseALocalDecl

public void caseALocalDecl(ALocalDecl node)
Adds the ALocalDecl node to the collection.

Specified by:
caseALocalDecl in interface Analysis
Overrides:
caseALocalDecl in class DepthFirstAdapter
Parameters:
node - the visited ALocalDecl

collectLocalDecls

public static Collection<ALocalDecl> collectLocalDecls(Node node)
Collects all ALocalDecl nodes referred to in the subtree of node.

Parameters:
node - the node where the collection starts
Returns:
the collection referred ALocalDecl nodes

collectLocalDecls

public static Collection<ALocalDecl> collectLocalDecls(Collection<IProgramPoint> points)
Collects all ALocalDecl nodes referred to in the subtrees of nodes associated with the program points in the set of points.

Parameters:
points - the set of program points investigated
Returns:
the collection referred ALocalDecl nodes

collectLocalDecls

public static Collection<ALocalDecl> collectLocalDecls(ICFG cfg)
Collects all ALocalDecl nodes referred to in the subtrees of nodes associated with the program points in the control flow graph cfg.

Parameters:
cfg - the investigated control flow graph
Returns:
the collection referred ALocalDecl nodes