34 for(
const auto &expr : arguments)
42 expr.id() !=
ID_ambiguous,
"template argument must not be ambiguous");
46 const typet &type=expr.type();
77 error() <<
"template argument expression expected to be "
78 <<
"scalar constant, but got '" <<
to_string(e) <<
"'" <<
eom;
96 out <<
"instantiating '" << symbol.
pretty_name <<
"' with <";
100 if(
a_it != e.full_template_args.arguments().begin())
109 out <<
"> at " << e.source_location <<
'\n';
116 const std::string &suffix)
156 if(full_template_args.
arguments().empty())
160 <<
"' is a template; thus, expected template arguments" <<
eom;
178 symbol_table_baset::symbolst::const_iterator
s_it =
210 id.class_identifier=
s_ptr->name;
260 error() <<
"reached maximum template recursion depth ("
271 std::cout <<
"L: " << source_location <<
'\n';
282 "should never get 'unassigned' here");
284 !full_template_args.
has_unassigned(),
"should never get 'unassigned' here");
297 std::cout <<
">\n\n";
301 if(full_template_args.
arguments().empty())
305 <<
"' is a template; thus, expected template arguments" <<
eom;
320 <<
"template instantiation error: scope not found" <<
eom;
371 "id must be class or symbol");
379 else if(
symb.value.is_not_nil())
396 std::cout <<
"CLASS MAP:\n";
438 static_cast<const irept &
>(
tm));
454 std::cout <<
"METHOD MAP:\n";
473 std::cout <<
"instance symbol: " <<
new_symb.name <<
"\n\n";
474 std::cout <<
"template type: " << template_type.
pretty() <<
"\n\n";
486 if(
new_decl.member_spec().is_virtual())
489 error() <<
"invalid use of `virtual' in template declaration"
497 error() <<
"template declaration for typedef" <<
eom;
501 if(
new_decl.storage_spec().is_extern() ||
502 new_decl.storage_spec().is_auto() ||
503 new_decl.storage_spec().is_register() ||
504 new_decl.storage_spec().is_mutable())
507 error() <<
"invalid storage class specified for template field"
512 bool is_static=
new_decl.storage_spec().is_static();
Generic exception types primarily designed for use with invariants.
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
symbol_table_baset & symbol_table
virtual void make_constant(exprt &expr)
cpp_idt & put_into_scope(const symbolt &symbol, cpp_scopet &scope, bool is_friend=false)
cpp_scopet & current_scope()
cpp_scopet & get_parent() const
std::set< cpp_idt * > id_sett
exprt::operandst argumentst
bool has_unassigned() const
std::string template_suffix(const cpp_template_args_tct &template_args)
instantiation_stackt instantiation_stack
template_mapt template_map
void typecheck_compound_declarator(const symbolt &symbol, const cpp_declarationt &declaration, cpp_declaratort &declarator, struct_typet::componentst &components, const irep_idt &access, bool is_static, bool is_typedef, bool is_mutable)
void convert_non_template_declaration(cpp_declarationt &declaration)
bool cpp_is_pod(const typet &type) const
void show_instantiation_stack(std::ostream &)
void convert(cpp_linkage_spect &)
cpp_scopet & sub_scope_for_instantiation(cpp_scopet &template_scope, const std::string &suffix)
Set up a scope as subscope of the template scope.
void elaborate_class_template(const typet &type)
elaborate class template instances
cpp_scopet & typecheck_template_parameters(template_typet &type)
std::string to_string(const typet &) override
const symbolt & instantiate_template(const source_locationt &source_location, const symbolt &symbol, const cpp_template_args_tct &specialization_template_args, const cpp_template_args_tct &full_template_args, const typet &specialization=uninitialized_typet{})
const symbolt & class_template_symbol(const source_locationt &source_location, const symbolt &template_symbol, const cpp_template_args_tct &specialization_template_args, const cpp_template_args_tct &full_template_args)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
bool is_true() const
Return whether the expression is a constant representing true.
bool is_false() const
Return whether the expression is a constant representing false.
There are a large number of kinds of tree structured or tree-like data in CPROVER.
bool get_bool(const irep_idt &name) const
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const irep_idt & id() const
irept & add(const irep_idt &name)
source_locationt source_location
mstreamt & result() const
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
Structure type, corresponds to C style structs.
Expression to hold a symbol (variable)
const irep_idt & get_identifier() const
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
virtual bool move(symbolt &symbol, symbolt *&new_symbol)=0
const symbolst & symbols
Read-only field, used to look up symbols given their names.
typet type
Type of symbol.
irep_idt pretty_name
Language-specific display name.
exprt value
Initial value of symbol.
void build(const template_typet &template_type, const cpp_template_args_tct &template_args)
void print(std::ostream &out) const
void apply(exprt &dest) const
Symbol table entry describing a data typeThis is a symbol generated as part of type checking.
The type of an expression, extends irept.
const source_locationt & source_location() const
cpp_declarationt & to_cpp_declaration(irept &irep)
std::string cpp_type2name(const typet &type)
C++ Language Type Checking.
#define forall_expr(it, expr)
const std::string & id2string(const irep_idt &d)
const std::string integer2string(const mp_integer &n, unsigned base)
#define INVARIANT_STRUCTURED(CONDITION, TYPENAME,...)
#define CHECK_RETURN(CONDITION)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
const tag_typet & to_tag_type(const typet &type)
Cast a typet to a tag_typet.