25 return expr2c(expr, *
this);
30 return type2c(type, *
this);
41 error() <<
"failed to move symbol '" << symbol.
name <<
"' into symbol table"
77 warning() <<
"`extern' symbol should not have an initializer" <<
eom;
83 error() <<
"only functions can have a function body" <<
eom;
108 error() <<
"void-typed symbol not permitted" <<
eom;
113 symbol_tablet::symbolst::const_iterator
old_it=
130 <<
"' as a different kind of symbol" <<
eom;
205 error() <<
"conflicting definition of type symbol '"
229 error() <<
"conflicting definition of tag symbol '"
256 <<
"' defined twice:\n"
308 error() <<
"function type not allowed for K&R function parameter"
324 <<
"' redefined with a different type:\n"
337 else if(!
old_ct.has_ellipsis() &&
new_ct.has_ellipsis())
371 symbol_tablet::symbolst::const_iterator
p_s_it=
381 <<
"' defined twice" <<
eom;
453 <<
"' redefined with a different type:\n"
480 <<
"' already has an initial value" <<
eom;
507 error() <<
"function '" << symbol.
name <<
"' is initialized with "
524 unsigned anon_counter=0;
530 if(p.get_base_name().empty())
532 irep_idt base_name=
"#anon"+std::to_string(anon_counter++);
533 p.set_base_name(base_name);
537 irep_idt base_name = p.get_base_name();
540 p.set_identifier(identifier);
547 p_symbol.location = p.source_location();
562 error() <<
"branching label '" << label.first
563 <<
"' is not defined in function" <<
eom;
578 if(!asm_label.
empty() &&
582 symbol.
name=asm_label;
589 std::make_pair(
orig_name, asm_label)).second)
594 error() <<
"error: replacing asm renaming "
601 else if(asm_label.
empty())
603 asm_label_mapt::const_iterator entry=
607 symbol.
name=entry->second;
618 for(
const auto &p :
code_type.parameters())
682 error() <<
"alias attribute cannot be used with a body"
724 declarator.set_name(identifier);
737 for(
auto &
requires :
code_type.requires())
ANSI-CC Language Type Checking.
const T & as_const(T &value)
Return a reference to the same object but ensures the type is const.
void base_type(typet &type, const namespacet &ns)
ANSI-C Language Type Checking.
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const code_with_contract_typet & to_code_with_contract_type(const typet &type)
Cast a typet to a code_with_contract_typet.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
static void make_already_typechecked(typet &type)
void typecheck_function_body(symbolt &symbol)
std::map< irep_idt, source_locationt > labels_used
virtual void typecheck_expr(exprt &expr)
virtual void do_initializer(exprt &initializer, const typet &type, bool force_constant)
virtual void typecheck_code(codet &code)
void move_symbol(symbolt &symbol, symbolt *&new_symbol)
void disallow_subexpr_by_id(const exprt &, const irep_idt &, const std::string &) const
void apply_asm_label(const irep_idt &asm_label, symbolt &symbol)
symbol_tablet & symbol_table
virtual std::string to_string(const exprt &expr)
void typecheck_declaration(ansi_c_declarationt &)
void typecheck_new_symbol(symbolt &symbol)
asm_label_mapt asm_label_map
virtual void adjust_function_parameter(typet &type) const
void typecheck_redefinition_type(symbolt &old_symbol, symbolt &new_symbol)
void typecheck_redefinition_non_type(symbolt &old_symbol, symbolt &new_symbol)
const irep_idt const irep_idt mode
virtual void typecheck_spec_assigns(exprt::operandst &targets)
id_type_mapt parameter_map
virtual void implicit_typecast_bool(exprt &expr)
virtual void typecheck_type(typet &type)
void typecheck_symbol(symbolt &symbol)
std::map< irep_idt, source_locationt > labels_defined
const parameterst & parameters() const
Data structure for representing an arbitrary statement in a program.
struct configt::ansi_ct ansi_c
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
bool is_constant() const
Return whether the expression is a constant.
typet & type()
Return the type of the expression.
source_locationt & add_source_location()
const irep_idt & get(const irep_idt &name) const
const irep_idt & id() const
source_locationt source_location
mstreamt & warning() const
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
Symbol table entry of function parameterThis is a symbol generated as part of type checking.
static symbol_exprt typeless(const irep_idt &id)
Generate a symbol_exprt without a proper type.
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
virtual bool move(symbolt &symbol, symbolt *&new_symbol) override
Move a symbol into the symbol table.
source_locationt location
Source code location of definition of symbol.
typet type
Type of symbol.
irep_idt name
The unique identifier.
irep_idt pretty_name
Language-specific display name.
irep_idt irep_idt base_name
Name of module the symbol belongs to.
const irep_idt & display_name() const
Return language specific display name if present.
exprt value
Initial value of symbol.
irep_idt mode
Language mode.
The type of an expression, extends irept.
std::string expr2c(const exprt &expr, const namespacet &ns, const expr2c_configurationt &configuration)
std::string type2c(const typet &type, const namespacet &ns, const expr2c_configurationt &configuration)
Deprecated expression utility functions.
const std::string & id2string(const irep_idt &d)
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const codet & to_code(const exprt &expr)
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.