cprover
cpp_typecheck.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C++ Language Type Checking
4 
5 Author: Daniel Kroening, kroening@cs.cmu.edu
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_CPP_CPP_TYPECHECK_H
13 #define CPROVER_CPP_CPP_TYPECHECK_H
14 
15 #include <cassert>
16 #include <set>
17 #include <list>
18 #include <map>
19 
20 #include <util/std_code.h>
21 #include <util/std_types.h>
22 
24 
25 #include "cpp_parse_tree.h"
26 #include "cpp_scopes.h"
27 #include "cpp_typecheck_resolve.h"
28 #include "template_map.h"
29 #include "cpp_member_spec.h"
30 #include "cpp_template_type.h"
31 #include "cpp_util.h"
32 
33 bool cpp_typecheck(
34  cpp_parse_treet &cpp_parse_tree,
35  symbol_tablet &symbol_table,
36  const std::string &module,
38 
39 bool cpp_typecheck(
40  exprt &expr,
42  const namespacet &ns);
43 
45 {
46 public:
48  cpp_parse_treet &_cpp_parse_tree,
49  symbol_tablet &_symbol_table,
50  const std::string &_module,
52  c_typecheck_baset(_symbol_table, _module, message_handler),
53  cpp_parse_tree(_cpp_parse_tree),
55  anon_counter(0),
57  {
58  }
59 
61  cpp_parse_treet &_cpp_parse_tree,
62  symbol_tablet &_symbol_table1,
63  const symbol_tablet &_symbol_table2,
64  const std::string &_module,
66  c_typecheck_baset(_symbol_table1, _symbol_table2,
67  _module, message_handler),
68  cpp_parse_tree(_cpp_parse_tree),
70  anon_counter(0),
72  {
73  }
74 
75  virtual ~cpp_typecheckt() { }
76 
77  virtual void typecheck();
78 
79  // overload to use C++ syntax
80 
81  virtual std::string to_string(const typet &type);
82  virtual std::string to_string(const exprt &expr);
83 
84  friend class cpp_typecheck_resolvet;
86 
88  const cpp_namet &cpp_name,
90  const cpp_typecheck_fargst &fargs,
91  bool fail_with_exception=true)
92  {
93  cpp_typecheck_resolvet cpp_typecheck_resolve(*this);
94  return cpp_typecheck_resolve.resolve(
95  cpp_name, want, fargs, fail_with_exception);
96  }
97 
98  virtual void typecheck_expr(exprt &expr);
99 
100  bool cpp_is_pod(const typet &type) const;
101 
103  const source_locationt &source_location,
104  const exprt &object,
105  const exprt::operandst &operands);
106 
107 protected:
109 
112 
113  void convert(cpp_linkage_spect &);
115  void convert(cpp_usingt &);
116  void convert(cpp_itemt &);
117  void convert(cpp_declarationt &);
118  void convert(cpp_declaratort &);
119  void convert(cpp_static_assertt &);
120 
121  void convert_initializer(symbolt &symbol);
122  void convert_function(symbolt &symbol);
123 
124  void convert_pmop(exprt &expr);
125 
127  cpp_declarationt &declaration,
128  codet &new_code);
129 
131  const cpp_declarationt &declaration,
132  const irep_idt &access,
133  struct_typet::componentst &components);
134 
135  //
136  // Templates
137  //
139  const template_typet &old_type,
140  template_typet &new_type);
141 
143 
145 
147  cpp_declarationt &declaration);
148 
150  cpp_declarationt &declaration);
151 
152  void typecheck_class_template(cpp_declarationt &declaration);
153 
155 
157 
158  std::string class_template_identifier(
159  const irep_idt &base_name,
160  const template_typet &template_type,
161  const cpp_template_args_non_tct &partial_specialization_args);
162 
163  std::string function_template_identifier(
164  const irep_idt &base_name,
165  const template_typet &template_type,
166  const typet &function_type);
167 
169  const source_locationt &source_location,
170  const symbolt &template_symbol,
171  const cpp_template_args_non_tct &template_args);
172 
173  // template instantiations
175  {
176  public:
180  };
181 
182  typedef std::list<instantiationt> instantiation_stackt;
184 
185  void show_instantiation_stack(std::ostream &);
186 
188  {
189  public:
191  instantiation_stackt &_instantiation_stack):
192  instantiation_stack(_instantiation_stack)
193  {
194  instantiation_stack.push_back(instantiationt());
195  }
196 
198  {
199  instantiation_stack.pop_back();
200  }
201 
202  private:
204  };
205 
207  const source_locationt &source_location,
208  const symbolt &template_symbol,
209  const cpp_template_args_tct &specialization_template_args,
210  const cpp_template_args_tct &full_template_args);
211 
213  const typet &type);
214 
216  const source_locationt &source_location,
217  const symbolt &symbol,
218  const cpp_template_args_tct &specialization_template_args,
219  const cpp_template_args_tct &full_template_args,
220  const typet &specialization=typet(ID_nil));
221 
223  const source_locationt &source_location,
224  const symbol_typet &type);
225 
227  unsigned anon_counter;
228 
230 
231  std::string template_suffix(
232  const cpp_template_args_tct &template_args);
233 
234  void convert_parameters(
235  const irep_idt &mode,
236  code_typet &function_type);
237 
238  void convert_parameter(
239  const irep_idt &mode,
240  code_typet::parametert &parameter);
241 
242  //
243  // Misc
244  //
245 
246  void default_ctor(
247  const source_locationt &source_location,
248  const irep_idt &base_name,
249  cpp_declarationt &ctor) const;
250 
251  void default_cpctor(
252  const symbolt&, cpp_declarationt &cpctor) const;
253 
254  void default_assignop(
255  const symbolt &symbol, cpp_declarationt &cpctor);
256 
258  const symbolt &symbol, cpp_declaratort &declarator);
259 
260  void default_dtor(const symbolt &symb, cpp_declarationt &dtor);
261 
262  codet dtor(const symbolt &symb);
263 
265  const irept &bases,
266  const struct_typet::componentst &components,
267  const irept &initializers);
268 
270  const struct_union_typet::componentt &component,
271  const struct_union_typet &struct_union_type);
272 
274  const struct_union_typet &struct_union_type,
275  irept &initializers);
276 
277  bool find_cpctor(const symbolt &symbol)const;
278  bool find_assignop(const symbolt &symbol)const;
279  bool find_dtor(const symbolt &symbol)const;
280 
281  bool find_parent(
282  const symbolt &symb,
283  const irep_idt &base_name,
284  irep_idt &identifier);
285 
286  bool get_component(
287  const source_locationt &source_location,
288  const exprt &object,
289  const irep_idt &component_name,
290  exprt &member);
291 
292  void new_temporary(const source_locationt &source_location,
293  const typet &,
294  const exprt::operandst &ops,
295  exprt &temporary);
296 
297  void new_temporary(const source_locationt &source_location,
298  const typet &,
299  const exprt &op,
300  exprt &temporary);
301 
303  void do_not_typechecked();
304  void clean_up();
305 
306  void add_base_components(
307  const struct_typet &from,
308  const irep_idt &access,
309  struct_typet &to,
310  std::set<irep_idt> &bases,
311  std::set<irep_idt> &vbases,
312  bool is_virtual);
313 
314  bool cast_away_constness(const typet &t1,
315  const typet &t2) const;
316 
317  void do_virtual_table(const symbolt &symbol);
318 
319  // we need to be able to delay the typechecking
320  // of method bodies to handle methods with
321  // bodies in the class definition
323  {
324  public:
326  symbolt *_method_symbol,
327  const template_mapt &_template_map,
328  const instantiation_stackt &_instantiation_stack):
329  method_symbol(_method_symbol),
330  template_map(_template_map),
331  instantiation_stack(_instantiation_stack)
332  {
333  }
334 
338  };
339 
340  typedef std::list<method_bodyt> method_bodiest;
342 
343  void add_method_body(symbolt *_method_symbol)
344  {
345  method_bodies.push_back(method_bodyt(
346  _method_symbol, template_map, instantiation_stack));
347  }
348 
349  bool builtin_factory(const irep_idt &);
350 
351  // types
352 
353  void typecheck_type(typet &type);
354 
356  template_typet &type);
357 
359  void check_fixed_size_array(typet &type);
360  void typecheck_enum_type(typet &type);
361 
362  // determine the scope into which a tag goes
363  // (enums, structs, union, classes)
365  const irep_idt &_base_name,
366  bool has_body,
367  bool tag_only_declaration);
368 
370  const symbolt &symbol,
371  const cpp_declarationt &declaration,
372  cpp_declaratort &declarator,
373  struct_typet::componentst &components,
374  const irep_idt &access,
375  bool is_static,
376  bool is_typedef,
377  bool is_mutable);
378 
380  symbolt &symbol,
381  cpp_declarationt &cpp_declaration);
382 
384  void typecheck_compound_body(symbolt &symbol);
386  void typecheck_enum_body(symbolt &symbol);
389  void add_anonymous_members_to_scope(const symbolt &struct_union_symbol);
390 
392  irept &initializers,
393  const typet &type,
394  exprt &value);
395 
396  static bool has_const(const typet &type);
397  static bool has_volatile(const typet &type);
398  static bool has_auto(const typet &type);
399 
401  const irep_idt &compound_identifier,
402  struct_typet::componentt &component,
403  irept &initializers,
404  const typet &method_qualifier,
405  exprt &value);
406 
408  const irep_idt &compound_identifier,
409  typet &method_type,
410  const typet &method_qualifier);
411 
412  // for function overloading
413  irep_idt function_identifier(const typet &type);
414 
415  void zero_initializer(
416  const exprt &object,
417  const typet &type,
418  const source_locationt &source_location,
419  exprt::operandst &ops);
420 
421  // code conversion
422  virtual void typecheck_code(codet &code);
423  virtual void typecheck_try_catch(codet &code);
424  virtual void typecheck_member_initializer(codet &code);
425  virtual void typecheck_decl(codet &code);
426  virtual void typecheck_block(codet &code);
427  virtual void typecheck_ifthenelse(code_ifthenelset &code);
428  virtual void typecheck_while(code_whilet &code);
429  virtual void typecheck_switch(code_switcht &code);
430 
432 
434  const source_locationt &source_location,
435  const typet &type,
436  const exprt &object);
437 
438  // expressions
440  void typecheck_expr_main(exprt &expr);
441  void typecheck_expr_member(exprt &expr);
442  void typecheck_expr_ptrmember(exprt &expr);
443  void typecheck_expr_throw(exprt &expr);
444  void typecheck_function_expr(exprt &expr,
445  const cpp_typecheck_fargst &fargs);
446  void typecheck_expr_cpp_name(exprt &expr,
447  const cpp_typecheck_fargst &fargs);
448  void typecheck_expr_member(exprt &expr,
449  const cpp_typecheck_fargst &fargs);
450  void typecheck_expr_ptrmember(exprt &expr,
451  const cpp_typecheck_fargst &fargs);
452  void typecheck_cast_expr(exprt &expr);
453  void typecheck_expr_trinary(if_exprt &expr);
457  void typecheck_expr_address_of(exprt &expr);
458  void typecheck_expr_dereference(exprt &expr);
461  void typecheck_expr_this(exprt &expr);
462  void typecheck_expr_new(exprt &expr);
463  void typecheck_expr_sizeof(exprt &expr);
464  void typecheck_expr_delete(exprt &expr);
468  void typecheck_expr_typecast(exprt &expr);
469  void typecheck_expr_index(exprt &expr);
471  void typecheck_expr_comma(exprt &expr);
472 
475 
476  bool operator_is_overloaded(exprt &expr);
477  bool overloadable(const exprt &expr);
478 
479  void add_implicit_dereference(exprt &expr);
480 
483 
486 
487 public:
488  //
489  // Type Conversions
490  //
491 
493  const exprt &expr, exprt &new_expr) const;
494 
496  const exprt &expr, exprt &new_expr) const;
497 
499  const exprt &expr, exprt &new_expr) const;
500 
502  const exprt &expr, const typet&, exprt &new_expr) const;
503 
505  const exprt &expr, exprt &new_expr) const;
506 
508  const exprt &expr, exprt &new_expr) const;
509 
511  const exprt &expr, const typet &type, exprt &new_expr) const;
512 
514  const exprt &expr, const typet &type, exprt &new_expr) const;
515 
517  const exprt &expr, const typet &type, exprt &new_expr) const;
518 
520  const exprt &expr, const typet &type, exprt &new_expr);
521 
523  const exprt &expr, const typet &type, exprt &new_expr);
524 
526  const exprt &expr, exprt &new_expr) const;
527 
529  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
530 
532  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
533 
534  bool reference_related(
535  const exprt &expr, const typet &type) const;
536 
538  const exprt &expr, const typet &type, unsigned &rank) const;
539 
540  bool reference_binding(
541  exprt expr, const typet &type, exprt &new_expr, unsigned &rank);
542 
544  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
545 
547  const exprt &expr, const typet &type, unsigned &rank);
548 
550  const exprt &expr, const typet &type, exprt &new_expr);
551 
552  void reference_initializer(exprt &expr, const typet &type);
553 
554  virtual void implicit_typecast(exprt &expr, const typet &type);
555 
556  void get_bases(const struct_typet &type,
557  std::set<irep_idt> &set_bases) const;
558 
559  void get_virtual_bases(const struct_typet &type,
560  std::list<irep_idt> &vbases) const;
561 
562  bool subtype_typecast(
563  const struct_typet &from,
564  const struct_typet &to) const;
565 
566  void make_ptr_typecast(
567  exprt &expr,
568  const typet &dest_type);
569 
570  // the C++ typecasts
571 
572  bool const_typecast(
573  const exprt &expr,
574  const typet &type,
575  exprt &new_expr);
576 
577  bool dynamic_typecast(
578  const exprt &expr,
579  const typet &type,
580  exprt &new_expr);
581 
583  const exprt &expr,
584  const typet &type,
585  exprt &new_expr,
586  bool check_constantness=true);
587 
588  bool static_typecast(
589  const exprt &expr,
590  const typet &type,
591  exprt &new_expr,
592  bool check_constantness=true);
593 
594 private:
595  typedef std::list<irep_idt> dynamic_initializationst;
597  bool disable_access_control; // Disable protect and private
598 };
599 
600 #endif // CPROVER_CPP_CPP_TYPECHECK_H
void typecheck_function_expr(exprt &expr, const cpp_typecheck_fargst &fargs)
The type of an expression.
Definition: type.h:22
void convert_function(symbolt &symbol)
void add_anonymous_members_to_scope(const symbolt &struct_union_symbol)
void typecheck_expr_dereference(exprt &expr)
bool find_cpctor(const symbolt &symbol) const
void check_fixed_size_array(typet &type)
check that an array has fixed size
void typecheck_side_effect_function_call(side_effect_expr_function_callt &expr)
C++ Language Type Checking.
bool reference_binding(exprt expr, const typet &type, exprt &new_expr, unsigned &rank)
Reference binding.
codet dtor(const symbolt &symb)
produces destructor code for a class object
void typecheck_type(typet &type)
A ‘switch’ instruction.
Definition: std_code.h:533
C++ Language Type Checking.
Base type of functions.
Definition: std_types.h:764
A generic base class for relations, i.e., binary predicates.
Definition: std_expr.h:752
void new_temporary(const source_locationt &source_location, const typet &, const exprt::operandst &ops, exprt &temporary)
void typecheck_expr_member(exprt &expr)
static bool has_const(const typet &type)
bool standard_conversion_floating_point_conversion(const exprt &expr, const typet &type, exprt &new_expr) const
Floating-point conversion.
void convert_non_template_declaration(cpp_declarationt &declaration)
static bool has_auto(const typet &type)
C++ Parser.
void typecheck_expr_rel(binary_relation_exprt &expr)
virtual void typecheck_switch(code_switcht &code)
void add_implicit_dereference(exprt &expr)
exprt resolve(const cpp_namet &cpp_name, const wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true)
bool static_typecast(const exprt &expr, const typet &type, exprt &new_expr, bool check_constantness=true)
bool find_parent(const symbolt &symb, const irep_idt &base_name, irep_idt &identifier)
bool standard_conversion_integral_conversion(const exprt &expr, const typet &type, exprt &new_expr) const
Integral conversion.
instantiation_stackt instantiation_stack
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=typet(ID_nil))
void get_bases(const struct_typet &type, std::set< irep_idt > &set_bases) const
cpp_template_args_tct typecheck_template_args(const source_locationt &source_location, const symbolt &template_symbol, const cpp_template_args_non_tct &template_args)
instantiation_stackt & instantiation_stack
void full_member_initialization(const struct_union_typet &struct_union_type, irept &initializers)
Build the full initialization list of the constructor.
bool user_defined_conversion_sequence(const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank)
User-defined conversion sequence.
bool check_component_access(const struct_union_typet::componentt &component, const struct_union_typet &struct_union_type)
void convert_template_function_or_member_specialization(cpp_declarationt &declaration)
std::vector< componentt > componentst
Definition: std_types.h:243
bool standard_conversion_qualification(const exprt &expr, const typet &, exprt &new_expr) const
Qualification conversion.
bool standard_conversion_floating_point_promotion(const exprt &expr, exprt &new_expr) const
Floating-point-promotion conversion.
void typecheck_expr_function_identifier(exprt &expr)
bool overloadable(const exprt &expr)
void show_instantiation_stack(std::ostream &)
virtual void typecheck_code(codet &code)
template_mapt template_map
void convert_parameter(const irep_idt &mode, code_typet::parametert &parameter)
void static_and_dynamic_initialization()
Initialization of static objects:
The trinary if-then-else operator.
Definition: std_expr.h:3361
void typecheck_enum_body(symbolt &symbol)
void explicit_typecast_ambiguity(exprt &expr)
void default_dtor(const symbolt &symb, cpp_declarationt &dtor)
Note:
void move_member_initializers(irept &initializers, const typet &type, exprt &value)
void add_this_to_method_type(const irep_idt &compound_identifier, typet &method_type, const typet &method_qualifier)
void typecheck_method_application(side_effect_expr_function_callt &expr)
void typecheck_expr_delete(exprt &expr)
void typecheck_expr_this(exprt &expr)
virtual void implicit_typecast(exprt &expr, const typet &type)
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
Definition: symbol.h:30
void typecheck_expr_reference_to(exprt &expr)
Structure type.
Definition: std_types.h:297
void check_member_initializers(const irept &bases, const struct_typet::componentst &components, const irept &initializers)
Check a constructor initialization-list.
bool standard_conversion_function_to_pointer(const exprt &expr, exprt &new_expr) const
Function-to-pointer conversion.
virtual void typecheck_block(codet &code)
std::string class_template_identifier(const irep_idt &base_name, const template_typet &template_type, const cpp_template_args_non_tct &partial_specialization_args)
bool cast_away_constness(const typet &t1, const typet &t2) const
void typecheck_class_template(cpp_declarationt &declaration)
void typecheck_expr_typecast(exprt &expr)
cpp_scopet & typecheck_template_parameters(template_typet &type)
bool standard_conversion_integral_promotion(const exprt &expr, exprt &new_expr) const
Integral-promotion conversion.
void typecheck_expr_binary_arithmetic(exprt &expr)
virtual void typecheck_expr(exprt &expr)
void convert(cpp_linkage_spect &)
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)
bool reference_compatible(const exprt &expr, const typet &type, unsigned &rank) const
Reference-compatible.
void typecheck_enum_type(typet &type)
void typecheck_expr_explicit_typecast(exprt &expr)
bool dynamic_typecast(const exprt &expr, const typet &type, exprt &new_expr)
bool standard_conversion_floating_integral_conversion(const exprt &expr, const typet &type, exprt &new_expr) const
Floating-integral conversion.
void default_assignop_value(const symbolt &symbol, cpp_declaratort &declarator)
Generate code for the implicit default assignment operator.
instantiation_stackt instantiation_stack
bool reference_related(const exprt &expr, const typet &type) const
Reference-related.
void add_method_body(symbolt *_method_symbol)
void typecheck_expr_ptrmember(exprt &expr)
virtual void typecheck_try_catch(codet &code)
void typecheck_function_call_arguments(side_effect_expr_function_callt &expr)
void elaborate_class_template(const typet &type)
elaborate class template instances
virtual ~cpp_typecheckt()
Definition: cpp_typecheck.h:75
void typecheck_expr_explicit_constructor_call(exprt &expr)
void salvage_default_arguments(const template_typet &old_type, template_typet &new_type)
A reference into the symbol table.
Definition: std_types.h:110
ANSI-C Language Type Checking.
std::list< instantiationt > instantiation_stackt
method_bodyt(symbolt *_method_symbol, const template_mapt &_template_map, const instantiation_stackt &_instantiation_stack)
void typecheck_cast_expr(exprt &expr)
virtual void typecheck()
typechecking main method
const irep_idt mode
cpp_typecheckt(cpp_parse_treet &_cpp_parse_tree, symbol_tablet &_symbol_table1, const symbol_tablet &_symbol_table2, const std::string &_module, message_handlert &message_handler)
Definition: cpp_typecheck.h:60
bool cpp_is_pod(const typet &type) const
Definition: cpp_is_pod.cpp:14
std::string function_template_identifier(const irep_idt &base_name, const template_typet &template_type, const typet &function_type)
bool reinterpret_typecast(const exprt &expr, const typet &type, exprt &new_expr, bool check_constantness=true)
cpp_parse_treet & cpp_parse_tree
void typecheck_friend_declaration(symbolt &symbol, cpp_declarationt &cpp_declaration)
void convert_parameters(const irep_idt &mode, code_typet &function_type)
void typecheck_compound_body(struct_union_typet &type)
source_locationt source_location
The symbol table.
Definition: symbol_table.h:19
codet cpp_destructor(const source_locationt &source_location, const typet &type, const exprt &object)
TO_BE_DOCUMENTED.
Definition: namespace.h:74
void typecheck_member_function(const irep_idt &compound_identifier, struct_typet::componentt &component, irept &initializers, const typet &method_qualifier, exprt &value)
void do_virtual_table(const symbolt &symbol)
void convert_initializer(symbolt &symbol)
Initialize an object with a value.
Base class for tree-like data structures with sharing.
Definition: irep.h:86
bool standard_conversion_pointer_to_member(const exprt &expr, const typet &type, exprt &new_expr)
Pointer-to-member conversion.
void convert_template_declaration(cpp_declarationt &declaration)
A ‘while’ instruction.
Definition: std_code.h:588
void typecheck_function_template(cpp_declarationt &declaration)
typecheck function templates
void typecheck_expr_throw(exprt &expr)
void typecheck_side_effect_assignment(side_effect_exprt &expr)
unsigned anon_counter
void convert_pmop(exprt &expr)
void zero_initializer(const exprt &object, const typet &type, const source_locationt &source_location, exprt::operandst &ops)
exprt resolve(const cpp_namet &cpp_name, const cpp_typecheck_resolvet::wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true)
Definition: cpp_typecheck.h:87
void default_assignop(const symbolt &symbol, cpp_declarationt &cpctor)
Generate declaration of the implicit default assignment operator.
void default_cpctor(const symbolt &, cpp_declarationt &cpctor) const
Generate code for implicit default copy constructor.
void make_ptr_typecast(exprt &expr, const typet &dest_type)
void typecheck_expr_trinary(if_exprt &expr)
std::string template_suffix(const cpp_template_args_tct &template_args)
std::list< irep_idt > dynamic_initializationst
bool find_dtor(const symbolt &symbol) const
std::vector< exprt > operandst
Definition: expr.h:45
A function call side effect.
Definition: std_code.h:1352
void typecheck_method_bodies(method_bodiest &)
bool const_typecast(const exprt &expr, const typet &type, exprt &new_expr)
bool get_component(const source_locationt &source_location, const exprt &object, const irep_idt &component_name, exprt &member)
void typecheck_expr_address_of(exprt &expr)
irep_idt function_identifier(const typet &type)
for function overloading
virtual void typecheck_decl(codet &code)
method_bodiest method_bodies
cpp_template_args_tct full_template_args
API to type classes.
bool subtype_typecast(const struct_typet &from, const struct_typet &to) const
bool operator_is_overloaded(exprt &expr)
void typecheck_compound_bases(struct_typet &type)
bool standard_conversion_lvalue_to_rvalue(const exprt &expr, exprt &new_expr) const
Lvalue-to-rvalue conversion.
Base type of C structs and unions, and C++ classes.
Definition: std_types.h:162
bool builtin_factory(const irep_idt &)
void default_ctor(const source_locationt &source_location, const irep_idt &base_name, cpp_declarationt &ctor) const
Generate code for implicit default constructors.
void do_not_typechecked()
irep_idt current_linkage_spec
bool standard_conversion_sequence(const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank)
Standard Conversion Sequence.
void convert_anonymous_union(cpp_declarationt &declaration, codet &new_code)
void typecheck_expr_comma(exprt &expr)
bool find_assignop(const symbolt &symbol) const
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)
Base class for all expressions.
Definition: expr.h:42
void get_virtual_bases(const struct_typet &type, std::list< irep_idt > &vbases) const
void convert_class_template_specialization(cpp_declarationt &declaration)
unsigned template_counter
void add_base_components(const struct_typet &from, const irep_idt &access, struct_typet &to, std::set< irep_idt > &bases, std::set< irep_idt > &vbases, bool is_virtual)
#define UNREACHABLE
Definition: invariant.h:250
virtual void typecheck_while(code_whilet &code)
virtual std::string to_string(const typet &type)
C++ Language Type Checking.
void typecheck_compound_type(struct_union_typet &type)
const struct_typet & this_struct_type()
dynamic_initializationst dynamic_initializations
bool disable_access_control
void typecheck_expr_side_effect(side_effect_exprt &expr)
void typecheck_expr_main(exprt &expr)
Called after the operands are done.
void typecheck_compound_body(symbolt &symbol)
bool standard_conversion_array_to_pointer(const exprt &expr, exprt &new_expr) const
Array-to-pointer conversion.
An if-then-else.
Definition: std_code.h:461
virtual void typecheck_ifthenelse(code_ifthenelset &code)
bool standard_conversion_pointer(const exprt &expr, const typet &type, exprt &new_expr)
Pointer conversion.
goto_programt coverage_criteriont message_handlert & message_handler
Definition: cover.cpp:66
void put_compound_into_scope(const struct_union_typet::componentt &component)
A statement in a programming language.
Definition: std_code.h:21
void typecheck_expr_cpp_name(exprt &expr, const cpp_typecheck_fargst &fargs)
void typecheck_side_effect_inc_dec(side_effect_exprt &expr)
std::list< method_bodyt > method_bodiest
An expression containing a side effect.
Definition: std_code.h:1238
void typecheck_expr_sizeof(exprt &expr)
bool implicit_conversion_sequence(const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank)
implicit conversion sequence
static bool has_volatile(const typet &type)
void typecheck_class_template_member(cpp_declarationt &declaration)
typecheck class template members; these can be methods or static members
void typecheck_expr_index(exprt &expr)
message_handlert * message_handler
Definition: message.h:342
void convert_anon_struct_union_member(const cpp_declarationt &declaration, const irep_idt &access, struct_typet::componentst &components)
virtual void typecheck_member_initializer(codet &code)
cpp_typecheckt(cpp_parse_treet &_cpp_parse_tree, symbol_tablet &_symbol_table, const std::string &_module, message_handlert &message_handler)
Definition: cpp_typecheck.h:47
cpp_scopet & tag_scope(const irep_idt &_base_name, bool has_body, bool tag_only_declaration)
bool cpp_typecheck(cpp_parse_treet &cpp_parse_tree, symbol_tablet &symbol_table, const std::string &module, message_handlert &message_handler)
codet cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
instantiation_levelt(instantiation_stackt &_instantiation_stack)
void typecheck_expr_new(exprt &expr)
void reference_initializer(exprt &expr, const typet &type)
A reference to type "cv1 T1" is initialized by an expression of type "cv2 T2" as follows: ...
bool standard_conversion_boolean(const exprt &expr, exprt &new_expr) const
Boolean conversion.
cpp_scopest cpp_scopes