33 catch(
const char *err)
40 catch(
const std::string &err)
47 if(type.
id()==ID_cpp_name)
59 if(symbol_expr.
id()!=ID_type)
62 error() <<
"error: expected type" <<
eom;
66 type=symbol_expr.
type();
72 qualifiers.
write(type);
74 else if(type.
id()==ID_struct ||
79 else if(type.
id()==ID_pointer)
90 typet &class_object=
static_cast<typet &
>(type.
add(
"to-member"));
92 if(class_object.
id()==ID_cpp_name)
94 assert(class_object.
get_sub().back().id()==
"::");
95 class_object.
get_sub().pop_back();
105 if(parameters.empty() ||
106 parameters.front().get(ID_C_base_name)!=ID_this)
109 exprt a0(ID_parameter);
110 a0.
set(ID_C_base_name, ID_this);
112 parameters.insert(parameters.begin(), a0);
117 else if(type.
id()==ID_array)
130 type.
set(ID_C_constant,
true);
133 type.
set(ID_C_volatile,
true);
135 else if(type.
id()==ID_code)
142 for(
auto ¶m : parameters)
147 if(param.has_default_value())
154 else if(type.
id()==ID_template)
158 else if(type.
id()==ID_c_enum)
162 else if(type.
id()==ID_c_enum_tag)
165 else if(type.
id()==ID_c_bit_field)
169 else if(type.
id()==ID_unsignedbv ||
170 type.
id()==ID_signedbv ||
171 type.
id()==ID_bool ||
172 type.
id()==ID_floatbv ||
173 type.
id()==ID_fixedbv ||
177 else if(type.
id()==ID_symbol)
180 else if(type.
id()==ID_constructor ||
181 type.
id()==ID_destructor)
184 else if(type.
id()==
"cpp-cast-operator")
187 else if(type.
id()==
"cpp-template-type")
190 else if(type.
id()==ID_typeof)
197 static_cast<const typet &
>(type.
find(ID_type_arg));
199 if(tmp_type.
id()==ID_cpp_name)
211 type=symbol_expr.
type();
225 else if(type.
id()==ID_decltype)
231 else if(type.
id()==ID_unassigned)
235 else if(type.
id()==ID_template_class_instance)
239 else if(type.
id()==ID_block_pointer)
244 else if(type.
id()==ID_nullptr)
The type of an expression.
void typecheck_type(typet &type)
pointer_typet pointer_type(const typet &subtype)
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
std::vector< irept > subt
cpp_namet & to_cpp_name(irept &cpp_name)
std::vector< parametert > parameterst
virtual void implicit_typecast(exprt &expr, const typet &type)
static mstreamt & eom(mstreamt &m)
bool get_bool(const irep_namet &name) const
virtual void typecheck_expr(exprt &expr)
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a generic typet to a struct_union_typet.
void typecheck_enum_type(typet &type)
const irep_idt & id() const
const array_typet & to_array_type(const typet &type)
Cast a generic typet to an array_typet.
source_locationt source_location
void write(typet &src) const
const exprt & size() const
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a generic typet to a c_bit_field_typet.
C++ Language Type Checking.
exprt resolve(const cpp_namet &cpp_name, const cpp_typecheck_resolvet::wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true)
const source_locationt & source_location() const
Base class for all expressions.
const parameterst & parameters() const
irept & add(const irep_namet &name)
void cpp_convert_plain_type(typet &type)
void typecheck_compound_type(struct_union_typet &type)
const code_typet & to_code_type(const typet &type)
Cast a generic typet to a code_typet.
const typet & subtype() const
virtual void typecheck_c_bit_field_type(c_bit_field_typet &type)
const irept & find(const irep_namet &name) const
const typet & return_type() const
void set(const irep_namet &name, const irep_idt &value)
bool simplify(exprt &expr, const namespacet &ns)