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

#include <clang_cpp_convert.h>

Inheritance diagram for clang_cpp_convertert:
[legend]

Classes

struct  subobject_destructort

Public Member Functions

 clang_cpp_convertert (contextt &_context, std::unique_ptr< clang::ASTUnit > &_AST, irep_idt _mode)
virtual ~clang_cpp_convertert ()=default
Public Member Functions inherited from clang_c_convertert
 clang_c_convertert (contextt &_context, std::unique_ptr< clang::ASTUnit > &_AST, irep_idt _mode)
virtual ~clang_c_convertert ()=default
bool convert ()

Protected Types

typedef std::unordered_map< std::size_t, std::pair< std::string, typet > > this_mapt
typedef llvm::DenseMap< const CAPTURE_VARIABLE_TYPE *, clang::FieldDecl * > field_mapt
typedef std::unordered_map< std::size_t, std::pair< field_mapt, clang::FieldDecl * > > cap_mapt
using base_map
using function_switch = std::map<irep_idt, exprt>
using switch_table = std::map<irep_idt, function_switch>
using overriden_map = std::map<std::string, const clang::CXXMethodDecl &>

Protected Member Functions

bool get_decl (const clang::Decl &decl, exprt &new_expr) override
void get_decl_name (const clang::NamedDecl &nd, std::string &name, std::string &id) override
bool get_decl_ref (const clang::Decl &decl, exprt &new_expr) override
 Get reference to a declared variable or function, e.g:
