CBMC
Loading...
Searching...
No Matches
Public Member Functions | List of all members
codet Class Reference

Data structure for representing an arbitrary statement in a program. More...

#include <std_code_base.h>

+ Inheritance diagram for codet:
+ Collaboration diagram for codet:

Public Member Functions

  codet (const irep_idt &statement)
 
  codet (const irep_idt &statement, source_locationt loc)
 
  codet (const irep_idt &statement, operandst _op)
 
  codet (const irep_idt &statement, operandst op, source_locationt loc)
 
 
 
  In the case of a codet type that represents multiple statements, return the first of them.
 
  In the case of a codet type that represents multiple statements, return the first of them.
 
  In the case of a codet type that represents multiple statements, return the last of them.
 
  In the case of a codet type that represents multiple statements, return the last of them.
 
exprtop0 ()
 
const exprtop0 () const
 
exprtop1 ()
 
const exprtop1 () const
 
exprtop2 ()
 
const exprtop2 () const
 
exprtop3 ()
 
const exprtop3 () const
 
- Public Member Functions inherited from exprt
  exprt ()
 
 
  exprt (irep_idt _id, typet _type)
 
 
 
typettype ()
  Return the type of the expression.
 
 
  Return true if there is at least one operand.
 
 
 
  Add the source location from location, if it is non-nil.
 
  Add the source location from location, if it is non-nil.
 
  Add the source location from other, if it has any.
 
  Add the source location from other, if it has any.
 
void  reserve_operands (operandst::size_type n)
 
  Copy the given argument to the end of exprt's operands.
 
  Add the given argument to the end of exprt's operands.
 
  Add the given argument to the end of exprt's operands.
 
  Add the given arguments to the end of exprt's operands.
 
  Add the given arguments to the end of exprt's operands.
 
  Return whether the expression is a constant.
 
  Return whether the expression is a constant representing true.
 
  Return whether the expression is a constant representing false.
 
  Return whether the expression is a constant representing 0.
 
  Return whether the expression is a constant representing 1.
 
  Return whether the expression represents a Boolean.
 
  Get a source_locationt from the expression or from its operands (non-recursively).
 
 
 
 
  These are pre-order traversal visitors, i.e., the visitor is executed on a node before its children have been visited.
 
 
void  visit_pre (std::function< void(exprt &)>)
 
void  visit_pre (std::function< void(const exprt &)>) const
 
void  visit_post (std::function< void(exprt &)>)
  These are post-order traversal visitors, i.e., the visitor is executed on a node after its children have been visited.
 
void  visit_post (std::function< void(const exprt &)>) const
 
 
 
 
 
 
 
depth_iteratort  depth_begin (std::function< exprt &()> mutate_root) const
 
 
 
 
 
- Public Member Functions inherited from irept
 
 
 
 
  irept ()=default
 
 
const std::string &  id_string () const
 
void  id (const irep_idt &_data)
 
 
ireptadd (const irep_idt &name)
 
ireptadd (const irep_idt &name, irept irep)
 
const std::string &  get_string (const irep_idt &name) const
 
 
 
 
std::size_t  get_size_t (const irep_idt &name) const
 
 
void  set (const irep_idt &name, const irep_idt &value)
 
void  set (const irep_idt &name, irept irep)
 
void  set (const irep_idt &name, const long long value)
 
void  set_size_t (const irep_idt &name, const std::size_t value)
 
 
 
 
 
 
void  swap (irept &irep)
 
  defines ordering on the internal representation
 
  defines ordering on the internal representation
 
  defines ordering on the internal representation comments are ignored
 
void  clear ()
 
 
subtget_sub ()
 
 
 
 
std::size_t  hash () const
 
std::size_t  full_hash () const
 
 
std::string  pretty (unsigned indent=0, unsigned max_indent=0) const
 
- Public Member Functions inherited from sharing_treet< irept, forward_list_as_mapt< irep_idt, irept > >
 
 
 
 
 
 
 
 
const dtread () const
 
dtwrite ()
 

Additional Inherited Members

- Public Types inherited from exprt
typedef std::vector< exprtoperandst
 
- Public Types inherited from irept
 
 
 
 
  Used to refer to this class from derived classes.
 
- Static Public Member Functions inherited from exprt
  Check that the expression is well-formed (shallow checks only, i.e., subexpressions and its type are not checked).
 
  Check that the expression is well-formed, assuming that its subexpressions and type have all ready been checked for well-formedness.
 
  Check that the expression is well-formed (full check, including checks of all subexpressions and the type)
 
