Have WalkAST postorder callback function return an ASTNode *

In general, it should just return the original node pointer, but for type checking
and optimization passes, it can return a new value for the node (that will be
assigned where the old one was in the tree.)

Along the way, fixed some bugs in WalkAST() where the postorder callback wouldn't
end up being called for a few expr types (sizeof, dereference, address of, 
reference).
This commit is contained in:
Matt Pharr
2011-12-16 11:06:09 -08:00
parent 018aa96c8b
commit ced3f1f5fc
5 changed files with 73 additions and 59 deletions

View File

@@ -997,12 +997,12 @@ lVaryingBCPreFunc(ASTNode *node, void *d) {
/** Postorder callback function for checking for varying breaks or
continues; decrement the varying control flow depth after the node's
children have been processed, if this is a varying if statement. */
static bool
static ASTNode *
lVaryingBCPostFunc(ASTNode *node, void *d) {
VaryingBCCheckInfo *info = (VaryingBCCheckInfo *)d;
if (lIsVaryingFor(node))
--info->varyingControlFlowDepth;
return true;
return node;
}