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,
37  message_handlert &message_handler);
38 
39 bool cpp_typecheck(
40  exprt &expr,
41  message_handlert &message_handler,
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  // types
350 
351  void typecheck_type(typet &type);
352 
354  template_typet &type);
355 
357  void check_fixed_size_array(typet &type);
358  void typecheck_enum_type(typet &type);
359 
360  // determine the scope into which a tag goes
361  // (enums, structs, union, classes)
363  const irep_idt &_base_name,
364  bool has_body,
365  bool tag_only_declaration);
366 
368  const symbolt &symbol,
369  const cpp_declarationt &declaration,
370  cpp_declaratort &declarator,
371  struct_typet::componentst &components,
372  const irep_idt &access,
373  bool is_static,
374  bool is_typedef,
375  bool is_mutable);
376 
378  symbolt &symbol,
379  cpp_declarationt &cpp_declaration);
380 
382  void typecheck_compound_body(symbolt &symbol);
383  void typecheck_compound_body(struct_union_typet &type) { assert(false); }
384  void typecheck_enum_body(symbolt &symbol);
387  void add_anonymous_members_to_scope(const symbolt &struct_union_symbol);
388 
390  irept &initializers,
391  const typet &type,
392  exprt &value);
393 
394  static bool has_const(const typet &type);
395  static bool has_volatile(const typet &type);
396 
398  const irep_idt &compound_identifier,
399  struct_typet::componentt &component,
400  irept &initializers,
401  const typet &method_qualifier,
402  exprt &value);
403 
405  const irep_idt &compound_identifier,
406  typet &method_type,
407  const typet &method_qualifier);
408 
409  // for function overloading
410  irep_idt function_identifier(const typet &type);
411 
412  void zero_initializer(
413  const exprt &object,
414  const typet &type,
415  const source_locationt &source_location,
416  exprt::operandst &ops);
417 
418  // code conversion
419  virtual void typecheck_code(codet &code);
420  virtual void typecheck_try_catch(codet &code);
421  virtual void typecheck_member_initializer(codet &code);
422  virtual void typecheck_decl(codet &code);
423  virtual void typecheck_block(codet &code);
424  virtual void typecheck_ifthenelse(code_ifthenelset &code);
425  virtual void typecheck_while(code_whilet &code);
426  virtual void typecheck_switch(code_switcht &code);
427 
429 
431  const source_locationt &source_location,
432  const typet &type,
433  const exprt &object);
434 
435  // expressions
437  void typecheck_expr_main(exprt &expr);
438  void typecheck_expr_member(exprt &expr);
439  void typecheck_expr_ptrmember(exprt &expr);
440  void typecheck_expr_throw(exprt &expr);
441  void typecheck_function_expr(exprt &expr,
442  const cpp_typecheck_fargst &fargs);
443  void typecheck_expr_cpp_name(exprt &expr,
444  const cpp_typecheck_fargst &fargs);
445  void typecheck_expr_member(exprt &expr,
446  const cpp_typecheck_fargst &fargs);
447  void typecheck_expr_ptrmember(exprt &expr,
448  const cpp_typecheck_fargst &fargs);
449  void typecheck_cast_expr(exprt &expr);
450  void typecheck_expr_trinary(if_exprt &expr);
454  void typecheck_expr_address_of(exprt &expr);
455  void typecheck_expr_dereference(exprt &expr);
458  void typecheck_expr_this(exprt &expr);
459  void typecheck_expr_new(exprt &expr);
460  void typecheck_expr_sizeof(exprt &expr);
461  void typecheck_expr_delete(exprt &expr);
465  void typecheck_expr_typecast(exprt &expr);
466  void typecheck_expr_index(exprt &expr);
468  void typecheck_expr_comma(exprt &expr);
469 
472 
473  bool operator_is_overloaded(exprt &expr);
474  bool overloadable(const exprt &expr);
475 
476  void add_implicit_dereference(exprt &expr);
477 
480 
483 
484  void typecheck_assign(codet &code);
485 
486 public:
487  //
488  // Type Conversions
489  //
490 
492  const exprt &expr, exprt &new_expr) const;
493 
495  const exprt &expr, exprt &new_expr) const;
496 
498  const exprt &expr, exprt &new_expr) const;
499 
501  const exprt &expr, const typet&, exprt &new_expr) const;
502 
504  const exprt &expr, exprt &new_expr) const;
505 
507  const exprt &expr, exprt &new_expr) const;
508 
510  const exprt &expr, const typet &type, exprt &new_expr) const;
511 
513  const exprt &expr, const typet &type, exprt &new_expr) const;
514 
516  const exprt &expr, const typet &type, exprt &new_expr) const;
517 
519  const exprt &expr, const typet &type, exprt &new_expr);
520 
522  const exprt &expr, const typet &type, exprt &new_expr);
523 
525  const exprt &expr, exprt &new_expr) const;
526 
528  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
529 
531  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
532 
533  bool reference_related(
534  const exprt &expr, const typet &type) const;
535 
537  const exprt &expr, const typet &type, unsigned &rank) const;
538 
539  bool reference_binding(
540  exprt expr, const typet &type, exprt &new_expr, unsigned &rank);
541 
543  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
544 
546  const exprt &expr, const typet &type, unsigned &rank);
547 
549  const exprt &expr, const typet &type, exprt &new_expr);
550 
551  void reference_initializer(exprt &expr, const typet &type);
552 
553  virtual void implicit_typecast(exprt &expr, const typet &type);
554 
555  void get_bases(const struct_typet &type,
556  std::set<irep_idt> &set_bases) const;
557 
558  void get_virtual_bases(const struct_typet &type,
559  std::list<irep_idt> &vbases) const;
560 
561  bool subtype_typecast(
562  const struct_typet &from,
563  const struct_typet &to) const;
564 
565  void make_ptr_typecast(
566  exprt &expr,
567  const typet &dest_type);
568 
569  // the C++ typecasts
570 
571  bool const_typecast(
572  const exprt &expr,
573  const typet &type,
574  exprt &new_expr);
575 
576  bool dynamic_typecast(
577  const exprt &expr,
578  const typet &type,
579  exprt &new_expr);
580 
582  const exprt &expr,
583  const typet &type,
584  exprt &new_expr,
585  bool check_constantness=true);
586 
587  bool static_typecast(
588  const exprt &expr,
589  const typet &type,
590  exprt &new_expr,
591  bool check_constantness=true);
592 
593 private:
594  typedef std::list<irep_idt> dynamic_initializationst;
596  bool disable_access_control; // Disable protect and private
597 };
598 
599 #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:20
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:412
C++ Language Type Checking.
Base type of functions.
Definition: std_types.h:734
A generic base class for relations, i.e., binary predicates.
Definition: std_expr.h:568
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)
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:240
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:2771
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 typecheck_assign(codet &code)
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:33
void typecheck_expr_reference_to(exprt &expr)
Structure type.
Definition: std_types.h:296
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:109
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:52
codet cpp_destructor(const source_locationt &source_location, const typet &type, const exprt &object)
TO_BE_DOCUMENTED.
Definition: namespace.h:62
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:87
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:457
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:49
A function call side effect.
Definition: std_code.h:1052
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:159
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:46
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)
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:350
virtual void typecheck_ifthenelse(code_ifthenelset &code)
bool standard_conversion_pointer(const exprt &expr, const typet &type, exprt &new_expr)
Pointer conversion.
void put_compound_into_scope(const struct_union_typet::componentt &component)
A statement in a programming language.
Definition: std_code.h:19
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:997
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:259
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