- Static Public Member Functions inherited from irept
 
  count the number of named_sub elements that are not comments
 
- Protected Member Functions inherited from exprt
exprtop0 ()
 
exprtop1 ()
 
exprtop2 ()
 
exprtop3 ()
 
const exprtop0 () const
 
const exprtop1 () const
 
const exprtop2 () const
 
const exprtop3 () const
 
 
 
- Protected Member Functions inherited from sharing_treet< irept, forward_list_as_mapt< irep_idt, irept > >
void  detach ()
 
- Static Protected Member Functions inherited from sharing_treet< irept, forward_list_as_mapt< irep_idt, irept > >
 
  Does the same as remove_ref, but using an explicit stack instead of recursion.
 
dtdata
 
- Static Protected Attributes inherited from sharing_treet< irept, forward_list_as_mapt< irep_idt, irept > >
 

Detailed Description

Data structure for representing an arbitrary statement in a program.

Every specific type of statement (e.g. block of statements, assignment, if-then-else statement...) is represented by a subtype of codet. codets are represented to be subtypes of exprt since statements can occur in an expression context in C: for example, the assignment x = y; is an expression with return value y. For other types of statements in an expression context, see e.g. https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html. To distinguish a codet from other exprts, we set its id() to ID_code. To distinguish different types of codet, we use a named sub ID_statement.

Definition at line 28 of file std_code_base.h.

Constructor & Destructor Documentation

◆  codet() [1/4]

codet::codet ( const irep_idtstatement )
inlineexplicit
Parameters
statement Specifies the type of the codet to be constructed, e.g. ID_block for a code_blockt or ID_assign for a code_frontend_assignt.

Definition at line 34 of file std_code_base.h.

◆  codet() [2/4]

codet::codet ( const irep_idtstatement,
)
inline

Definition at line 39 of file std_code_base.h.

◆  codet() [3/4]

codet::codet ( const irep_idtstatement,
operandst  _op 
)
inlineexplicit
Parameters
statement Specifies the type of the codet to be constructed, e.g. ID_block for a code_blockt or ID_assign for a code_frontend_assignt.
_op any operands to be added

Definition at line 49 of file std_code_base.h.

◆  codet() [4/4]

codet::codet ( const irep_idtstatement,
operandst  op,
)
inline

Definition at line 54 of file std_code_base.h.

Member Function Documentation

◆  first_statement() [1/2]

codet & codet::first_statement ( )

In the case of a codet type that represents multiple statements, return the first of them.

Otherwise return the codet itself.

Definition at line 18 of file std_code.cpp.

◆  first_statement() [2/2]

const codet & codet::first_statement ( ) const

In the case of a codet type that represents multiple statements, return the first of them.

Otherwise return the codet itself.

Definition at line 35 of file std_code.cpp.

◆  get_statement()

const irep_idt & codet::get_statement ( ) const
inline

Definition at line 65 of file std_code_base.h.

◆  last_statement() [1/2]

codet & codet::last_statement ( )

In the case of a codet type that represents multiple statements, return the last of them.

Otherwise return the codet itself.

Definition at line 52 of file std_code.cpp.

◆  last_statement() [2/2]

const codet & codet::last_statement ( ) const

In the case of a codet type that represents multiple statements, return the last of them.

Otherwise return the codet itself.

Definition at line 69 of file std_code.cpp.

◆  op0() [1/2]

exprt & exprt::op0 ( )
inline

Definition at line 134 of file expr.h.

◆  op0() [2/2]

const exprt & exprt::op0 ( ) const
inline

Definition at line 146 of file expr.h.

◆  op1() [1/2]

exprt & exprt::op1 ( )
inline

Definition at line 137 of file expr.h.

◆  op1() [2/2]

const exprt & exprt::op1 ( ) const
inline

Definition at line 149 of file expr.h.

◆  op2() [1/2]

exprt & exprt::op2 ( )
inline

Definition at line 140 of file expr.h.

◆  op2() [2/2]

const exprt & exprt::op2 ( ) const
inline

Definition at line 152 of file expr.h.

◆  op3() [1/2]

exprt & exprt::op3 ( )
inline

Definition at line 143 of file expr.h.

◆  op3() [2/2]

const exprt & exprt::op3 ( ) const
inline

Definition at line 155 of file expr.h.

◆  set_statement()

void codet::set_statement ( const irep_idtstatement )
inline

Definition at line 60 of file std_code_base.h.


The documentation for this class was generated from the following files:

AltStyle によって変換されたページ (->オリジナル) /