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  ~cpp_typecheckt() override
76  {
77  }
78 
79  void typecheck() override;
80 
81  // overload to use C++ syntax
82  std::string to_string(const typet &) override;
83  std::string to_string(const exprt &) override;
84 
85  friend class cpp_typecheck_resolvet;
87 
89  const cpp_namet &cpp_name,
91  const cpp_typecheck_fargst &fargs,
92  bool fail_with_exception=true)
93  {
94  cpp_typecheck_resolvet cpp_typecheck_resolve(*this);
95  return cpp_typecheck_resolve.resolve(
96  cpp_name, want, fargs, fail_with_exception);
97  }
98 
99  void typecheck_expr(exprt &) override;
100 
101  bool cpp_is_pod(const typet &type) const;
102 
104  const source_locationt &source_location,
105  const exprt &object,
106  const exprt::operandst &operands);
107 
108 protected:
110 
113 
114  void convert(cpp_linkage_spect &);
116  void convert(cpp_usingt &);
117  void convert(cpp_itemt &);
118  void convert(cpp_declarationt &);
119  void convert(cpp_declaratort &);
120  void convert(cpp_static_assertt &);
121 
122  void convert_initializer(symbolt &symbol);
123  void convert_function(symbolt &symbol);
124 
125  void convert_pmop(exprt &expr);
126 
128  cpp_declarationt &declaration,
129  codet &new_code);
130 
132  const cpp_declarationt &declaration,
133  const irep_idt &access,
134  struct_typet::componentst &components);
135 
136  //
137  // Templates
138  //
140  const template_typet &old_type,
141  template_typet &new_type);
142 
144 
146 
148  cpp_declarationt &declaration);
149 
151  cpp_declarationt &declaration);
152 
153  void typecheck_class_template(cpp_declarationt &declaration);
154 
156 
158 
159  std::string class_template_identifier(
160  const irep_idt &base_name,
161  const template_typet &template_type,
162  const cpp_template_args_non_tct &partial_specialization_args);
163 
164  std::string function_template_identifier(
165  const irep_idt &base_name,
166  const template_typet &template_type,
167  const typet &function_type);
168 
170  const source_locationt &source_location,
171  const symbolt &template_symbol,
172  const cpp_template_args_non_tct &template_args);
173 
174  // template instantiations
176  {
177  public:
181  };
182 
183  typedef std::list<instantiationt> instantiation_stackt;
185 
186  void show_instantiation_stack(std::ostream &);
187 
189  {
190  public:
192  instantiation_stackt &_instantiation_stack):
193  instantiation_stack(_instantiation_stack)
194  {
195  instantiation_stack.push_back(instantiationt());
196  }
197 
199  {
200  instantiation_stack.pop_back();
201  }
202 
203  private:
205  };
206 
208  const source_locationt &source_location,
209  const symbolt &template_symbol,
210  const cpp_template_args_tct &specialization_template_args,
211  const cpp_template_args_tct &full_template_args);
212 
214  const typet &type);
215 
217  const source_locationt &source_location,
218  const symbolt &symbol,
219  const cpp_template_args_tct &specialization_template_args,
220  const cpp_template_args_tct &full_template_args,
221  const typet &specialization=typet(ID_nil));
222 
224  const source_locationt &source_location,
225  const symbol_typet &type);
226 
228  unsigned anon_counter;
229 
231 
232  std::string template_suffix(
233  const cpp_template_args_tct &template_args);
234 
235  void convert_parameters(
236  const irep_idt &mode,
237  code_typet &function_type);
238 
239  void convert_parameter(
240  const irep_idt &mode,
241  code_typet::parametert &parameter);
242 
243  //
244  // Misc
245  //
246 
247  void default_ctor(
248  const source_locationt &source_location,
249  const irep_idt &base_name,
250  cpp_declarationt &ctor) const;
251 
252  void default_cpctor(
253  const symbolt&, cpp_declarationt &cpctor) const;
254 
255  void default_assignop(
256  const symbolt &symbol, cpp_declarationt &cpctor);
257 
259  const symbolt &symbol, cpp_declaratort &declarator);
260 
261  void default_dtor(const symbolt &symb, cpp_declarationt &dtor);
262 
263  codet dtor(const symbolt &symb);
264 
266  const struct_typet::basest &bases,
267  const struct_typet::componentst &components,
268  const irept &initializers);
269 
272  const struct_union_typet &struct_union_type);
273 
275  const struct_union_typet &struct_union_type,
276  irept &initializers);
277 
278  bool find_cpctor(const symbolt &symbol)const;
279  bool find_assignop(const symbolt &symbol)const;
280  bool find_dtor(const symbolt &symbol)const;
281 
282  bool find_parent(
283  const symbolt &symb,
284  const irep_idt &base_name,
285  irep_idt &identifier);
286 
287  bool get_component(
288  const source_locationt &source_location,
289  const exprt &object,
290  const irep_idt &component_name,
291  exprt &member);
292 
293  void new_temporary(const source_locationt &source_location,
294  const typet &,
295  const exprt::operandst &ops,
296  exprt &temporary);
297 
298  void new_temporary(const source_locationt &source_location,
299  const typet &,
300  const exprt &op,
301  exprt &temporary);
302 
304  void do_not_typechecked();
305  void clean_up();
306 
307  void add_base_components(
308  const struct_typet &from,
309  const irep_idt &access,
310  struct_typet &to,
311  std::set<irep_idt> &bases,
312  std::set<irep_idt> &vbases,
313  bool is_virtual);
314 
315  bool cast_away_constness(const typet &t1,
316  const typet &t2) const;
317 
318  void do_virtual_table(const symbolt &symbol);
319 
320  // we need to be able to delay the typechecking
321  // of method bodies to handle methods with
322  // bodies in the class definition
324  {
325  public:
327  symbolt *_method_symbol,
328  const template_mapt &_template_map,
329  const instantiation_stackt &_instantiation_stack):
330  method_symbol(_method_symbol),
331  template_map(_template_map),
332  instantiation_stack(_instantiation_stack)
333  {
334  }
335 
339  };
340 
341  typedef std::list<method_bodyt> method_bodiest;
342  std::set<irep_idt> methods_seen;
344 
345  void add_method_body(symbolt *_method_symbol);
346 
347  bool builtin_factory(const irep_idt &);
348 
349  // types
350 
351  void typecheck_type(typet &) override;
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);
384  {
385  UNREACHABLE;
386  }
387  void typecheck_enum_body(symbolt &symbol);
390  void add_anonymous_members_to_scope(const symbolt &struct_union_symbol);
391 
393  irept &initializers,
394  const code_typet &type,
395  exprt &value);
396 
397  static bool has_const(const typet &type);
398  static bool has_volatile(const typet &type);
399  static bool has_auto(const typet &type);
400 
402  const symbolt &compound_symbol,
404  irept &initializers,
405  const typet &method_qualifier,
406  exprt &value);
407 
409  const symbolt &compound_symbol,
410  code_typet &method_type,
411  const typet &method_qualifier);
412 
413  // for function overloading
414  irep_idt function_identifier(const typet &type);
415 
416  void zero_initializer(
417  const exprt &object,
418  const typet &type,
419  const source_locationt &source_location,
420  exprt::operandst &ops);
421 
422  // code conversion
423  void typecheck_code(codet &) override;
424  void typecheck_try_catch(codet &);
426  void typecheck_decl(codet &) override;
427  void typecheck_block(code_blockt &) override;
428  void typecheck_ifthenelse(code_ifthenelset &) override;
429  void typecheck_while(code_whilet &) override;
430  void typecheck_switch(code_switcht &) override;
431 
433 
435  cpp_destructor(const source_locationt &source_location, const exprt &object);
436 
437  // expressions
439  void typecheck_expr_main(exprt &) override;
440  void typecheck_expr_member(exprt &) override;
441  void typecheck_expr_ptrmember(exprt &) override;
442  void typecheck_expr_throw(exprt &);
447  void typecheck_cast_expr(exprt &);
448  void typecheck_expr_trinary(if_exprt &) override;
449  void typecheck_expr_binary_arithmetic(exprt &) override;
452  void typecheck_expr_address_of(exprt &) override;
453  void typecheck_expr_dereference(exprt &) override;
454  void typecheck_expr_function_identifier(exprt &) override;
456  void typecheck_expr_this(exprt &);
457  void typecheck_expr_new(exprt &);
458  void typecheck_expr_sizeof(exprt &) override;
463  void typecheck_expr_typecast(exprt &) override;
464  void typecheck_expr_index(exprt &) override;
465  void typecheck_expr_rel(binary_relation_exprt &) override;
466  void typecheck_expr_comma(exprt &) override;
467 
468  void
470 
472  bool overloadable(const exprt &);
473 
475 
478 
480 
481 public:
482  //
483  // Type Conversions
484  //
485 
487  const exprt &expr, exprt &new_expr) const;
488 
490  const exprt &expr, exprt &new_expr) const;
491 
493  const exprt &expr, exprt &new_expr) const;
494 
496  const exprt &expr, const typet&, exprt &new_expr) const;
497 
499  const exprt &expr, exprt &new_expr) const;
500 
502  const exprt &expr, exprt &new_expr) const;
503 
505  const exprt &expr, const typet &type, exprt &new_expr) const;
506 
508  const exprt &expr, const typet &type, 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);
515 
517  const exprt &expr, const typet &type, exprt &new_expr);
518 
520  const exprt &expr, exprt &new_expr) const;
521 
523  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
524 
526  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
527 
528  bool reference_related(
529  const exprt &expr, const typet &type) const;
530 
532  const exprt &expr, const typet &type, unsigned &rank) const;
533 
534  bool reference_binding(
535  exprt expr, const typet &type, exprt &new_expr, unsigned &rank);
536 
538  const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank);
539 
541  const exprt &expr, const typet &type, unsigned &rank);
542 
544  const exprt &expr, const typet &type, exprt &new_expr);
545 
546  void reference_initializer(exprt &expr, const typet &type);
547 
548  void implicit_typecast(exprt &expr, const typet &type) override;
549 
550  void get_bases(const struct_typet &type,
551  std::set<irep_idt> &set_bases) const;
552 
553  void get_virtual_bases(const struct_typet &type,
554  std::list<irep_idt> &vbases) const;
555 
556  bool subtype_typecast(
557  const struct_typet &from,
558  const struct_typet &to) const;
559 
560  void make_ptr_typecast(
561  exprt &expr,
562  const typet &dest_type);
563 
564  // the C++ typecasts
565 
566  bool const_typecast(
567  const exprt &expr,
568  const typet &type,
569  exprt &new_expr);
570 
571  bool dynamic_typecast(
572  const exprt &expr,
573  const typet &type,
574  exprt &new_expr);
575 
577  const exprt &expr,
578  const typet &type,
579  exprt &new_expr,
580  bool check_constantness=true);
581 
582  bool static_typecast(
583  const exprt &expr,
584  const typet &type,
585  exprt &new_expr,
586  bool check_constantness=true);
587 
588  bool contains_cpp_name(const exprt &);
589 
590 private:
591  typedef std::list<irep_idt> dynamic_initializationst;
593  bool disable_access_control; // Disable protect and private
594 };
595 
596 #endif // CPROVER_CPP_CPP_TYPECHECK_H
void typecheck_expr_trinary(if_exprt &) override
The type of an expression, extends irept.
Definition: type.h:27
void convert_function(symbolt &symbol)
void add_anonymous_members_to_scope(const symbolt &struct_union_symbol)
void typecheck_expr_explicit_constructor_call(exprt &)
void typecheck_expr_new(exprt &)
bool find_cpctor(const symbolt &symbol) const
void check_fixed_size_array(typet &type)
check that an array has fixed size
void typecheck_expr_typecast(exprt &) override
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() override
typechecking main method
codet representing a switch statement.
Definition: std_code.h:705
C++ Language Type Checking.
Base type of functions.
Definition: std_types.h:751
A base class for relations, i.e., binary predicates.
Definition: std_expr.h:878
void new_temporary(const source_locationt &source_location, const typet &, const exprt::operandst &ops, exprt &temporary)
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_block(code_blockt &) override
optionalt< codet > cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
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
bool overloadable(const exprt &)
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
void typecheck_expr_member(exprt &) override
void typecheck_expr_main(exprt &) override
Called after the operands are done.
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.
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
Definition: std_expr.cpp:173
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:203
bool standard_conversion_qualification(const exprt &expr, const typet &, exprt &new_expr) const
Qualification conversion.
void typecheck_decl(codet &) override
void typecheck_expr(exprt &) override
bool standard_conversion_floating_point_promotion(const exprt &expr, exprt &new_expr) const
Floating-point-promotion conversion.
bool operator_is_overloaded(exprt &)
void show_instantiation_stack(std::ostream &)
template_mapt template_map
void typecheck_expr_cpp_name(exprt &, const cpp_typecheck_fargst &)
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:3427
void typecheck_enum_body(symbolt &symbol)
void default_dtor(const symbolt &symb, cpp_declarationt &dtor)
Note:
void typecheck_code(codet &) override
void typecheck_expr_delete(exprt &)
Symbol table entry.
Definition: symbol.h:27
void typecheck_expr_this(exprt &)
Structure type, corresponds to C style structs.
Definition: std_types.h:276
bool standard_conversion_function_to_pointer(const exprt &expr, exprt &new_expr) const
Function-to-pointer conversion.
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_side_effect_assignment(side_effect_exprt &) override
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_function_expr(exprt &, const cpp_typecheck_fargst &)
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)
std::set< irep_idt > methods_seen
bool reference_compatible(const exprt &expr, const typet &type, unsigned &rank) const
Reference-compatible.
void typecheck_enum_type(typet &type)
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 elaborate_class_template(const typet &type)
elaborate class template instances
void typecheck_expr_dereference(exprt &) override
optionalt< codet > cpp_destructor(const source_locationt &source_location, const exprt &object)
void add_this_to_method_type(const symbolt &compound_symbol, code_typet &method_type, const typet &method_qualifier)
void salvage_default_arguments(const template_typet &old_type, template_typet &new_type)
void explicit_typecast_ambiguity(exprt &)
void typecheck_method_application(side_effect_expr_function_callt &)
A reference into the symbol table.
Definition: std_types.h:62
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)
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
void check_member_initializers(const struct_typet::basest &bases, const struct_typet::componentst &components, const irept &initializers)
Check a constructor initialization-list.
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_type(typet &) override
nonstd::optional< T > optionalt
Definition: optional.h:35
void typecheck_friend_declaration(symbolt &symbol, cpp_declarationt &cpp_declaration)
void typecheck_expr_function_identifier(exprt &) override
void convert_parameters(const irep_idt &mode, code_typet &function_type)
void implicit_typecast(exprt &expr, const typet &type) override
void typecheck_expr_throw(exprt &)
source_locationt source_location
The symbol table.
Definition: symbol_table.h:19
void typecheck_cast_expr(exprt &)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:93
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:156
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)
codet representing a while statement.
Definition: std_code.h:767
void typecheck_function_template(cpp_declarationt &declaration)
typecheck function templates
void typecheck_side_effect_inc_dec(side_effect_exprt &)
void typecheck_expr_explicit_typecast(exprt &)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:35
~cpp_typecheckt() override
Definition: cpp_typecheck.h:75
void typecheck_expr_comma(exprt &) override
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:88
void default_assignop(const symbolt &symbol, cpp_declarationt &cpctor)
Generate declaration of the implicit default assignment operator.
bool contains_cpp_name(const exprt &)
void default_cpctor(const symbolt &, cpp_declarationt &cpctor) const
Generate code for implicit default copy constructor.
void typecheck_expr_address_of(exprt &) override
void make_ptr_typecast(exprt &expr, const typet &dest_type)
void typecheck_compound_body(struct_union_typet &) override
std::string template_suffix(const cpp_template_args_tct &template_args)
std::list< irep_idt > dynamic_initializationst
void typecheck_while(code_whilet &) override
bool find_dtor(const symbolt &symbol) const
std::vector< exprt > operandst
Definition: expr.h:57
void typecheck_expr_rel(binary_relation_exprt &) override
A side_effect_exprt representation of a function call side effect.
Definition: std_code.h:1691
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)
irep_idt function_identifier(const typet &type)
for function overloading
method_bodiest method_bodies
cpp_template_args_tct full_template_args
Pre-defined types.
bool subtype_typecast(const struct_typet &from, const struct_typet &to) const
void typecheck_expr_binary_arithmetic(exprt &) override
void typecheck_compound_type(struct_union_typet &) override
void typecheck_expr_sizeof(exprt &) override
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 for structs and unions.
Definition: std_types.h:114
bool builtin_factory(const irep_idt &)
void typecheck_expr_index(exprt &) override
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)
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:54
void get_virtual_bases(const struct_typet &type, std::list< irep_idt > &vbases) const
void convert_class_template_specialization(cpp_declarationt &declaration)
void typecheck_expr_side_effect(side_effect_exprt &) override
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
This should be used to mark dead code.
Definition: invariant.h:478
C++ Language Type Checking.
void typecheck_member_initializer(codet &)
const struct_typet & this_struct_type()
dynamic_initializationst dynamic_initializations
bool disable_access_control
A codet representing sequential composition of program statements.
Definition: std_code.h:150
void typecheck_compound_body(symbolt &symbol)
bool standard_conversion_array_to_pointer(const exprt &expr, exprt &new_expr) const
Array-to-pointer conversion.
void typecheck_function_call_arguments(side_effect_expr_function_callt &) override
codet representation of an if-then-else statement.
Definition: std_code.h:614
void move_member_initializers(irept &initializers, const code_typet &type, exprt &value)
void typecheck_ifthenelse(code_ifthenelset &) override
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)
Data structure for representing an arbitrary statement in a program.
Definition: std_code.h:34
void typecheck_member_function(const symbolt &compound_symbol, struct_typet::componentt &component, irept &initializers, const typet &method_qualifier, exprt &value)
std::list< method_bodyt > method_bodiest
void typecheck_expr_ptrmember(exprt &) override
void typecheck_expr_reference_to(exprt &)
An expression containing a side effect.
Definition: std_code.h:1560
bool implicit_conversion_sequence(const exprt &expr, const typet &type, exprt &new_expr, unsigned &rank)
implicit conversion sequence
std::vector< baset > basest
Definition: std_types.h:300
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_side_effect_function_call(side_effect_expr_function_callt &) override
std::string to_string(const typet &) override
message_handlert * message_handler
Definition: message.h:426
void convert_anon_struct_union_member(const cpp_declarationt &declaration, const irep_idt &access, struct_typet::componentst &components)
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)
void add_implicit_dereference(exprt &)
instantiation_levelt(instantiation_stackt &_instantiation_stack)
void typecheck_switch(code_switcht &) override
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:
void typecheck_try_catch(codet &)
bool standard_conversion_boolean(const exprt &expr, exprt &new_expr) const
Boolean conversion.
cpp_scopest cpp_scopes