cinsn_t Struct Reference

Ctree element: statement. More...

Inheritance diagram for cinsn_t:
citem_t ccase_t

List of all members.

Public Member Functions

 cinsn_t (const cinsn_t &r)
void swap (cinsn_t &r)
cinsn_toperator= (const cinsn_t &r)
cinsn_tassign (const cinsn_t &r)
 DECLARE_COMPARISONS (cinsn_t)
void replace_by (cinsn_t *r)
 Replace the statement.
void cleanup (void)
 Cleanup the statement.
void zero (void)
 Overwrite with zeroes without cleaning memory or deleting children.
cinsn_tnew_insn (ea_t ea)
 Create a new statement.
cif_tcreate_if (cexpr_t *cnd)
 Create a new if-statement.
void print (int indent, vc_printer_t &vp, use_curly_t use_curly=CALC_CURLY_BRACES) const
 Print the statement into many lines.
size_t print1 (char *buf, size_t bufsize, const cfunc_t *func) const
 Print the statement into one line.
bool is_ordinary_flow (void) const
 Check if the statement passes execution to the next statement.
bool contains_insn (ctype_t type) const
 Check if the statement contains a statement of the specified type.
bool collect_free_breaks (cinsnptrvec_t *breaks)
 Collect free break statements.
bool collect_free_continues (cinsnptrvec_t *continues)
 Collect free continue statements.
bool contains_free_break (void) const
 Check if the statement has free break statements.
bool contains_free_continue (void) const
 Check if the statement has free continue statements.

Public Attributes

union {
   cblock_t *   cblock
 details of block-statement
   cexpr_t *   cexpr
 details of expression-statement
   cif_t *   cif
 details of if-statement
   cfor_t *   cfor
 details of for-statement
   cwhile_t *   cwhile
 details of while-statement
   cdo_t *   cdo
 details of do-statement
   cswitch_t *   cswitch
 details of switch-statement
   creturn_t *   creturn
 details of return-statement
   cgoto_t *   cgoto
 details of goto-statement
   casm_t *   casm
 details of asm-statement
}; 

Detailed Description

Ctree element: statement.

Depending on the exact statement type, various fields of the union are used.

Examples:

hexrays_sample3.cpp, hexrays_sample5.cpp, and hexrays_sample7.cpp.

Definition at line 1936 of file hexrays.hpp.


Member Function Documentation

void cinsn_t::cleanup ( void   ) 

Cleanup the statement.

This function properly deletes all children and sets the item type to cit_empty.

Definition at line 4480 of file hexrays.hpp.

References hexdsp.

bool cinsn_t::collect_free_breaks ( cinsnptrvec_t breaks  ) 

Collect free break statements.

This function finds all free break statements within the current statement. A break statement is free if it does not have a loop or switch parent that that is also within the current statement.

Parameters:
breaks pointer to the variable where the vector of all found free break statements is returned. This argument can be NULL.
Returns:
true if some free break statements have been found

Definition at line 4522 of file hexrays.hpp.

References hexdsp.

bool cinsn_t::collect_free_continues ( cinsnptrvec_t continues  ) 

Collect free continue statements.

This function finds all free continue statements within the current statement. A continue statement is free if it does not have a loop parent that that is also within the current statement.

Parameters:
continues pointer to the variable where the vector of all found free continue statements is returned. This argument can be NULL.
Returns:
true if some free continue statements have been found

Definition at line 4528 of file hexrays.hpp.

References hexdsp.

bool cinsn_t::contains_insn ( ctype_t  type  )  const

Check if the statement contains a statement of the specified type.

Parameters:
type statement opcode to look for
Returns:
true if the specified opcode has been found

Definition at line 4516 of file hexrays.hpp.

References hexdsp.

cif_t & cinsn_t::create_if ( cexpr_t cnd  ) 

Create a new if-statement.

The current statement must be a block. The new statement will be appended to it.

Parameters:
cnd if condition. It will be deleted after being copied.

Definition at line 4492 of file hexrays.hpp.

References hexdsp.

bool cinsn_t::is_ordinary_flow ( void   )  const

Check if the statement passes execution to the next statement.

Returns:
false if the statement breaks the control flow (like goto, return, etc)

Definition at line 4510 of file hexrays.hpp.

References hexdsp.

cinsn_t & cinsn_t::new_insn ( ea_t  ea  ) 

Create a new statement.

The current statement must be a block. The new statement will be appended to it.

Parameters:
ea statement address

Definition at line 4486 of file hexrays.hpp.

References hexdsp.

void cinsn_t::print ( int  indent,
vc_printer_t vp,
use_curly_t  use_curly = CALC_CURLY_BRACES 
) const

Print the statement into many lines.

Parameters:
indent indention (number of spaces) for the statement
vp printer helper class which will receive the generated text.
use_curly if the statement is a block, how should curly braces be printed.

Definition at line 4498 of file hexrays.hpp.

References hexdsp.

size_t cinsn_t::print1 ( char *  buf,
size_t  bufsize,
const cfunc_t func 
) const

Print the statement into one line.

Currently this function is not available.

Parameters:
buf output buffer
bufsize size of output buffer
func parent function. This argument is used to find out the referenced variable names.
Returns:
length of the generated text.

Reimplemented from citem_t.

Definition at line 4504 of file hexrays.hpp.

References hexdsp.

void cinsn_t::replace_by ( cinsn_t r  ) 

Replace the statement.

The children of the statement are abandoned (not freed). The statement pointed by 'r' is moved to 'this' statement

Parameters:
r the source statement. It is deleted after being copied

Definition at line 4474 of file hexrays.hpp.

References hexdsp.