bool get_type (const clang::QualType &type, typet &new_type) override
bool get_type (const clang::Type &the_type, typet &new_type) override
bool get_method (const clang::CXXMethodDecl &md, exprt &new_expr)
bool get_method_declaration (const clang::CXXMethodDecl &md, const symbolt *&symbol)
void annotate_exception_specification (const clang::FunctionDecl &fd, typet &type) override
 Since this class is inherited by clang-cpp-frontend, some get_* functions are made `virtual' to deal with clang CXX declarations */ virtual bool get_decl(const clang::Decl &decl, exprt &new_expr);.
bool get_constructor_call (const clang::CXXConstructExpr &constructor_call, exprt &new_expr)
 Get reference for constructor callsite.
bool is_lambda () const
bool get_function_body (const clang::FunctionDecl &fd, exprt &new_expr, const code_typet &ftype) override
bool get_new_initializer (const clang::CXXNewExpr &ne, exprt &new_expr)
 Attach a new-expression's initializer, and for an array its braced list's filler: a run-time element count can reach past the list.
bool get_member_initializer (const clang::Expr &init, const typet &member_type, exprt &rhs)
bool build_lambda_static_invoker (const clang::CXXMethodDecl &invoker, exprt &new_expr)
 Body for a lambda's static invoker: forward to the closure's operator().
bool get_function_params (const clang::FunctionDecl &fd, code_typet::argumentst &params) override
 Get function params for C++ contains conversion routines specific to C++ class member functions.
void name_param_and_continue (const clang::ParmVarDecl &pd, std::string &id, std::string &name, exprt &param) override
bool get_function_this_pointer_param (const clang::CXXMethodDecl &fd, code_typet::argumentst &params)
 Add implicit this' when parsing C++ class member functions, e.g: class t1 { int i; t1(){i = 1} }; The implicit this' within the constructor is represented by symbol:
bool get_struct_union_class (const clang::RecordDecl &rd) override
bool get_var (const clang::VarDecl &vd, exprt &new_expr) override
const clang::Expr & elided_copy_source (const clang::Expr &init) override
bool get_struct_union_class_fields (const clang::RecordDecl &rd, struct_union_typet &type) override
bool get_struct_union_class_methods_decls (const clang::RecordDecl &rd, typet &type) override
template<typename TemplateDecl>
bool get_template_decl (const TemplateDecl &D, bool DumpExplicitInst, exprt &new_expr)
template<typename SpecializationDecl>
bool get_template_decl_specialization (const SpecializationDecl *D, bool DumpExplicitInst, exprt &new_expr)
bool get_expr (const clang::Stmt &stmt, exprt &new_expr) override
void build_member_from_component (const clang::FunctionDecl &fd, exprt &component)
bool build_destructor_chain (const clang::CXXDestructorDecl &dd, code_blockt &body)
const this_mapt::mapped_type & method_this (const clang::CXXMethodDecl &md) const
const symbolt * nontrivial_destructor (const clang::CXXRecordDecl *rec)
bool member_destructor (const clang::FieldDecl &field, const exprt &deref, code_blockt &calls)
code_function_callt base_destructor (const symbolt &sym, const clang::CXXRecordDecl &base, const clang::CXXMethodDecl &md)
bool subobject_destructors (const clang::CXXMethodDecl &md, std::vector< subobject_destructort > &out)
bool user_code_uses_exceptions ()
codet rethrowing_catch (const code_blockt &tried, code_blockt handler)
bool destroy_object_on_body_unwind (const clang::CXXConstructorDecl &cd, std::size_t body_start, code_blockt &body)
bool unwind_constructed_subobjects (const clang::CXXConstructorDecl &cd, const std::vector< std::size_t > &starts, code_blockt &body)
bool insert_constructor_initializers (const clang::CXXConstructorDecl &cd, exprt::operandst &initializers, std::vector< std::size_t > starts, const symbolt *array_init_sym, code_blockt &body)
exprt base_dtor_this (const clang::CXXRecordDecl &base, const exprt &deref, const irep_idt &this_id, const typet &this_ptr_type)
bool annotate_class_field (const clang::FieldDecl &field, const struct_union_typet &type, struct_typet::componentt &comp)
bool annotate_class_field_access (const clang::FieldDecl &field, struct_typet::componentt &comp)
bool get_access_from_decl (const clang::Decl &decl, std::string &access)
symbolt * get_fd_symbol (const clang::FunctionDecl &fd)
bool annotate_class_method (const clang::CXXMethodDecl &cxxmdd, exprt &new_expr)
void annotate_implicit_copy_move_ctor_union (const clang::CXXMethodDecl &cxxmdd, typet &ctor_return_type)
void annotate_ctor_dtor_rtn_type (const clang::CXXMethodDecl &cxxmdd, typet &rtn_type)
bool get_ctor_dtor_ref (const clang::CXXMethodDecl &md, exprt &new_expr)
bool is_copy_or_move_ctor (const clang::DeclContext &dcxt)
bool is_defaulted_ctor (const clang::CXXMethodDecl &md)
void gen_typecast_base_ctor_call (const exprt &callee_decl, side_effect_expr_function_callt &call, exprt &initializer)
bool get_cxx_constructor_is_complete_param (const clang::CXXConstructorDecl &cxxcd, code_typet::argumentt &param)
bool need_new_object (const clang::Stmt *parentStmt, const clang::CXXConstructExpr &call)
bool get_base_map (const clang::CXXRecordDecl &cxxrd, base_map &map)
bool is_duplicate_component (const struct_typet::componentt &component, const struct_union_typet &type)
bool is_duplicate_method (const struct_typet::componentt &method, const struct_union_typet &type)
void get_base_components_methods (base_map &map, struct_union_typet &type, bool has_virtual_bases, const clang::CXXRecordDecl &cxxrd)
std::string rtti_type_name (const clang::QualType &qtype)
std::string rtti_type_name (const clang::CXXRecordDecl &rd)
exprt typeid_object (const exprt &value, const std::string &type_name, const clang::Stmt &stmt, bool dynamic)
 The object a typeid expression refers to, which has static storage duration ([expr.typeid]/1): one per type name.
bool get_struct_class_virtual_methods (const clang::CXXRecordDecl &cxxrd, struct_typet &type)
bool annotate_virtual_overriding_methods (const clang::CXXMethodDecl &md, struct_typet::componentt &comp)
symbolt * check_vtable_type_symbol_existence (const struct_typet &type)
symbolt * add_vtable_type_symbol (const struct_typet::componentt &comp, struct_typet &type)
void add_vptr (struct_typet &type)
void add_vtable_type_entry (struct_typet &type, struct_typet::componentt &comp, symbolt *vtable_type_symbol)
void get_overriden_methods (const clang::CXXMethodDecl &md, overriden_map &map)
void add_thunk_method (const clang::CXXMethodDecl &md, const struct_typet::componentt &component, struct_typet &type)
void update_thunk_this_type (typet &thunk_symbol_type, const std::string &base_class_id)
void add_thunk_method_arguments (symbolt &thunk_func_symb)
void add_thunk_method_body (symbolt &thunk_func_symb, const struct_typet::componentt &component)
void add_thunk_method_body_return (symbolt &thunk_func_symb, const struct_typet::componentt &component, const exprt &late_cast_this)
void add_thunk_method_body_no_return (symbolt &thunk_func_symb, const struct_typet::componentt &component, const exprt &late_cast_this)
void add_thunk_component_to_type (const symbolt &thunk_func_symb, struct_typet &type, const struct_typet::componentt &comp, const irep_idt &virtual_name)
void set_thunk_name (symbolt &thunk_func_symb, const std::string &base_class_id)
void setup_vtable_struct_variables (const clang::CXXRecordDecl &cxxrd, const struct_typet &type)
void build_vtable_map (const struct_typet &struct_type, switch_table &vtable_value_map)
void add_vtable_variable_symbols (const clang::CXXRecordDecl &cxxrd, const struct_typet &struct_type, const switch_table &vtable_value_map)
bool build_dynamic_cast (const clang::CXXDynamicCastExpr &cast, exprt &new_expr)
void pre_register_inherited_vtables (const clang::CXXRecordDecl &cxxrd)
bool perform_virtual_dispatch (const clang::MemberExpr &member) override
bool is_md_virtual_or_overriding (const clang::CXXMethodDecl &cxxmd)
bool is_fd_virtual_or_overriding (const clang::FunctionDecl &fd) override
bool get_vft_binding_expr (const clang::MemberExpr &member, exprt &new_expr) override
bool get_vft_binding_expr_base (const clang::MemberExpr &member, exprt &new_expr)
void get_vft_binding_expr_vtable_ptr (const clang::CXXMethodDecl &md, exprt &new_expr, const exprt &base_deref)
bool get_vft_binding_expr_function (const clang::CXXMethodDecl &md, exprt &new_expr, const exprt &vtable_ptr_deref)
bool get_virtual_member_function_pointer (const clang::CXXMethodDecl &md, exprt &new_expr)
bool get_unary_operator_expr (const clang::UnaryOperator &uniop, exprt &new_expr) override
bool is_aggregate_type (const clang::QualType &q_type) override
bool is_CopyOrMoveOperator (const clang::CXXMethodDecl &md)
bool is_ConstructorOrDestructor (const clang::CXXMethodDecl &md)
void make_temporary (exprt &expr)
bool get_conditional_class_prvalue (const clang::ConditionalOperator &ternary, exprt &new_expr, bool &elided)
bool get_new_storage (const clang::CXXNewExpr &ne, exprt &new_expr)
bool get_dealloc_function (const clang::CXXDeleteExpr &de, exprt &new_expr)
bool get_align_val (const clang::QualType &type, const clang::ParmVarDecl &param, exprt &align)
bool get_placement_new (const clang::CXXNewExpr &ne, const typet &t, const locationt &location, exprt &new_expr)
bool get_member_expr (const clang::MemberExpr &memb, exprt &new_expr) override
Protected Member Functions inherited from clang_c_convertert
bool snapshot_vla_sizes (const clang::Decl &decl, codet &dest)
bool get_vla_size (const clang::Expr &size, exprt &new_expr)
void collect_address_taken_labels (const clang::Stmt &body)
bool convert_builtin_types ()
virtual bool convert_top_level_decl ()
bool get_function_param (const clang::ParmVarDecl &pd, exprt &param)
 Parse each individual parameter of the function.
void get_ref_to_struct_type (typet &type)
bool get_builtin_type (const clang::BuiltinType &bt, typet &new_type)
bool get_bitfield_type (const clang::FieldDecl &, const typet &orig_type, typet &new_type)
bool wrap_bitfield_type_if_needed (const clang::FieldDecl &fd, typet &t)
void size_flexible_array_member (const clang::ValueDecl &vd, typet &t)
bool get_base_flattened_inits (const clang::InitListExpr &init, std::vector< exprt > &flat)
bool get_array_filler (const clang::InitListExpr &init, exprt &filler)
bool get_enum_value (const clang::EnumConstantDecl *e, exprt &new_expr)
bool get_binary_operator_expr (const clang::BinaryOperator &binop, exprt &new_expr)
void get_vector_comparison (const clang::BinaryOperator &binop, irep_idt relation, exprt lhs, exprt rhs, const typet &type, exprt &new_expr)
bool get_compound_assign_expr (const clang::CompoundAssignOperator &compop, exprt &new_expr)
bool get_atomic_expr (const clang::AtomicExpr &atm, exprt &new_expr)
bool get_cast_expr (const clang::CastExpr &cast, exprt &new_expr)
void get_default_symbol (symbolt &symbol, irep_idt module_name, typet type, irep_idt base_name, irep_idt unique_name, locationt location)
void get_start_location_from_stmt (const clang::Stmt &stmt, locationt &location)
bool report_unsupported_init_list (const clang::InitListExpr &init_stmt)
 Report an initializer list none of get_expr's arms models, with its type and source location. Always returns true (conversion failed).
void get_final_location_from_stmt (const clang::Stmt &stmt, locationt &location)
void get_location_from_decl (const clang::Decl &decl, locationt &location)
void set_location (clang::PresumedLoc &PLoc, std::string &function_name, locationt &location)
void get_presumed_location (const clang::SourceLocation &loc, clang::PresumedLoc &PLoc)
std::string get_filename_from_path (std::string path)
std::string get_modulename_from_path (std::string path)
void convert_expression_to_code (exprt &expr)
bool convert_character_literal (const clang::CharacterLiteral &char_literal, exprt &dest)
bool convert_string_literal (const clang::StringLiteral &string_literal, exprt &dest)
bool convert_integer_literal (const clang::IntegerLiteral &integer_literal, exprt &dest)
bool convert_float_literal (const clang::FloatingLiteral &floating_literal, exprt &dest)
const clang::Decl * get_DeclContext_from_Stmt (const clang::Stmt &stmt)
const clang::Decl * get_top_FunctionDecl_from_Stmt (const clang::Stmt &stmt)
bool process_aligned_attribute (const clang::AlignedAttr &aattr, typet &t) const
bool process_record_layout_attributes (const clang::RecordDecl &rd, typet &t) const
bool check_alignment_attributes (const clang::FieldDecl *field, struct_typet::componentt &comp)
bool is_field_global_storage (const clang::FieldDecl *field)
bool get_mangled_id (const clang::NamedDecl &nd, std::string &id)
 The USR generator gives up on some C++20 declarations: a specialisation over a class-type template argument, its members and parameters, and the template parameter object that argument names.
bool add_template_param_object (const clang::TemplateParamObjectDecl &tpo, const std::string &name, const std::string &id)
bool get_APValue_expr (const clang::APValue &value, exprt &new_expr, const clang::QualType *type=nullptr)
bool is_member_decl_static (const clang::MemberExpr &member)
void rewrite_builtin_ref (const clang::Decl &d, std::string &name, std::string &id) const
 Rewrites references to builtin functions to their ESBMC counterparts.
bool is_unlowered_math_builtin (const std::string &name) const
 __builtin_copysign and the other __builtin_ spellings of a <math.h> function have no body; the plain name has an operational model.

Static Protected Member Functions

static irep_idt rtti_name_component_id (const irep_idt &vtable_type_id)
static struct_typet::componentt rtti_name_component (const irep_idt &vtable_type_id)

Protected Attributes

this_mapt this_map
cap_mapt cap_map
std::string constref_suffix = "ref"
std::optional< bool > uses_exceptions
std::string vtable_type_prefix = "virtual_table::"
std::string vtable_ptr_suffix = "@vtable_pointer"
bool has_vptr_component = false
std::string thunk_prefix = "thunk::"
std::string vcall_prefix = "virtual_call::"
std::map< irep_idt, std::unordered_set< const clang::CXXRecordDecl * > > vtable_classes_per_vptr_
Protected Attributes inherited from clang_c_convertert
clang::ASTContext * ASTContext
contextt & context
namespacet ns
std::unique_ptr< clang::ASTUnit > & AST
irep_idt mode
symbol_generator anon_symbol
locationt last_loc
unsigned last_loc_line = 0
unsigned last_loc_column = 0
std::string last_loc_filename
std::string last_loc_function
bool last_loc_valid = false
std::string tag_prefix = "tag-"
unsigned int current_scope_var_num
code_blockt * current_block
 During get_expr(), which also transforms blocks/scopes, this represents the latest opened blocks from the top-level.
std::unordered_map< const clang::Expr *, exprt > vla_size_snapshots
 A block-scope VLA's size, bound to a local just before its declarator (C11 6.7.6.2p5, 6.7.8p3).
clang::SourceManager * sm
const clang::FunctionDecl * current_functionDecl
std::vector< const clang::LabelDecl * > address_taken_labels
 Address-taken labels of the function being converted, in the order the addresses appear.

Additional Inherited Members

Static Public Member Functions inherited from clang_c_convertert
static void gen_typecast_to_union (const namespacet &ns, exprt &dest, const typet &type)
 Perform the typecast by creating a tmp variable on RHS.
static std::string get_decl_name (const clang::NamedDecl &nd)

Member Typedef Documentation

◆ base_map

Initial value:
std::vector<std::pair<std::string, const clang::CXXRecordDecl *>>

◆ cap_mapt

typedef std:: unordered_map<std::size_t, std::pair<field_mapt, clang::FieldDecl *> > clang_cpp_convertert::cap_mapt
protected

◆ field_mapt

typedef llvm::DenseMap<const CAPTURE_VARIABLE_TYPE *, clang::FieldDecl *> clang_cpp_convertert::field_mapt
protected

◆ function_switch

◆ overriden_map

using clang_cpp_convertert::overriden_map = std::map<std::string, const clang::CXXMethodDecl &>
protected

◆ switch_table

◆ this_mapt

typedef std::unordered_map<std::size_t, std::pair<std::string, typet> > clang_cpp_convertert::this_mapt
protected

Constructor & Destructor Documentation

◆ clang_cpp_convertert()

clang_cpp_convertert::clang_cpp_convertert ( contextt & _context,
std::unique_ptr< clang::ASTUnit > & _AST,
irep_idt _mode )

◆ ~clang_cpp_convertert()

virtual clang_cpp_convertert::~clang_cpp_convertert ( )
virtualdefault

Member Function Documentation

◆ add_thunk_component_to_type()

void clang_cpp_convertert::add_thunk_component_to_type ( const symbolt & thunk_func_symb,
struct_typet & type,
const struct_typet::componentt & comp,
const irep_idt & virtual_name )
protected

◆ add_thunk_method()

void clang_cpp_convertert::add_thunk_method ( const clang::CXXMethodDecl & md,
const struct_typet::componentt & component,
struct_typet & type )
protected

◆ add_thunk_method_arguments()

void clang_cpp_convertert::add_thunk_method_arguments ( symbolt & thunk_func_symb)
protected

◆ add_thunk_method_body()

void clang_cpp_convertert::add_thunk_method_body ( symbolt & thunk_func_symb,
const struct_typet::componentt & component )
protected

◆ add_thunk_method_body_no_return()

void clang_cpp_convertert::add_thunk_method_body_no_return ( symbolt & thunk_func_symb,
const struct_typet::componentt & component,
const exprt & late_cast_this )
protected

◆ add_thunk_method_body_return()

void clang_cpp_convertert::add_thunk_method_body_return ( symbolt & thunk_func_symb,
const struct_typet::componentt & component,
const exprt & late_cast_this )
protected

◆ add_vptr()

void clang_cpp_convertert::add_vptr ( struct_typet & type)
protected

◆ add_vtable_type_entry()

void clang_cpp_convertert::add_vtable_type_entry ( struct_typet & type,
struct_typet::componentt & comp,
symbolt * vtable_type_symbol )
protected

◆ add_vtable_type_symbol()

symbolt * clang_cpp_convertert::add_vtable_type_symbol ( const struct_typet::componentt & comp,
struct_typet & type )
protected

◆ add_vtable_variable_symbols()

void clang_cpp_convertert::add_vtable_variable_symbols ( const clang::CXXRecordDecl & cxxrd,
const struct_typet & struct_type,
const switch_table & vtable_value_map )
protected

◆ annotate_class_field()

bool clang_cpp_convertert::annotate_class_field ( const clang::FieldDecl & field,
const struct_union_typet & type,
struct_typet::componentt & comp )
protected

◆ annotate_class_field_access()

bool clang_cpp_convertert::annotate_class_field_access ( const clang::FieldDecl & field,
struct_typet::componentt & comp )
protected

◆ annotate_class_method()

bool clang_cpp_convertert::annotate_class_method ( const clang::CXXMethodDecl & cxxmdd,
exprt & new_expr )
protected

◆ annotate_ctor_dtor_rtn_type()

void clang_cpp_convertert::annotate_ctor_dtor_rtn_type ( const clang::CXXMethodDecl & cxxmdd,
typet & rtn_type )
protected

◆ annotate_exception_specification()

void clang_cpp_convertert::annotate_exception_specification ( const clang::FunctionDecl & ,
typet &  )
overrideprotectedvirtual

Since this class is inherited by clang-cpp-frontend, some get_* functions are made `virtual' to deal with clang CXX declarations */ virtual bool get_decl(const clang::Decl &decl, exprt &new_expr);.

