Class ExposedNamesCollector

java.lang.Object
com.ibm.wala.cast.tree.visit.CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
com.ibm.wala.cast.ir.translator.ExposedNamesCollector

public class ExposedNamesCollector extends CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
discovers which names declared by an entity are exposed, i.e., accessed by nested functions.
  • Constructor Details

    • ExposedNamesCollector

      public ExposedNamesCollector()
  • Method Details

    • getEntity2ExposedNames

      public Map<CAstEntity,Set<String>> getEntity2ExposedNames()
    • getEntity2WrittenNames

      public Map<CAstEntity,Set<Pair<CAstEntity,String>>> getEntity2WrittenNames()
    • run

      public void run(CAstEntity N)
      run the collector on an entity
      Parameters:
      N - the entity
    • makeCodeContext

      protected com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext makeCodeContext(com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext context, CAstEntity n)
      Description copied from class: CAstVisitor
      Construct a context for a Code entity.
      Overrides:
      makeCodeContext in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Parameters:
      context - a visitor-specific context in which the code was visited
      n - the code entity
    • leaveDeclStmt

      protected void leaveDeclStmt(CAstNode n, com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext c, CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext> visitor)
      Description copied from class: CAstVisitor
      Leave a DeclStmt node.
      Overrides:
      leaveDeclStmt in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Parameters:
      n - the node to process
      c - a visitor-specific context
    • leaveFunctionStmt

      protected void leaveFunctionStmt(CAstNode n, com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext c, CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext> visitor)
      Description copied from class: CAstVisitor
      Leave a FunctionStmt node.
      Overrides:
      leaveFunctionStmt in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Parameters:
      n - the node to process
      c - a visitor-specific context
    • leaveClassStmt

      protected void leaveClassStmt(CAstNode n, com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext c, CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext> visitor)
      Description copied from class: CAstVisitor
      Leave a FunctionStmt node.
      Overrides:
      leaveClassStmt in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Parameters:
      n - the node to process
      c - a visitor-specific context
    • leaveVar

      protected void leaveVar(CAstNode n, com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext c, CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext> visitor)
      Description copied from class: CAstVisitor
      Leave a Var node.
      Overrides:
      leaveVar in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Parameters:
      n - the node to process
      c - a visitor-specific context
    • leaveVarAssignOp

      protected void leaveVarAssignOp(CAstNode n, CAstNode v, CAstNode a, boolean pre, com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext c, CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext> visitor)
      Description copied from class: CAstVisitor
      Visit a Var Op/Assignment node after visiting the LHS.
      Overrides:
      leaveVarAssignOp in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Parameters:
      n - the LHS node to process
      v - the RHS node to process
      a - the assignment node to process
      pre - whether the value before the operation should be used
      c - a visitor-specific context
    • leaveVarAssign

      protected void leaveVarAssign(CAstNode n, CAstNode v, CAstNode a, com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext c, CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext> visitor)
      Description copied from class: CAstVisitor
      Visit a Var Assignment node after visiting the LHS.
      Overrides:
      leaveVarAssign in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Parameters:
      n - the LHS node to process
      v - the RHS node to process
      a - the assignment node to process
      c - a visitor-specific context
    • doVisit

      protected boolean doVisit(CAstNode n, com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext context, CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext> visitor)
      Description copied from class: CAstVisitor
      Node processing hook; sub-classes are expected to override if they introduce new node types.

      (Should invoke super.doVisit() for unprocessed nodes.)

      Overrides:
      doVisit in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Returns:
      true if node was handled
    • doVisitAssignNodes

      protected boolean doVisitAssignNodes(CAstNode n, com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext context, CAstNode v, CAstNode a, CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext> visitor)
      Description copied from class: CAstVisitor
      Node processing hook; sub-classes are expected to override if they introduce new node types that appear on the left hand side of assignment operations.

      (Should invoke super.doVisit() for unprocessed nodes.)

      Overrides:
      doVisitAssignNodes in class CAstVisitor<com.ibm.wala.cast.ir.translator.ExposedNamesCollector.EntityContext>
      Returns:
      true if node was handled