Hex-Rays logo State-of-the-art binary code analysis tools
email icon

Basic ctree item. More...

#include <hexrays.hpp>

Inheritance diagram for citem_t:
cexpr_t cinsn_t carg_t ccase_t

Public Member Functions

 citem_t (ctype_t o=cot_empty)
 
void swap (citem_t &r)
 Swap two citem_t. More...
 
bool is_expr (void) const
 Is an expression? More...
 
bool contains_expr (const cexpr_t *e) const
 Does the item contain an expression? More...
 
bool contains_label (void) const
 Does the item contain a label? More...
 
const citem_tfind_parent_of (const citem_t *sitem) const
 Find parent of the specified item. More...
 
citem_tfind_parent_of (const citem_t *item)
 
citem_tfind_closest_addr (ea_t _ea)
 
void print1 (qstring *vout, const cfunc_t *func) const
 Print item into one line. More...
 

Public Attributes

ea_t ea = BADADDR
 address that corresponds to the item. may be BADADDR More...
 
ctype_t op = cot_empty
 item type More...
 
int label_num = -1
 label number. More...
 
int index = -1
 an index in cfunc_t::treeitems. More...
 

Detailed Description

Basic ctree item.

This is an abstract class (but we don't use virtual functions in ctree, so the compiler will not disallow you to create citem_t instances). However, items of pure citem_t type must never be created. Two classes, cexpr_t and cinsn_t are derived from it.

Examples
hexrays_sample14.cpp, hexrays_sample17.cpp, and hexrays_sample5.cpp.

Definition at line 5993 of file hexrays.hpp.

Constructor & Destructor Documentation

◆ citem_t()

citem_t::citem_t ( ctype_t  o = cot_empty)

Definition at line 6004 of file hexrays.hpp.

◆ ~citem_t()

citem_t::~citem_t ( void  )

Definition at line 6027 of file hexrays.hpp.

Member Function Documentation

◆ contains_expr()

bool citem_t::contains_expr ( const cexpr_t e) const

Does the item contain an expression?

Definition at line 11453 of file hexrays.hpp.

◆ contains_label()

bool citem_t::contains_label ( void  ) const

Does the item contain a label?

Definition at line 11459 of file hexrays.hpp.

◆ find_closest_addr()

citem_t * citem_t::find_closest_addr ( ea_t  _ea)
Examples
hexrays_sample14.cpp.

Definition at line 11471 of file hexrays.hpp.

◆ find_parent_of() [1/2]

citem_t * citem_t::find_parent_of ( const citem_t item)

Definition at line 6023 of file hexrays.hpp.

◆ find_parent_of() [2/2]

const citem_t * citem_t::find_parent_of ( const citem_t sitem) const

Find parent of the specified item.

Parameters
sitemItem to find the parent of. The search will be performed among the children of the item pointed by this.
Returns
nullptr if not found
Examples
hexrays_sample17.cpp.

Definition at line 11465 of file hexrays.hpp.

◆ is_expr()

bool citem_t::is_expr ( void  ) const

Is an expression?

Examples
hexrays_sample5.cpp.

Definition at line 6013 of file hexrays.hpp.

◆ print1()

void citem_t::print1 ( qstring *  vout,
const cfunc_t func 
) const

Print item into one line.

Parameters
voutoutput buffer
funcparent function. This argument is used to find out the referenced variable names.
Returns
length of the generated text.

Definition at line 7164 of file hexrays.hpp.

◆ swap()

void citem_t::swap ( citem_t r)

Swap two citem_t.

Definition at line 6006 of file hexrays.hpp.

References ea, label_num, and op.

Member Data Documentation

◆ ea

ea_t citem_t::ea = BADADDR

address that corresponds to the item. may be BADADDR

Examples
hexrays_sample14.cpp, hexrays_sample17.cpp, hexrays_sample3.cpp, hexrays_sample5.cpp, and hexrays_sample7.cpp.

Definition at line 5995 of file hexrays.hpp.

Referenced by swap().

◆ index

int citem_t::index = -1
mutable

an index in cfunc_t::treeitems.

meaningful only after print_func()

Definition at line 6002 of file hexrays.hpp.

◆ label_num

int citem_t::label_num = -1

label number.

-1 means no label. items of the expression types (cot_...) should not have labels at the final maturity level, but at the intermediate levels any ctree item may have a label. Labels must be unique. Usually they correspond to the basic block numbers.

Definition at line 5997 of file hexrays.hpp.

Referenced by swap().

◆ op