virtual bool get_var(const clang::VarDecl &vd, exprt &new_expr); virtual const clang::Expr &elided_copy_source(const clang::Expr &init); bool has_dynamic_local_init(const clang::VarDecl &vd) const; void add_init_guard(const symbolt &var); bool get_static_var_init( const clang::VarDecl &vd, symbolt &symbol, const typet &t, const locationt &location_begin, exprt &new_expr);

std::string header_internal_suffix(const clang::NamedDecl &nd); / Internal-linkage functions and variables sharing a USR, in the order they / were first named; see header_internal_suffix. std::unordered_map<std::string, std::vector<const clang::Decl *>> internal_copies;

virtual bool get_function(const clang::FunctionDecl &fd, exprt &new_expr);

bool get_function_signature(const clang::FunctionDecl &fd, code_typet &type);

virtual bool get_function_body( const clang::FunctionDecl &fd, exprt &new_expr, const code_typet &ftype);

/** Annotate a function's type with its C++ exception specification. No-op in C (which has no exception specifications); overridden in the C++ frontend to record noexcept / dynamic-throw specifications as function-boundary metadata on the function type.

Reimplemented from clang_c_convertert.

◆ annotate_implicit_copy_move_ctor_union()

void clang_cpp_convertert::annotate_implicit_copy_move_ctor_union ( const clang::CXXMethodDecl & cxxmdd,
typet & ctor_return_type )
protected

◆ annotate_virtual_overriding_methods()

bool clang_cpp_convertert::annotate_virtual_overriding_methods ( const clang::CXXMethodDecl & md,
struct_typet::componentt & comp )
protected

◆ base_destructor()

code_function_callt clang_cpp_convertert::base_destructor ( const symbolt & sym,
const clang::CXXRecordDecl & base,
const clang::CXXMethodDecl & md )
protected

◆ base_dtor_this()

exprt clang_cpp_convertert::base_dtor_this ( const clang::CXXRecordDecl & base,
const exprt & deref,
const irep_idt & this_id,
const typet & this_ptr_type )
protected

◆ build_destructor_chain()

bool clang_cpp_convertert::build_destructor_chain ( const clang::CXXDestructorDecl & dd,
code_blockt & body )
protected

◆ build_dynamic_cast()

bool clang_cpp_convertert::build_dynamic_cast ( const clang::CXXDynamicCastExpr & cast,
exprt & new_expr )
protected

◆ build_lambda_static_invoker()

bool clang_cpp_convertert::build_lambda_static_invoker ( const clang::CXXMethodDecl & invoker,
exprt & new_expr )
protected

Body for a lambda's static invoker: forward to the closure's operator().

Clang synthesises this in CodeGen, so the AST has none.

◆ build_member_from_component()

void clang_cpp_convertert::build_member_from_component ( const clang::FunctionDecl & fd,
exprt & component )
protected

◆ build_vtable_map()

void clang_cpp_convertert::build_vtable_map ( const struct_typet & struct_type,
switch_table & vtable_value_map )
protected

◆ check_vtable_type_symbol_existence()

symbolt * clang_cpp_convertert::check_vtable_type_symbol_existence ( const struct_typet & type)
protected

◆ destroy_object_on_body_unwind()

bool clang_cpp_convertert::destroy_object_on_body_unwind ( const clang::CXXConstructorDecl & cd,
std::size_t body_start,
code_blockt & body )
protected

◆ elided_copy_source()

const clang::Expr & clang_cpp_convertert::elided_copy_source ( const clang::Expr & init)
overrideprotected

◆ gen_typecast_base_ctor_call()

void clang_cpp_convertert::gen_typecast_base_ctor_call ( const exprt & callee_decl,
side_effect_expr_function_callt & call,
exprt & initializer )
protected

◆ get_access_from_decl()

bool clang_cpp_convertert::get_access_from_decl ( const clang::Decl & decl,
std::string & access )
protected

◆ get_align_val()

bool clang_cpp_convertert::get_align_val ( const clang::QualType & type,
const clang::ParmVarDecl & param,
exprt & align )
protected

◆ get_base_components_methods()

void clang_cpp_convertert::get_base_components_methods ( base_map & map,
struct_union_typet & type,
bool has_virtual_bases,
const clang::CXXRecordDecl & cxxrd )
protected

◆ get_base_map()

bool clang_cpp_convertert::get_base_map ( const clang::CXXRecordDecl & cxxrd,
base_map & map )
protected

◆ get_conditional_class_prvalue()

bool clang_cpp_convertert::get_conditional_class_prvalue ( const clang::ConditionalOperator & ternary,
exprt & new_expr,
bool & elided )
protected

◆ get_constructor_call()

bool clang_cpp_convertert::get_constructor_call ( const clang::CXXConstructExpr & constructor_call,
exprt & new_expr )
protected

Get reference for constructor callsite.

◆ get_ctor_dtor_ref()

bool clang_cpp_convertert::get_ctor_dtor_ref ( const clang::CXXMethodDecl & md,
exprt & new_expr )
protected

◆ get_cxx_constructor_is_complete_param()

bool clang_cpp_convertert::get_cxx_constructor_is_complete_param ( const clang::CXXConstructorDecl & cxxcd,
code_typet::argumentt & param )
protected

◆ get_dealloc_function()

bool clang_cpp_convertert::get_dealloc_function ( const clang::CXXDeleteExpr & de,
exprt & new_expr )
protected

◆ get_decl()

bool clang_cpp_convertert::get_decl ( const clang::Decl & decl,
exprt & new_expr )
overrideprotected

◆ get_decl_name()

void clang_cpp_convertert::get_decl_name ( const clang::NamedDecl & nd,
std::string & name,
std::string & id )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_decl_ref()

bool clang_cpp_convertert::get_decl_ref ( const clang::Decl & decl,
exprt & new_expr )
overrideprotectedvirtual

Get reference to a declared variable or function, e.g:

  • getting the callee for CXXConstructExpr
  • getting the object for DeclRefExpr

References are modeled as pointers in ESBMC. Normally, when getting a reference, we should therefore dereference it. However, when a reference type variable is initialized in a (member initializer) constructor call, we should not dereference it, because the reference/pointer is not yet initialized. See test case "RefMemberInit".

Reimplemented from clang_c_convertert.

◆ get_expr()

bool clang_cpp_convertert::get_expr ( const clang::Stmt & stmt,
exprt & new_expr )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_fd_symbol()

symbolt * clang_cpp_convertert::get_fd_symbol ( const clang::FunctionDecl & fd)
protected

◆ get_function_body()

bool clang_cpp_convertert::get_function_body ( const clang::FunctionDecl & fd,
exprt & new_expr,
const code_typet & ftype )
overrideprotected

◆ get_function_params()

bool clang_cpp_convertert::get_function_params ( const clang::FunctionDecl & fd,
code_typet::argumentst & params )
overrideprotectedvirtual

Get function params for C++ contains conversion routines specific to C++ class member functions.

Reimplemented from clang_c_convertert.

◆ get_function_this_pointer_param()

bool clang_cpp_convertert::get_function_this_pointer_param ( const clang::CXXMethodDecl & fd,
code_typet::argumentst & params )
protected

Add implicit this' when parsing C++ class member functions, e.g: class t1 { int i; t1(){i = 1} }; The implicit this' within the constructor is represented by symbol:

  • t1() symbol.type: void (t1*)
  • t1() symbol.value: { t1->i = 1; }

◆ get_member_expr()

bool clang_cpp_convertert::get_member_expr ( const clang::MemberExpr & memb,
exprt & new_expr )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_member_initializer()

bool clang_cpp_convertert::get_member_initializer ( const clang::Expr & init,
const typet & member_type,
exprt & rhs )
protected

◆ get_method()

bool clang_cpp_convertert::get_method ( const clang::CXXMethodDecl & md,
exprt & new_expr )
protected

◆ get_method_declaration()

bool clang_cpp_convertert::get_method_declaration ( const clang::CXXMethodDecl & md,
const symbolt *& symbol )
protected

◆ get_new_initializer()

bool clang_cpp_convertert::get_new_initializer ( const clang::CXXNewExpr & ne,
exprt & new_expr )
protected

Attach a new-expression's initializer, and for an array its braced list's filler: a run-time element count can reach past the list.

◆ get_new_storage()

bool clang_cpp_convertert::get_new_storage ( const clang::CXXNewExpr & ne,
exprt & new_expr )
protected

◆ get_overriden_methods()

void clang_cpp_convertert::get_overriden_methods ( const clang::CXXMethodDecl & md,
overriden_map & map )
protected

◆ get_placement_new()

bool clang_cpp_convertert::get_placement_new ( const clang::CXXNewExpr & ne,
const typet & t,
const locationt & location,
exprt & new_expr )
protected

◆ get_struct_class_virtual_methods()

bool clang_cpp_convertert::get_struct_class_virtual_methods ( const clang::CXXRecordDecl & cxxrd,
struct_typet & type )
protected

◆ get_struct_union_class()

bool clang_cpp_convertert::get_struct_union_class ( const clang::RecordDecl & rd)
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_struct_union_class_fields()

bool clang_cpp_convertert::get_struct_union_class_fields ( const clang::RecordDecl & rd,
struct_union_typet & type )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_struct_union_class_methods_decls()

bool clang_cpp_convertert::get_struct_union_class_methods_decls ( const clang::RecordDecl & rd,
typet & type )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_template_decl()

template<typename TemplateDecl>
bool clang_cpp_convertert::get_template_decl ( const TemplateDecl & D,
bool DumpExplicitInst,
exprt & new_expr )
protected

◆ get_template_decl_specialization()

template<typename SpecializationDecl>
bool clang_cpp_convertert::get_template_decl_specialization ( const SpecializationDecl * D,
bool DumpExplicitInst,
exprt & new_expr )
protected

◆ get_type() [1/2]

bool clang_cpp_convertert::get_type ( const clang::QualType & type,
typet & new_type )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_type() [2/2]

bool clang_cpp_convertert::get_type ( const clang::Type & the_type,
typet & new_type )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_unary_operator_expr()

bool clang_cpp_convertert::get_unary_operator_expr ( const clang::UnaryOperator & uniop,
exprt & new_expr )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_var()

bool clang_cpp_convertert::get_var ( const clang::VarDecl & vd,
exprt & new_expr )
overrideprotected

◆ get_vft_binding_expr()

bool clang_cpp_convertert::get_vft_binding_expr ( const clang::MemberExpr & member,
exprt & new_expr )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ get_vft_binding_expr_base()

bool clang_cpp_convertert::get_vft_binding_expr_base ( const clang::MemberExpr & member,
exprt & new_expr )
protected

◆ get_vft_binding_expr_function()

bool clang_cpp_convertert::get_vft_binding_expr_function ( const clang::CXXMethodDecl & md,
exprt & new_expr,
const exprt & vtable_ptr_deref )
protected

◆ get_vft_binding_expr_vtable_ptr()

void clang_cpp_convertert::get_vft_binding_expr_vtable_ptr ( const clang::CXXMethodDecl & md,
exprt & new_expr,
const exprt & base_deref )
protected

◆ get_virtual_member_function_pointer()

bool clang_cpp_convertert::get_virtual_member_function_pointer ( const clang::CXXMethodDecl & md,
exprt & new_expr )
protected

◆ insert_constructor_initializers()

bool clang_cpp_convertert::insert_constructor_initializers ( const clang::CXXConstructorDecl & cd,
exprt::operandst & initializers,
std::vector< std::size_t > starts,
const symbolt * array_init_sym,
code_blockt & body )
protected

◆ is_aggregate_type()

bool clang_cpp_convertert::is_aggregate_type ( const clang::QualType & q_type)
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ is_ConstructorOrDestructor()

bool clang_cpp_convertert::is_ConstructorOrDestructor ( const clang::CXXMethodDecl & md)
protected

◆ is_copy_or_move_ctor()

bool clang_cpp_convertert::is_copy_or_move_ctor ( const clang::DeclContext & dcxt)
protected

◆ is_CopyOrMoveOperator()

bool clang_cpp_convertert::is_CopyOrMoveOperator ( const clang::CXXMethodDecl & md)
protected

◆ is_defaulted_ctor()

bool clang_cpp_convertert::is_defaulted_ctor ( const clang::CXXMethodDecl & md)
protected

◆ is_duplicate_component()

bool clang_cpp_convertert::is_duplicate_component ( const struct_typet::componentt & component,
const struct_union_typet & type )
protected

◆ is_duplicate_method()

bool clang_cpp_convertert::is_duplicate_method ( const struct_typet::componentt & method,
const struct_union_typet & type )
protected

◆ is_fd_virtual_or_overriding()

bool clang_cpp_convertert::is_fd_virtual_or_overriding ( const clang::FunctionDecl & fd)
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ is_lambda()

bool clang_cpp_convertert::is_lambda ( ) const
inlineprotected

◆ is_md_virtual_or_overriding()

bool clang_cpp_convertert::is_md_virtual_or_overriding ( const clang::CXXMethodDecl & cxxmd)
protected

◆ make_temporary()

void clang_cpp_convertert::make_temporary ( exprt & expr)
protected

◆ member_destructor()

bool clang_cpp_convertert::member_destructor ( const clang::FieldDecl & field,
const exprt & deref,
code_blockt & calls )
protected

◆ method_this()

const clang_cpp_convertert::this_mapt::mapped_type & clang_cpp_convertert::method_this ( const clang::CXXMethodDecl & md) const
protected

◆ name_param_and_continue()

void clang_cpp_convertert::name_param_and_continue ( const clang::ParmVarDecl & pd,
std::string & id,
std::string & name,
exprt & param )
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ need_new_object()

bool clang_cpp_convertert::need_new_object ( const clang::Stmt * parentStmt,
const clang::CXXConstructExpr & call )
protected

◆ nontrivial_destructor()

const symbolt * clang_cpp_convertert::nontrivial_destructor ( const clang::CXXRecordDecl * rec)
protected

◆ perform_virtual_dispatch()

bool clang_cpp_convertert::perform_virtual_dispatch ( const clang::MemberExpr & member)
overrideprotectedvirtual

Reimplemented from clang_c_convertert.

◆ pre_register_inherited_vtables()

void clang_cpp_convertert::pre_register_inherited_vtables ( const clang::CXXRecordDecl & cxxrd)
protected

◆ rethrowing_catch()

codet clang_cpp_convertert::rethrowing_catch ( const code_blockt & tried,
code_blockt handler )
protected

◆ rtti_name_component()

struct_typet::componentt clang_cpp_convertert::rtti_name_component ( const irep_idt & vtable_type_id)
staticprotected

◆ rtti_name_component_id()

irep_idt clang_cpp_convertert::rtti_name_component_id ( const irep_idt & vtable_type_id)
staticprotected

◆ rtti_type_name() [1/2]

std::string clang_cpp_convertert::rtti_type_name ( const clang::CXXRecordDecl & rd)
protected

◆ rtti_type_name() [2/2]

std::string clang_cpp_convertert::rtti_type_name ( const clang::QualType & qtype)
protected

◆ set_thunk_name()

void clang_cpp_convertert::set_thunk_name ( symbolt & thunk_func_symb,
const std::string & base_class_id )
protected

◆ setup_vtable_struct_variables()

void clang_cpp_convertert::setup_vtable_struct_variables ( const clang::CXXRecordDecl & cxxrd,
const struct_typet & type )
protected

◆ subobject_destructors()

bool clang_cpp_convertert::subobject_destructors ( const clang::CXXMethodDecl & md,
std::vector< subobject_destructort > & out )
protected

◆ typeid_object()

exprt clang_cpp_convertert::typeid_object ( const exprt & value,
const std::string & type_name,
const clang::Stmt & stmt,
bool dynamic )
protected

The object a typeid expression refers to, which has static storage duration ([expr.typeid]/1): one per type name.

A polymorphic operand's dynamic type is only known when it is evaluated, so its site gets its own object, assigned there.

◆ unwind_constructed_subobjects()

bool clang_cpp_convertert::unwind_constructed_subobjects ( const clang::CXXConstructorDecl & cd,
const std::vector< std::size_t > & starts,
code_blockt & body )
protected

◆ update_thunk_this_type()

void clang_cpp_convertert::update_thunk_this_type ( typet & thunk_symbol_type,
const std::string & base_class_id )
protected

◆ user_code_uses_exceptions()

bool clang_cpp_convertert::user_code_uses_exceptions ( )
protected

Member Data Documentation

◆ cap_map

cap_mapt clang_cpp_convertert::cap_map
protected

◆ constref_suffix

std::string clang_cpp_convertert::constref_suffix = "ref"
protected

◆ has_vptr_component

bool clang_cpp_convertert::has_vptr_component = false
protected

◆ this_map

this_mapt clang_cpp_convertert::this_map
protected

◆ thunk_prefix

std::string clang_cpp_convertert::thunk_prefix = "thunk::"
protected

◆ uses_exceptions

std::optional<bool> clang_cpp_convertert::uses_exceptions
protected

◆ vcall_prefix

std::string clang_cpp_convertert::vcall_prefix = "virtual_call::"
protected

◆ vtable_classes_per_vptr_

std::map<irep_idt, std::unordered_set<const clang::CXXRecordDecl *> > clang_cpp_convertert::vtable_classes_per_vptr_
protected

◆ vtable_ptr_suffix

std::string clang_cpp_convertert::vtable_ptr_suffix = "@vtable_pointer"
protected

◆ vtable_type_prefix

std::string clang_cpp_convertert::vtable_type_prefix = "virtual_table::"
protected

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