A helper ctree traversal class that maintains parent information. More...
#include <hexrays.hpp>
Public Member Functions | |
ctree_parentee_t (bool post=false) | |
bool | recalc_parent_types () |
Recalculate type of parent nodes. More... | |
cblock_t * | get_block () |
Get pointer to the parent block of the currently visited item. More... | |
Public Member Functions inherited from ctree_visitor_t | |
bool | maintain_parents () const |
Should the parent information by maintained? More... | |
bool | must_prune () const |
Should the traversal skip the children of the current item? More... | |
bool | must_restart () const |
Should the traversal restart? More... | |
bool | is_postorder () const |
Should the leave...() functions be called? More... | |
bool | only_insns () const |
Should all expressions be automatically pruned? More... | |
void | prune_now () |
Prune children. More... | |
void | clr_prune () |
Do not prune children. This is an internal function, no need to call it. More... | |
void | set_restart () |
Restart the travesal. Meaningful only in apply_to_exprs() More... | |
void | clr_restart () |
Do not restart. This is an internal function, no need to call it. More... | |
ctree_visitor_t (int _flags) | |
Constructor. More... | |
int | apply_to (citem_t *item, citem_t *parent) |
Traverse ctree. More... | |
int | apply_to_exprs (citem_t *item, citem_t *parent) |
Traverse only expressions. More... | |
cexpr_t * | parent_expr () |
Get parent of the current item as an expression. More... | |
cinsn_t * | parent_insn () |
Get parent of the current item as a statement. More... | |
virtual int | visit_insn (cinsn_t *) |
Visit a statement. More... | |
virtual int | visit_expr (cexpr_t *) |
Visit an expression. More... | |
virtual int | leave_insn (cinsn_t *) |
Visit a statement after having visited its children. More... | |
virtual int | leave_expr (cexpr_t *) |
Visit an expression after having visited its children. More... | |
Additional Inherited Members | |
Public Attributes inherited from ctree_visitor_t | |
int | cv_flags |
Ctree visitor property bits More... | |
parents_t | parents |
Vector of parents of the current item. More... | |
Detailed Description
A helper ctree traversal class that maintains parent information.
- Examples
- hexrays_sample5.cpp.
Definition at line 5894 of file hexrays.hpp.
Constructor & Destructor Documentation
◆ ctree_parentee_t()
ctree_parentee_t::ctree_parentee_t | ( | bool | post = false | ) |
Definition at line 5896 of file hexrays.hpp.
Member Function Documentation
◆ get_block()
cblock_t * ctree_parentee_t::get_block | ( | ) |
Get pointer to the parent block of the currently visited item.
This function should be called only when the parent is a block.
Definition at line 7309 of file hexrays.hpp.
References cinsn_t::cblock, cit_block, citem_t::op, and ctree_visitor_t::parents.
◆ recalc_parent_types()
bool ctree_parentee_t::recalc_parent_types | ( | ) |
Recalculate type of parent nodes.
If a node type has been changed, the visitor must recalculate all parent types, otherwise the ctree becomes inconsistent. If during this recalculation a parent node is added/deleted, this function returns true. In this case the traversal must be stopped because the information about parent nodes is stale.
- Returns
- false-ok to continue the traversal, true-must stop.
Definition at line 11653 of file hexrays.hpp.