tip.util
Class DeclCollector

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

public class DeclCollector
extends DepthFirstAdapter

DeclCollector defines methods for collecting all referred PDecl 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
DeclCollector()
           
 
Method Summary
 void caseTIdentifier(TIdentifier node)
          Adds PDecl instances of node.decl to the collection.
static Collection<PDecl> collectDecls(Collection<IProgramPoint> points)
          Collects all PDecl nodes referred to in the subtrees of nodes associated with the program points in the set of points.
static Collection<PDecl> collectDecls(ICFG cfg)
          Collects all PDecl nodes referred to in the subtrees of nodes associated with the program points in the control flow graph cfg.
static Collection<PDecl> collectDecls(Node node)
          Collects all PDecl nodes referred to in the subtree of node.
 void defaultInPDecl(PDecl node)
          Adds the PDecl node to the collection.
 
Methods inherited from class tip.analysis.DepthFirstAdapter
caseABinopExp, caseABlock, caseABlockStm, caseABody, caseADeclStm, caseADerefExp, caseADivideBinop, caseAEqBinop, caseAFuncDecl, caseAFunctionCallExp, caseAFunctionPtrCallExp, caseAGtBinop, caseAIfThenElseStm, caseAIfThenStm, caseAInputExp, caseAIntConstExp, caseALocalDecl, caseAMallocExp, caseAMinusBinop, caseANullExp, caseAOutputStm, caseAPlusBinop, caseAPointerExp, caseAProgram, caseAReturnStm, caseATimesBinop, caseAVarExp, caseAWhileStm, caseStart, caseAAssignPtrStm, caseAAssignVarStm, defaultIn, defaultInPBinop, defaultInPBlock, defaultInPBody, 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

DeclCollector

public DeclCollector()
Method Detail

caseTIdentifier

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

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

defaultInPDecl

public void defaultInPDecl(PDecl node)
Adds the PDecl node to the collection.

Overrides:
defaultInPDecl in class DepthFirstAdapter
Parameters:
node - the visited PDecl

collectDecls

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

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

collectDecls

public static Collection<PDecl> collectDecls(Collection<IProgramPoint> points)
Collects all PDecl 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 PDecl nodes

collectDecls

public static Collection<PDecl> collectDecls(ICFG cfg)
Collects all PDecl 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 PDecl nodes