edu.cmu.cs.crystal.cfg.eclipse.EclipseCFG
Builds a CFG on the Eclipse AST. This class has been tested at the method level only, it has not been tested at higher or lower levels, though it would theoretically work. There is an interesting problem regarding when the transfer function for a node appears if it is a control flow statement. That is, when does the transfer statement for constructs like if and while occur? We have produced three possibilities: Kevin: Should appear at the point when the branching of control flow occurs. For example, the the conditionals of if and while. Nels: Should appear at the merge point of the control flow. This is the conditional for while, and the node that merges the two if branches. Ciera: Should appear after all the children have been visited. This is the merge point on if, and it is the node after the conditional on while. Then we decided that no one in their right mind should be using transfer functions on control flow anyway, so we can do whatever we want. Since I'm writing this and I have a nice design for the third option anyway, we're going with that. Note: Since this was written someone (Thomas? Nels?) did need to transfer on the control flow. He needed it at the merge point though. The subtype @link{EclipseNodeFirstCFG} handles that, and is currently the default control flow graph used in Crystal. Algorithm description: This class visits each node of the AST. When it visits a node, it maps the ASTNode to the CFGNode that it is creating. This allows a parent node to pull it out later and insert it into the graph. There are several other data structures to help us with control flow. These are described individually later. - In the previsit method, we create the node and put it in the map. - In the visit method, we prepare any data structures that will be needed by the children. - In the endvisit method, we put together the CFG for this node and its children (with the exception of any edges that were added by children through the data structures.
@author ciera