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)
93 typet &class_object=
static_cast<typet &
>(type.
add(
"to-member"));
95 if(class_object.
id()==ID_cpp_name)
97 assert(class_object.
get_sub().back().id()==
"::");
98 class_object.
get_sub().pop_back();
108 if(parameters.empty() ||
109 parameters.front().get(ID_C_base_name)!=ID_this)
112 exprt a0(ID_parameter);
113 a0.
set(ID_C_base_name, ID_this);
115 parameters.insert(parameters.begin(), a0);
123 qualifiers.
write(type);
125 else if(type.
id()==ID_array)
138 type.
set(ID_C_constant,
true);
141 type.
set(ID_C_volatile,
true);
143 else if(type.
id()==ID_vector)
147 else if(type.
id()==ID_code)
154 for(
auto ¶m : parameters)
159 if(param.has_default_value())
166 else if(type.
id()==ID_template)
170 else if(type.
id()==ID_c_enum)
174 else if(type.
id()==ID_c_enum_tag)
177 else if(type.
id()==ID_c_bit_field)
181 else if(type.
id()==ID_unsignedbv ||
182 type.
id()==ID_signedbv ||
183 type.
id()==ID_bool ||
184 type.
id()==ID_floatbv ||
185 type.
id()==ID_fixedbv ||
189 else if(type.
id()==ID_symbol)
192 else if(type.
id()==ID_constructor ||
193 type.
id()==ID_destructor)
196 else if(type.
id()==
"cpp-cast-operator")
199 else if(type.
id()==
"cpp-template-type")
202 else if(type.
id()==ID_typeof)
209 static_cast<const typet &
>(type.
find(ID_type_arg));
211 if(tmp_type.
id()==ID_cpp_name)
223 type=symbol_expr.
type();
237 else if(type.
id()==ID_decltype)
242 if(e.
type().
id() == ID_c_bit_field)
247 else if(type.
id()==ID_unassigned)
251 else if(type.
id()==ID_template_class_instance)
255 else if(type.
id()==ID_block_pointer)
260 type.
id(ID_frontend_pointer);
263 else if(type.
id()==ID_nullptr)
266 else if(type.
id()==ID_already_typechecked)
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
const code_typet & to_code_type(const typet &type)
Cast a generic typet to a code_typet.
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)
void typecheck_enum_type(typet &type)
const irep_idt & id() const
source_locationt source_location
const vector_typet & to_vector_type(const typet &type)
Cast a generic typet to a vector_typet.
const exprt & size() const
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
virtual void typecheck_vector_type(vector_typet &type)
const array_typet & to_array_type(const typet &type)
Cast a generic typet to an array_typet.
Base class for all expressions.
const parameterst & parameters() const
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a generic typet to a struct_union_typet.
irept & add(const irep_namet &name)
void cpp_convert_plain_type(typet &type)
void typecheck_compound_type(struct_union_typet &type)
virtual void write(typet &src) const override
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a generic typet to a c_bit_field_typet.
virtual void typecheck_type(typet &type)
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)