ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
sideeffect_assign2t Class Reference

V.4.2: wraps C-frontend sideeffect assignment nodes — simple = and compound +=, -=, etc. More...

#include <irep2_expr.h>

Inheritance diagram for sideeffect_assign2t:
[legend]

Public Member Functions

 sideeffect_assign2t (const type2tc &t, const irep_idt &o, const expr2tc &l, const expr2tc &r, const locationt &loc=locationt(), bool member_init_=false)
 sideeffect_assign2t (const sideeffect_assign2t &ref)=default
Public Member Functions inherited from expr2t
virtual ~expr2t ()=default
expr2tc clone () const
expr2tc with_type (const type2tc &new_type) const
 Build a fresh expression of the same kind and field values as this one, but with a different type.
bool operator== (const expr2t &ref) const
bool operator< (const expr2t &ref) const
bool operator!= (const expr2t &ref) const
std::string pretty (unsigned int indent=0) const
 Produce textual representation of this expr.
DUMP_METHOD void dump () const
 Write textual representation of this object to stdout.
size_t crc () const
 Calculate a hash/digest of the current expr.
bool cmp (const expr2t &ref) const
 Structural comparison.
int lt (const expr2t &ref) const
 Trinary structural ordering.
list_of_memberst tostring (unsigned int indent) const
 Convert fields of subclasses to a string representation.
const expr2tc * get_sub_expr (size_t idx) const
 Fetch a sub-operand.
size_t get_num_sub_exprs () const
 Count the number of sub-exprs there are.
expr2tc simplify () const
 Simplify an expression.
expr2tc simplify (bool suppress_reassoc) const
 Simplify with reassociation suppression.
virtual expr2tc do_simplify () const
 expr-specific simplification methods.
template<typename T>
void foreach_operand (T &&t) const
 Indirect, abstract operand iteration.
template<typename T>
void Foreach_operand (T &&t)
Public Member Functions inherited from irep2t
 irep2t () noexcept
 irep2t (const irep2t &) noexcept
irep2t & operator= (const irep2t &)=delete
virtual ~irep2t ()=default
void mark_writer () const noexcept
void clear_writer () const noexcept

Public Attributes

irep_idt op
bool member_init
 This assignment is a constructor's member initialiser.
expr2tc lhs
expr2tc rhs
locationt location
Public Attributes inherited from expr2t
const expr_ids expr_id
 Instance of expr_ids recording tihs exprs type.
const type2tc type
 Type of this expr.
std::atomic< size_t > crc_val
Public Attributes inherited from irep2t
std::atomic< unsigned int > refcount
std::atomic< std::uintptr_t > writer_thread

Static Public Attributes

static constexpr std::size_t excluded_field_bytes = sizeof(locationt)
static constexpr auto fields
static std::string field_names [esbmct::num_type_fields]

Additional Inherited Members

Public Types inherited from expr2t
enum  expr_ids { end_expr_id }
 Enumeration identifying each sort of expr. More...
typedef esbmct::function_ref< void(const expr2tc &)> const_op_delegate
typedef esbmct::function_ref< void(expr2tc &)> op_delegate
typedef expr2tc container_type
typedef expr2t base_type
Static Public Member Functions inherited from irep2t
static std::uintptr_t current_thread_tag () noexcept
Protected Member Functions inherited from expr2t
 expr2t (const type2tc &type, expr_ids id)
 Primary constructor.
 expr2t (const expr2t &ref)
 Copy constructor.
void foreach_operand_impl_const (const_op_delegate &expr) const
void foreach_operand_impl (op_delegate &expr)

Detailed Description

V.4.2: wraps C-frontend sideeffect assignment nodes — simple = and compound +=, -=, etc.

— for round-trip through migrate_expr / migrate_expr_back. op carries the operator string exactly as it appears in the legacy irept (e.g. "assign", "assign+", "assign_div"), so that the back-migration can reconstruct the original sideeffect node verbatim.

Constructor & Destructor Documentation

◆ sideeffect_assign2t() [1/2]

sideeffect_assign2t::sideeffect_assign2t ( const type2tc & t,
const irep_idt & o,
const expr2tc & l,
const expr2tc & r,
const locationt & loc = locationt(),
bool member_init_ = false )
inline

◆ sideeffect_assign2t() [2/2]

sideeffect_assign2t::sideeffect_assign2t ( const sideeffect_assign2t & ref)
default

Member Data Documentation

◆ excluded_field_bytes

std::size_t sideeffect_assign2t::excluded_field_bytes = sizeof(locationt)
staticconstexpr

◆ field_names

std::string sideeffect_assign2t::field_names
static
Initial value:
=
{"op", "lhs", "rhs", "member_init", ""}

◆ fields

auto sideeffect_assign2t::fields
staticconstexpr
Initial value:
= std::make_tuple(
const type2tc type
Type of this expr.
Definition irep2.h:910
expr2tc rhs
Definition irep2_expr.h:2542
expr2tc lhs
Definition irep2_expr.h:2541
irep_idt op
Definition irep2_expr.h:2521

◆ lhs

expr2tc sideeffect_assign2t::lhs

◆ location

locationt sideeffect_assign2t::location

◆ member_init

bool sideeffect_assign2t::member_init

This assignment is a constructor's member initialiser.

The C++ adjust pass leaves such an lhs alone: a reference member is being bound here, and reading it through would copy the referent instead (docs/roadmap/scope-clang-cpp-irep2.md §3.16). The converter marks the lhs with #member_init, which has nowhere else to live in IREP2.

Declared next to op deliberately: it packs into that field's padding, so the class does not grow and fields_cover_class's slack is unaffected. Placed after location the compiler packs it into the location's padding and the invariant underflows instead.

Not reflected, for the reason sideeffect2t::constructor is not: listing it makes the field order stop matching the primary constructor's parameter order (location sits between), which is what supports_with_type_v tests, and every with_type on an assignment then aborts (§7.2). A with_type rebuild carries it through the specialization in irep2_expr.cpp.

◆ op

irep_idt sideeffect_assign2t::op

◆ rhs

expr2tc sideeffect_assign2t::rhs

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