ROSE 0.11.145.192
|
Collection of utility functions to operate on the AST.
Typedefs | |
using | replacement_map_t = std::map< SgNode *, SgNode * > |
Functions | |
void | edgePointerReplacement (replacement_map_t const &) |
For all nodes in the memory pool, it looks for the edges in the replacement map. If a match is found the edge is updated. | |
void | edgePointerReplacement (SgNode *root, replacement_map_t const &) |
Traverse the AST root looking for the edges in the replacement map. If a match is found the edge is updated. | |
bool | checkParentPointers (SgNode *root, std::ostream &out=std::cerr) |
Check that all parent pointers in the specified subtree are correct. | |
void | repairParentPointers (SgNode *root) |
Set parent pointers based on child pointers in a subtree. | |
Definition at line 17 of file AST/Utility.h.
bool Rose::AST::Utility::checkParentPointers | ( | SgNode * | root, |
std::ostream & | out = std::cerr |
||
) |
Check that all parent pointers in the specified subtree are correct.
This function does a traversal of the tree starting at the specified root and checks that each child points to the correct parent. If not, then an error message is printed and the function returns false. If you do not want error messages, then pass a closed output stream.
Safety: This function is not thread safe.
void Rose::AST::Utility::repairParentPointers | ( | SgNode * | root | ) |
Set parent pointers based on child pointers in a subtree.
Traverses a subtree, and makes sure that each child points to its parent. No diagnostics are emitted; if you want diagnostics then you should call checkParentPointers instead. I.e., checking and repairing are two separate operations.
Caveats:
root
is null, then this function is a no-op.root
is not adjusted.Safety: This function is not thread safe.