ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
clang_cpp_adjust_code_gen.cpp File Reference
Include dependency graph for clang_cpp_adjust_code_gen.cpp:

Functions

static exprt gen_vptr_init_rhs (contextt &context, const struct_union_typet::componentt &comp, const code_typet &ctor_type)
static irep_idt ctor_class_id (const code_typet &ctor_type)
 A ctor's or dtor's first argument is this, so its pointee names the class the function is declared in.
static code_blockt & initializer_block (code_blockt &body)
 The block holding a ctor's initializers: its body, or the try block a ctor that destroys its built subobjects on unwind puts them in.
static bool is_base_construction (const exprt &op)
 A leading base-subobject construction: a base ctor call (tagged #is_base_ctor_call), one wrapped in if(__is_complete){...} (esbmc/esbmc#938), or the progress marker before one.
void gen_vptr_initializations (contextt &context, symbolt &symbol)
 Write each class's vtable pointer at the entry of a constructor or destructor body, so a virtual call during construction resolves to that class's overrides.

Function Documentation

◆ ctor_class_id()

irep_idt ctor_class_id ( const code_typet & ctor_type)
static

A ctor's or dtor's first argument is this, so its pointee names the class the function is declared in.

Derived rather than read from the code type's #member_name, which is no part of the IREP2 code type – 420 observations over the C++ corpora agree (frontends-to-irep2.md §50).

◆ gen_vptr_init_rhs()

exprt gen_vptr_init_rhs ( contextt & context,
const struct_union_typet::componentt & comp,
const code_typet & ctor_type )
static

◆ gen_vptr_initializations()

void gen_vptr_initializations ( contextt & context,
symbolt & symbol )

Write each class's vtable pointer at the entry of a constructor or destructor body, so a virtual call during construction resolves to that class's overrides.

Shared rather than a member of clang_cpp_adjust because the IREP2 C++ pass needs the same code generated and the function reads nothing but the context (docs/roadmap/scope-clang-cpp-irep2.md §3.6).

◆ initializer_block()

code_blockt & initializer_block ( code_blockt & body)
static

The block holding a ctor's initializers: its body, or the try block a ctor that destroys its built subobjects on unwind puts them in.

◆ is_base_construction()

bool is_base_construction ( const exprt & op)
static

A leading base-subobject construction: a base ctor call (tagged #is_base_ctor_call), one wrapped in if(__is_complete){...} (esbmc/esbmc#938), or the progress marker before one.