CBMC
c_typecheck_base.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: ANSI-C Language Type Checking
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_ANSI_C_C_TYPECHECK_BASE_H
13 #define CPROVER_ANSI_C_C_TYPECHECK_BASE_H
14 
15 #include <util/namespace.h>
16 #include <util/std_code.h>
17 #include <util/symbol_table.h>
18 #include <util/typecheck.h>
19 
20 #include "designator.h"
21 
23 class c_bit_field_typet;
24 class shift_exprt;
25 
27  public typecheckt,
28  public namespacet
29 {
30 public:
32  symbol_tablet &_symbol_table,
33  const std::string &_module,
34  message_handlert &_message_handler):
35  typecheckt(_message_handler),
36  namespacet(_symbol_table),
37  symbol_table(_symbol_table),
38  module(_module),
39  mode(ID_C),
40  break_is_allowed(false),
41  continue_is_allowed(false),
42  case_is_allowed(false)
43  {
44  }
45 
47  symbol_tablet &_symbol_table1,
48  const symbol_tablet &_symbol_table2,
49  const std::string &_module,
50  message_handlert &_message_handler):
51  typecheckt(_message_handler),
52  namespacet(_symbol_table1, _symbol_table2),
53  symbol_table(_symbol_table1),
54  module(_module),
55  mode(ID_C),
56  break_is_allowed(false),
57  continue_is_allowed(false),
58  case_is_allowed(false)
59  {
60  }
61 
62  virtual ~c_typecheck_baset() { }
63 
64  virtual void typecheck()=0;
65  virtual void typecheck_expr(exprt &expr);
66 
67 protected:
70  const irep_idt mode;
72 
73  typedef std::unordered_map<irep_idt, typet> id_type_mapt;
75 
76  // overload to use language specific syntax
77  virtual std::string to_string(const exprt &expr);
78  virtual std::string to_string(const typet &type);
79 
80  //
81  // service functions
82  //
83 
84  virtual void do_initializer(
85  exprt &initializer,
86  const typet &type,
87  bool force_constant);
88 
89  virtual exprt do_initializer_rec(
90  const exprt &value,
91  const typet &type,
92  bool force_constant);
93 
94  virtual exprt do_initializer_list(
95  const exprt &value,
96  const typet &type,
97  bool force_constant);
98 
99  virtual exprt::operandst::const_iterator do_designated_initializer(
100  exprt &result,
101  designatort &designator,
102  const exprt &initializer_list,
103  exprt::operandst::const_iterator init_it,
104  bool force_constant);
105 
106  designatort make_designator(const typet &type, const exprt &src);
107  void designator_enter(const typet &type, designatort &designator); // go down
108  void increment_designator(designatort &designator);
109 
110  // typecasts
111 
113 
114  virtual void implicit_typecast(exprt &expr, const typet &type);
115  virtual void implicit_typecast_arithmetic(exprt &expr);
116  virtual void implicit_typecast_arithmetic(exprt &expr1, exprt &expr2);
117 
118  virtual void implicit_typecast_bool(exprt &expr)
119  {
120  implicit_typecast(expr, bool_typet());
121  }
122 
123  // code
124  virtual void start_typecheck_code();
125  virtual void typecheck_code(codet &code);
126 
127  virtual void typecheck_assign(codet &expr);
128  virtual void typecheck_asm(code_asmt &code);
129  virtual void typecheck_block(code_blockt &code);
130  virtual void typecheck_break(codet &code);
131  virtual void typecheck_continue(codet &code);
132  virtual void typecheck_decl(codet &code);
133  virtual void typecheck_expression(codet &code);
134  virtual void typecheck_for(codet &code);
135  virtual void typecheck_goto(code_gotot &code);
136  virtual void typecheck_ifthenelse(code_ifthenelset &code);
137  virtual void typecheck_label(code_labelt &code);
138  virtual void typecheck_switch_case(code_switch_caset &code);
139  virtual void typecheck_gcc_computed_goto(codet &code);
141  virtual void typecheck_gcc_local_label(codet &code);
142  virtual void typecheck_return(code_frontend_returnt &);
143  virtual void typecheck_switch(codet &code);
144  virtual void typecheck_while(code_whilet &code);
145  virtual void typecheck_dowhile(code_dowhilet &code);
146  virtual void typecheck_start_thread(codet &code);
147 
148  // contracts
149  virtual void
152  virtual void
153  check_history_expr_return_value(const exprt &expr, std::string &clause_type);
155  virtual void typecheck_spec_assigns(exprt::operandst &targets);
156  virtual void typecheck_conditional_targets(
157  exprt::operandst &targets,
158  const std::function<void(exprt &)> typecheck_target,
159  const std::string &clause_type);
160  virtual void typecheck_spec_condition(exprt &condition);
161  virtual void typecheck_spec_assigns_target(exprt &target);
162  virtual void typecheck_spec_loop_invariant(codet &code);
163  virtual void typecheck_spec_decreases(codet &code);
164  virtual void throw_on_side_effects(const exprt &expr);
165 
171 
172  // to check that all labels used are also defined
173  std::map<irep_idt, source_locationt> labels_defined, labels_used;
174 
175  // expressions
176  virtual void typecheck_expr_builtin_va_arg(exprt &expr);
177  virtual void typecheck_expr_builtin_offsetof(exprt &expr);
178  virtual void typecheck_expr_cw_va_arg_typeof(exprt &expr);
179  virtual void typecheck_expr_main(exprt &expr);
180  virtual void typecheck_expr_operands(exprt &expr);
181  virtual void typecheck_expr_comma(exprt &expr);
182  virtual void typecheck_expr_constant(exprt &expr);
183  virtual void typecheck_expr_side_effect(side_effect_exprt &expr);
184  virtual void typecheck_expr_unary_arithmetic(exprt &expr);
185  virtual void typecheck_expr_unary_boolean(exprt &expr);
186  virtual void typecheck_expr_binary_arithmetic(exprt &expr);
187  virtual void typecheck_expr_shifts(shift_exprt &expr);
188  virtual void typecheck_expr_pointer_arithmetic(exprt &expr);
189  virtual void typecheck_arithmetic_pointer(const exprt &expr);
190  virtual void typecheck_expr_binary_boolean(exprt &expr);
191  virtual void typecheck_expr_trinary(if_exprt &expr);
192  virtual void typecheck_expr_address_of(exprt &expr);
193  virtual void typecheck_expr_dereference(exprt &expr);
194  virtual void typecheck_expr_member(exprt &expr);
195  virtual void typecheck_expr_ptrmember(exprt &expr);
196  virtual void typecheck_expr_rel(binary_relation_exprt &expr);
197  virtual void typecheck_expr_rel_vector(binary_exprt &expr);
198  virtual void adjust_float_rel(binary_relation_exprt &);
199  static void add_rounding_mode(exprt &);
200  virtual void typecheck_expr_index(exprt &expr);
201  virtual void typecheck_expr_typecast(exprt &expr);
202  virtual void typecheck_expr_symbol(exprt &expr);
203  virtual void typecheck_expr_sizeof(exprt &expr);
204  virtual void typecheck_expr_alignof(exprt &expr);
205  virtual void typecheck_expr_function_identifier(exprt &expr);
207  side_effect_exprt &expr);
212  side_effect_exprt &expr);
218  const irep_idt &arith_op);
219  exprt
222  const irep_idt &identifier,
223  const exprt::operandst &arguments,
224  const source_locationt &source_location);
226  const irep_idt &identifier,
227  const symbol_exprt &function_symbol);
228  virtual exprt
231  const exprt &,
232  const irep_idt &,
233  const std::string &) const;
234 
235  virtual void make_index_type(exprt &expr);
236  virtual void make_constant(exprt &expr);
237  virtual void make_constant_index(exprt &expr);
238 
239  virtual bool gcc_types_compatible_p(const typet &, const typet &);
240 
241  // types
242  virtual void typecheck_type(typet &type);
243  virtual void typecheck_compound_type(struct_union_typet &type);
244  virtual void typecheck_compound_body(struct_union_typet &type);
245  virtual void typecheck_c_enum_type(typet &type);
246  virtual void typecheck_c_enum_tag_type(c_enum_tag_typet &type);
247  virtual void typecheck_code_type(code_typet &type);
248  virtual void typecheck_typedef_type(typet &type);
249  virtual void typecheck_c_bit_field_type(c_bit_field_typet &type);
250  virtual void typecheck_typeof_type(typet &type);
251  virtual void typecheck_array_type(array_typet &type);
252  virtual void typecheck_vector_type(typet &type);
253  virtual void typecheck_custom_type(typet &type);
254  virtual void adjust_function_parameter(typet &type) const;
255  virtual bool is_complete_type(const typet &type) const;
256 
258  const mp_integer &min, const mp_integer &max) const;
259 
261  const mp_integer &min,
262  const mp_integer &max,
263  bool is_packed) const;
264 
265  // this cleans expressions in array types
266  std::list<codet> clean_code;
267 
268  // symbol table management
269  void move_symbol(symbolt &symbol, symbolt *&new_symbol);
270  void move_symbol(symbolt &symbol)
271  { symbolt *new_symbol; move_symbol(symbol, new_symbol); }
272 
273  // top-level stuff
275  void typecheck_symbol(symbolt &symbol);
276  void typecheck_new_symbol(symbolt &symbol);
277  void typecheck_redefinition_type(symbolt &old_symbol, symbolt &new_symbol);
279  symbolt &old_symbol, symbolt &new_symbol);
280  void typecheck_function_body(symbolt &symbol);
281 
284 
285  virtual void do_initializer(symbolt &symbol);
286 
287  static bool is_numeric_type(const typet &src)
288  {
289  return src.id()==ID_complex ||
290  src.id()==ID_unsignedbv ||
291  src.id()==ID_signedbv ||
292  src.id()==ID_floatbv ||
293  src.id()==ID_fixedbv ||
294  src.id()==ID_c_bool ||
295  src.id()==ID_bool ||
296  src.id()==ID_c_enum_tag ||
297  src.id()==ID_c_bit_field ||
298  src.id()==ID_integer ||
299  src.id()==ID_real;
300  }
301 
302  typedef std::unordered_map<irep_idt, irep_idt> asm_label_mapt;
304 
305  void apply_asm_label(const irep_idt &asm_label, symbolt &symbol);
306 };
307 
309 {
310 public:
312  : expr_protectedt(ID_already_typechecked, typet{}, {std::move(expr)})
313  {
314  }
315 
316  static void make_already_typechecked(exprt &expr)
317  {
319  expr.swap(a);
320  }
321 
323  {
324  return op0();
325  }
326 };
327 
329 {
330 public:
332  : type_with_subtypet(ID_already_typechecked, std::move(type))
333  {
334  }
335 
336  static void make_already_typechecked(typet &type)
337  {
339  type.swap(a);
340  }
341 
343  {
344  return subtype();
345  }
346 };
347 
349 {
350  PRECONDITION(expr.id() == ID_already_typechecked);
351  PRECONDITION(expr.operands().size() == 1);
352 
353  return static_cast<already_typechecked_exprt &>(expr);
354 }
355 
357 {
358  PRECONDITION(type.id() == ID_already_typechecked);
359  PRECONDITION(type.has_subtype());
360 
361  return static_cast<already_typechecked_typet &>(type);
362 }
363 
364 #endif // CPROVER_ANSI_C_C_TYPECHECK_BASE_H
c_typecheck_baset::do_initializer
virtual void do_initializer(exprt &initializer, const typet &type, bool force_constant)
Definition: c_typecheck_initializer.cpp:26
c_typecheck_baset::typecheck_expr_side_effect
virtual void typecheck_expr_side_effect(side_effect_exprt &expr)
Definition: c_typecheck_expr.cpp:1836
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
c_typecheck_baset::typecheck_new_symbol
void typecheck_new_symbol(symbolt &symbol)
Definition: c_typecheck_base.cpp:143
c_typecheck_baset
Definition: c_typecheck_base.h:26
code_blockt
A codet representing sequential composition of program statements.
Definition: std_code.h:129
c_typecheck_baset::implicit_typecast_arithmetic
virtual void implicit_typecast_arithmetic(exprt &expr)
Definition: c_typecheck_typecast.cpp:68
symbol_tablet
The symbol table.
Definition: symbol_table.h:13
code_switch_caset
codet representation of a switch-case, i.e. a case statement within a switch.
Definition: std_code.h:1022
c_typecheck_baset::typecheck_vector_type
virtual void typecheck_vector_type(typet &type)
Definition: c_typecheck_type.cpp:667
c_typecheck_baset::do_designated_initializer
virtual exprt::operandst::const_iterator do_designated_initializer(exprt &result, designatort &designator, const exprt &initializer_list, exprt::operandst::const_iterator init_it, bool force_constant)
Definition: c_typecheck_initializer.cpp:348
c_typecheck_baset::gcc_vector_types_compatible
bool gcc_vector_types_compatible(const vector_typet &, const vector_typet &)
Definition: c_typecheck_expr.cpp:3775
mp_integer
BigInt mp_integer
Definition: smt_terms.h:17
c_typecheck_baset::typecheck_spec_loop_invariant
virtual void typecheck_spec_loop_invariant(codet &code)
Definition: c_typecheck_code.cpp:1110
c_typecheck_baset::typecheck_array_type
virtual void typecheck_array_type(array_typet &type)
Definition: c_typecheck_type.cpp:533
c_typecheck_baset::current_symbol
symbolt current_symbol
Definition: c_typecheck_base.h:71
code_whilet
codet representing a while statement.
Definition: std_code.h:609
c_typecheck_baset::typecheck_expr_builtin_offsetof
virtual void typecheck_expr_builtin_offsetof(exprt &expr)
Definition: c_typecheck_expr.cpp:574
c_typecheck_baset::typecheck_spec_condition
virtual void typecheck_spec_condition(exprt &condition)
Definition: c_typecheck_code.cpp:866
c_typecheck_baset::typecheck_expr_shifts
virtual void typecheck_expr_shifts(shift_exprt &expr)
Definition: c_typecheck_expr.cpp:3933
c_typecheck_baset::typecheck_while
virtual void typecheck_while(code_whilet &code)
Definition: c_typecheck_code.cpp:770
code_asmt
codet representation of an inline assembler statement.
Definition: std_code.h:1252
c_typecheck_baset::do_special_functions
virtual exprt do_special_functions(side_effect_expr_function_callt &expr)
Definition: c_typecheck_expr.cpp:2247
typet
The type of an expression, extends irept.
Definition: type.h:28
to_already_typechecked_expr
already_typechecked_exprt & to_already_typechecked_expr(exprt &expr)
Definition: c_typecheck_base.h:348
c_typecheck_baset::enum_constant_type
typet enum_constant_type(const mp_integer &min, const mp_integer &max) const
Definition: c_typecheck_type.cpp:1093
c_typecheck_baset::typecheck_declaration
void typecheck_declaration(ansi_c_declarationt &)
Definition: c_typecheck_base.cpp:704
c_typecheck_baset::typecheck_break
virtual void typecheck_break(codet &code)
Definition: c_typecheck_code.cpp:224
c_typecheck_baset::to_string
virtual std::string to_string(const exprt &expr)
Definition: c_typecheck_base.cpp:24
c_typecheck_baset::adjust_float_rel
virtual void adjust_float_rel(binary_relation_exprt &)
Definition: c_typecheck_expr.cpp:1313
typet::has_subtype
bool has_subtype() const
Definition: type.h:82
struct_union_typet
Base type for structs and unions.
Definition: std_types.h:61
side_effect_expr_function_callt
A side_effect_exprt representation of a function call side effect.
Definition: std_code.h:1691
if_exprt
The trinary if-then-else operator.
Definition: std_expr.h:2322
c_typecheck_baset::add_rounding_mode
static void add_rounding_mode(exprt &)
Definition: c_typecheck_expr.cpp:61
c_typecheck_baset::typecheck_function_call_arguments
virtual void typecheck_function_call_arguments(side_effect_expr_function_callt &expr)
Typecheck the parameters in a function call expression, and where necessary, make implicit casts arou...
Definition: c_typecheck_expr.cpp:3647
already_typechecked_typet
Definition: c_typecheck_base.h:328
c_typecheck_baset::typecheck_spec_assigns_target
virtual void typecheck_spec_assigns_target(exprt &target)
Definition: c_typecheck_code.cpp:974
c_typecheck_baset::disallow_subexpr_by_id
void disallow_subexpr_by_id(const exprt &, const irep_idt &, const std::string &) const
Definition: c_typecheck_expr.cpp:4428
c_typecheck_baset::typecheck_side_effect_statement_expression
virtual void typecheck_side_effect_statement_expression(side_effect_exprt &expr)
Definition: c_typecheck_expr.cpp:912
c_typecheck_baset::typecheck_expr_symbol
virtual void typecheck_expr_symbol(exprt &expr)
Definition: c_typecheck_expr.cpp:809
c_typecheck_baset::enum_underlying_type
bitvector_typet enum_underlying_type(const mp_integer &min, const mp_integer &max, bool is_packed) const
Definition: c_typecheck_type.cpp:1125
exprt
Base class for all expressions.
Definition: expr.h:55
c_typecheck_baset::typecheck_expr_pointer_arithmetic
virtual void typecheck_expr_pointer_arithmetic(exprt &expr)
Definition: c_typecheck_expr.cpp:4037
c_typecheck_baset::asm_label_mapt
std::unordered_map< irep_idt, irep_idt > asm_label_mapt
Definition: c_typecheck_base.h:302
binary_exprt
A base class for binary expressions.
Definition: std_expr.h:582
designatort
Definition: designator.h:20
c_typecheck_baset::typecheck_expr_address_of
virtual void typecheck_expr_address_of(exprt &expr)
Definition: c_typecheck_expr.cpp:1711
c_typecheck_baset::typecheck_expr_alignof
virtual void typecheck_expr_alignof(exprt &expr)
Definition: c_typecheck_expr.cpp:1045
exprt::op0
exprt & op0()
Definition: expr.h:125
vector_typet
The vector type.
Definition: std_types.h:1007
c_typecheck_baset::move_symbol
void move_symbol(symbolt &symbol, symbolt *&new_symbol)
Definition: c_typecheck_base.cpp:34
bool_typet
The Boolean type.
Definition: std_types.h:35
code_gcc_switch_case_ranget
codet representation of a switch-case, i.e. a case statement within a switch.
Definition: std_code.h:1096
c_typecheck_baset::typecheck_type
virtual void typecheck_type(typet &type)
Definition: c_typecheck_type.cpp:35
c_typecheck_baset::typecheck_side_effect_function_call
virtual void typecheck_side_effect_function_call(side_effect_expr_function_callt &expr)
Definition: c_typecheck_expr.cpp:1980
type_with_subtypet
Type with a single subtype.
Definition: type.h:164
c_typecheck_baset::typecheck_c_bit_field_type
virtual void typecheck_c_bit_field_type(c_bit_field_typet &type)
Definition: c_typecheck_type.cpp:1490
c_typecheck_baset::typecheck_expr_binary_arithmetic
virtual void typecheck_expr_binary_arithmetic(exprt &expr)
Definition: c_typecheck_expr.cpp:3804
symbol_exprt
Expression to hold a symbol (variable)
Definition: std_expr.h:112
namespace.h
c_typecheck_baset::typecheck_expr_binary_boolean
virtual void typecheck_expr_binary_boolean(exprt &expr)
Definition: c_typecheck_expr.cpp:4124
code_ifthenelset
codet representation of an if-then-else statement.
Definition: std_code.h:459
c_typecheck_baset::clean_code
std::list< codet > clean_code
Definition: c_typecheck_base.h:266
to_already_typechecked_type
already_typechecked_typet & to_already_typechecked_type(typet &type)
Definition: c_typecheck_base.h:356
c_typecheck_baset::make_constant
virtual void make_constant(exprt &expr)
Definition: c_typecheck_expr.cpp:4394
c_typecheck_baset::do_initializer_list
virtual exprt do_initializer_list(const exprt &value, const typet &type, bool force_constant)
Definition: c_typecheck_initializer.cpp:911
c_typecheck_baset::typecheck_expr_operands
virtual void typecheck_expr_operands(exprt &expr)
Definition: c_typecheck_expr.cpp:734
c_typecheck_baset::typecheck_typed_target_call
virtual void typecheck_typed_target_call(side_effect_expr_function_callt &expr)
Definition: c_typecheck_expr.cpp:1925
c_typecheck_baset::typecheck_redefinition_non_type
void typecheck_redefinition_non_type(symbolt &old_symbol, symbolt &new_symbol)
Definition: c_typecheck_base.cpp:303
c_typecheck_baset::typecheck_expr_member
virtual void typecheck_expr_member(exprt &expr)
Definition: c_typecheck_expr.cpp:1492
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
already_typechecked_exprt::already_typechecked_exprt
already_typechecked_exprt(exprt expr)
Definition: c_typecheck_base.h:311
c_typecheck_baset::typecheck_continue
virtual void typecheck_continue(codet &code)
Definition: c_typecheck_code.cpp:234
c_typecheck_baset::module
const irep_idt module
Definition: c_typecheck_base.h:69
c_typecheck_baset::asm_label_map
asm_label_mapt asm_label_map
Definition: c_typecheck_base.h:303
code_dowhilet
codet representation of a do while statement.
Definition: std_code.h:671
c_typecheck_baset::typecheck_expr_rel
virtual void typecheck_expr_rel(binary_relation_exprt &expr)
Definition: c_typecheck_expr.cpp:1325
messaget::result
mstreamt & result() const
Definition: message.h:409
c_typecheck_baset::typecheck_asm
virtual void typecheck_asm(code_asmt &code)
Definition: c_typecheck_code.cpp:155
c_typecheck_baset::typecheck_expr_unary_arithmetic
virtual void typecheck_expr_unary_arithmetic(exprt &expr)
Definition: c_typecheck_expr.cpp:3733
already_typechecked_exprt::make_already_typechecked
static void make_already_typechecked(exprt &expr)
Definition: c_typecheck_base.h:316
c_typecheck_baset::typecheck_function_body
void typecheck_function_body(symbolt &symbol)
Definition: c_typecheck_base.cpp:571
c_bit_field_typet
Type for C bit fields These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (...
Definition: c_types.h:19
c_typecheck_baset::implicit_typecast_bool
virtual void implicit_typecast_bool(exprt &expr)
Definition: c_typecheck_base.h:118
c_typecheck_baset::instantiate_gcc_polymorphic_builtin
virtual code_blockt instantiate_gcc_polymorphic_builtin(const irep_idt &identifier, const symbol_exprt &function_symbol)
Definition: c_typecheck_gcc_polymorphic_builtins.cpp:1228
c_typecheck_baset::typecheck_expr_function_identifier
virtual void typecheck_expr_function_identifier(exprt &expr)
Definition: c_typecheck_expr.cpp:1825
already_typechecked_exprt::get_expr
exprt & get_expr()
Definition: c_typecheck_base.h:322
c_typecheck_baset::typecheck_label
virtual void typecheck_label(code_labelt &code)
Definition: c_typecheck_code.cpp:510
c_typecheck_baset::typecheck_expr_dereference
virtual void typecheck_expr_dereference(exprt &expr)
Definition: c_typecheck_expr.cpp:1780
typecheck.h
code_gotot
codet representation of a goto statement.
Definition: std_code.h:840
c_typecheck_baset::move_symbol
void move_symbol(symbolt &symbol)
Definition: c_typecheck_base.h:270
code_labelt
codet representation of a label for branch targets.
Definition: std_code.h:958
PRECONDITION
#define PRECONDITION(CONDITION)
Definition: invariant.h:463
c_typecheck_baset::typecheck_symbol
void typecheck_symbol(symbolt &symbol)
Definition: c_typecheck_base.cpp:48
c_typecheck_baset::case_is_allowed
bool case_is_allowed
Definition: c_typecheck_base.h:168
c_typecheck_baset::continue_is_allowed
bool continue_is_allowed
Definition: c_typecheck_base.h:167
c_typecheck_baset::typecheck_saturating_arithmetic
exprt typecheck_saturating_arithmetic(const side_effect_expr_function_callt &expr)
Definition: c_typecheck_expr.cpp:3615
c_typecheck_baset::typecheck_spec_decreases
virtual void typecheck_spec_decreases(codet &code)
Definition: c_typecheck_code.cpp:1127
c_typecheck_baset::is_complete_type
virtual bool is_complete_type(const typet &type) const
Definition: c_typecheck_code.cpp:366
c_typecheck_baset::typecheck_c_enum_tag_type
virtual void typecheck_c_enum_tag_type(c_enum_tag_typet &type)
Definition: c_typecheck_type.cpp:1426
c_typecheck_baset::throw_on_side_effects
virtual void throw_on_side_effects(const exprt &expr)
Definition: c_typecheck_code.cpp:850
c_typecheck_baset::typecheck_expression
virtual void typecheck_expression(codet &code)
Definition: c_typecheck_code.cpp:398
c_typecheck_baset::typecheck_conditional_targets
virtual void typecheck_conditional_targets(exprt::operandst &targets, const std::function< void(exprt &)> typecheck_target, const std::string &clause_type)
Definition: c_typecheck_code.cpp:913
c_typecheck_baset::typecheck_expr_unary_boolean
virtual void typecheck_expr_unary_boolean(exprt &expr)
Definition: c_typecheck_expr.cpp:3763
c_typecheck_baset::typecheck_gcc_polymorphic_builtin
virtual optionalt< symbol_exprt > typecheck_gcc_polymorphic_builtin(const irep_idt &identifier, const exprt::operandst &arguments, const source_locationt &source_location)
Definition: c_typecheck_gcc_polymorphic_builtins.cpp:493
c_typecheck_baset::symbol_table
symbol_tablet & symbol_table
Definition: c_typecheck_base.h:68
c_typecheck_baset::gcc_types_compatible_p
virtual bool gcc_types_compatible_p(const typet &, const typet &)
Definition: c_typecheck_expr.cpp:96
already_typechecked_typet::already_typechecked_typet
already_typechecked_typet(typet type)
Definition: c_typecheck_base.h:331
c_typecheck_baset::typecheck_goto
virtual void typecheck_goto(code_gotot &code)
Definition: c_typecheck_code.cpp:584
c_typecheck_baset::typecheck_code
virtual void typecheck_code(codet &code)
Definition: c_typecheck_code.cpp:29
irept::swap
void swap(irept &irep)
Definition: irep.h:442
c_typecheck_baset::typecheck_side_effect_gcc_conditional_expression
virtual void typecheck_side_effect_gcc_conditional_expression(side_effect_exprt &expr)
Definition: c_typecheck_expr.cpp:1683
code_typet
Base type of functions.
Definition: std_types.h:538
c_typecheck_baset::typecheck_arithmetic_pointer
virtual void typecheck_arithmetic_pointer(const exprt &expr)
Definition: c_typecheck_expr.cpp:4004
c_typecheck_baset::make_constant_index
virtual void make_constant_index(exprt &expr)
Definition: c_typecheck_expr.cpp:4414
c_typecheck_baset::typecheck_shuffle_vector
virtual exprt typecheck_shuffle_vector(const side_effect_expr_function_callt &expr)
Definition: c_typecheck_gcc_polymorphic_builtins.cpp:1393
irept::id
const irep_idt & id() const
Definition: irep.h:396
message_handlert
Definition: message.h:27
c_typecheck_baset::typecheck_expr_trinary
virtual void typecheck_expr_trinary(if_exprt &expr)
Definition: c_typecheck_expr.cpp:1571
c_typecheck_baset::typecheck_typedef_type
virtual void typecheck_typedef_type(typet &type)
Definition: c_typecheck_type.cpp:1606
exprt::operandst
std::vector< exprt > operandst
Definition: expr.h:58
c_typecheck_baset::typecheck_typeof_type
virtual void typecheck_typeof_type(typet &type)
Definition: c_typecheck_type.cpp:1570
c_typecheck_baset::typecheck_redefinition_type
void typecheck_redefinition_type(symbolt &old_symbol, symbolt &new_symbol)
Definition: c_typecheck_base.cpp:173
c_typecheck_baset::typecheck_switch
virtual void typecheck_switch(codet &code)
Definition: c_typecheck_code.cpp:707
std_code.h
optionalt
nonstd::optional< T > optionalt
Definition: optional.h:35
c_typecheck_baset::typecheck_side_effect_assignment
virtual void typecheck_side_effect_assignment(side_effect_exprt &expr)
Definition: c_typecheck_expr.cpp:4138
c_typecheck_baset::parameter_map
id_type_mapt parameter_map
Definition: c_typecheck_base.h:74
c_typecheck_baset::typecheck_expr_rel_vector
virtual void typecheck_expr_rel_vector(binary_exprt &expr)
Definition: c_typecheck_expr.cpp:1427
c_typecheck_baset::typecheck_dowhile
virtual void typecheck_dowhile(code_dowhilet &code)
Definition: c_typecheck_code.cpp:810
c_typecheck_baset::designator_enter
void designator_enter(const typet &type, designatort &designator)
Definition: c_typecheck_initializer.cpp:256
already_typechecked_typet::get_type
typet & get_type()
Definition: c_typecheck_base.h:342
c_typecheck_baset::labels_used
std::map< irep_idt, source_locationt > labels_used
Definition: c_typecheck_base.h:173
c_typecheck_baset::typecheck_expr_ptrmember
virtual void typecheck_expr_ptrmember(exprt &expr)
Definition: c_typecheck_expr.cpp:1458
c_typecheck_baset::typecheck_expr
virtual void typecheck_expr(exprt &expr)
Definition: c_typecheck_expr.cpp:46
c_typecheck_baset::switch_op_type
typet switch_op_type
Definition: c_typecheck_base.h:169
code_frontend_returnt
codet representation of a "return from a function" statement.
Definition: std_code.h:892
source_locationt
Definition: source_location.h:18
c_typecheck_baset::break_is_allowed
bool break_is_allowed
Definition: c_typecheck_base.h:166
c_typecheck_baset::typecheck_for
virtual void typecheck_for(codet &code)
Definition: c_typecheck_code.cpp:412
shift_exprt
A base class for shift and rotate operators.
Definition: bitvector_expr.h:229
c_typecheck_baset::typecheck_spec_function_pointer_obeys_contract
virtual void typecheck_spec_function_pointer_obeys_contract(exprt &expr)
Definition: c_typecheck_code.cpp:1028
ansi_c_declarationt
Definition: ansi_c_declaration.h:71
c_typecheck_baset::c_typecheck_baset
c_typecheck_baset(symbol_tablet &_symbol_table, const std::string &_module, message_handlert &_message_handler)
Definition: c_typecheck_base.h:31
c_enum_tag_typet
C enum tag type, i.e., c_enum_typet with an identifier.
Definition: c_types.h:318
c_typecheck_baset::typecheck_decl
virtual void typecheck_decl(codet &code)
Definition: c_typecheck_code.cpp:244
c_typecheck_baset::do_initializer_rec
virtual exprt do_initializer_rec(const exprt &value, const typet &type, bool force_constant)
initialize something of type ‘type’ with given value ‘value’
Definition: c_typecheck_initializer.cpp:56
c_typecheck_baset::typecheck_gcc_switch_case_range
virtual void typecheck_gcc_switch_case_range(code_gcc_switch_case_ranget &)
Definition: c_typecheck_code.cpp:559
c_typecheck_baset::is_numeric_type
static bool is_numeric_type(const typet &src)
Definition: c_typecheck_base.h:287
array_typet
Arrays with given size.
Definition: std_types.h:762
c_typecheck_baset::typecheck_builtin_overflow
exprt typecheck_builtin_overflow(side_effect_expr_function_callt &expr, const irep_idt &arith_op)
Definition: c_typecheck_expr.cpp:3552
c_typecheck_baset::typecheck_expr_main
virtual void typecheck_expr_main(exprt &expr)
Definition: c_typecheck_expr.cpp:175
c_typecheck_baset::typecheck
virtual void typecheck()=0
bitvector_typet
Base class of fixed-width bit-vector types.
Definition: std_types.h:864
c_typecheck_baset::make_designator
designatort make_designator(const typet &type, const exprt &src)
Definition: c_typecheck_initializer.cpp:763
c_typecheck_baset::labels_defined
std::map< irep_idt, source_locationt > labels_defined
Definition: c_typecheck_base.h:173
symbolt
Symbol table entry.
Definition: symbol.h:27
c_typecheck_baset::add_parameters_to_symbol_table
void add_parameters_to_symbol_table(symbolt &symbol)
Create symbols for parameter of the code-typed symbol symbol.
Definition: c_typecheck_base.cpp:932
c_typecheck_baset::typecheck_expr_cw_va_arg_typeof
virtual void typecheck_expr_cw_va_arg_typeof(exprt &expr)
Definition: c_typecheck_expr.cpp:557
binary_relation_exprt
A base class for relations, i.e., binary predicates whose two operands have the same type.
Definition: std_expr.h:706
c_typecheck_baset::typecheck_assign
virtual void typecheck_assign(codet &expr)
Definition: c_typecheck_code.cpp:189
c_typecheck_baset::return_type
typet return_type
Definition: c_typecheck_base.h:170
c_typecheck_baset::typecheck_expr_constant
virtual void typecheck_expr_constant(exprt &expr)
Definition: c_typecheck_expr.cpp:3728
c_typecheck_baset::~c_typecheck_baset
virtual ~c_typecheck_baset()
Definition: c_typecheck_base.h:62
already_typechecked_exprt
Definition: c_typecheck_base.h:308
c_typecheck_baset::typecheck_custom_type
virtual void typecheck_custom_type(typet &type)
Definition: c_typecheck_type.cpp:333
c_typecheck_baset::typecheck_start_thread
virtual void typecheck_start_thread(codet &code)
Definition: c_typecheck_code.cpp:658
c_typecheck_baset::typecheck_return
virtual void typecheck_return(code_frontend_returnt &)
Definition: c_typecheck_code.cpp:670
type_with_subtypet::subtype
const typet & subtype() const
Definition: type.h:172
already_typechecked_typet::make_already_typechecked
static void make_already_typechecked(typet &type)
Definition: c_typecheck_base.h:336
c_typecheck_baset::typecheck_ifthenelse
virtual void typecheck_ifthenelse(code_ifthenelset &code)
Definition: c_typecheck_code.cpp:613
c_typecheck_baset::check_history_expr_return_value
virtual void check_history_expr_return_value(const exprt &expr, std::string &clause_type)
Checks that no history expr or return_value exists in expr.
Definition: c_typecheck_base.cpp:677
c_typecheck_baset::typecheck_spec_assigns
virtual void typecheck_spec_assigns(exprt::operandst &targets)
Definition: c_typecheck_code.cpp:966
c_typecheck_baset::typecheck_c_enum_type
virtual void typecheck_c_enum_type(typet &type)
Definition: c_typecheck_type.cpp:1183
c_typecheck_baset::increment_designator
void increment_designator(designatort &designator)
Definition: c_typecheck_initializer.cpp:709
exprt::operands
operandst & operands()
Definition: expr.h:94
c_typecheck_baset::start_typecheck_code
virtual void start_typecheck_code()
Definition: c_typecheck_code.cpp:24
c_typecheck_baset::typecheck_switch_case
virtual void typecheck_switch_case(code_switch_caset &code)
Definition: c_typecheck_code.cpp:523
c_typecheck_baset::typecheck_compound_type
virtual void typecheck_compound_type(struct_union_typet &type)
Definition: c_typecheck_type.cpp:763
typecheckt
Definition: typecheck.h:15
c_typecheck_baset::typecheck_gcc_computed_goto
virtual void typecheck_gcc_computed_goto(codet &code)
Definition: c_typecheck_code.cpp:590
symbol_table.h
Author: Diffblue Ltd.
designator.h
c_typecheck_baset::typecheck_code_type
virtual void typecheck_code_type(code_typet &type)
Definition: c_typecheck_type.cpp:435
c_typecheck_baset::typecheck_expr_sizeof
virtual void typecheck_expr_sizeof(exprt &expr)
Definition: c_typecheck_expr.cpp:945
c_typecheck_baset::mode
const irep_idt mode
Definition: c_typecheck_base.h:70
c_typecheck_baset::typecheck_gcc_local_label
virtual void typecheck_gcc_local_label(codet &code)
Definition: c_typecheck_code.cpp:578
c_typecheck_baset::id_type_mapt
std::unordered_map< irep_idt, typet > id_type_mapt
Definition: c_typecheck_base.h:73
c_typecheck_baset::c_typecheck_baset
c_typecheck_baset(symbol_tablet &_symbol_table1, const symbol_tablet &_symbol_table2, const std::string &_module, message_handlert &_message_handler)
Definition: c_typecheck_base.h:46
c_typecheck_baset::apply_asm_label
void apply_asm_label(const irep_idt &asm_label, symbolt &symbol)
Definition: c_typecheck_base.cpp:612
side_effect_exprt
An expression containing a side effect.
Definition: std_code.h:1449
c_typecheck_baset::typecheck_compound_body
virtual void typecheck_compound_body(struct_union_typet &type)
Definition: c_typecheck_type.cpp:903
c_typecheck_baset::typecheck_expr_index
virtual void typecheck_expr_index(exprt &expr)
Definition: c_typecheck_expr.cpp:1255
expr_protectedt
Base class for all expressions.
Definition: expr.h:323
c_typecheck_baset::make_index_type
virtual void make_index_type(exprt &expr)
Definition: c_typecheck_expr.cpp:1250
c_typecheck_baset::typecheck_block
virtual void typecheck_block(code_blockt &code)
Definition: c_typecheck_code.cpp:205
c_typecheck_baset::typecheck_expr_builtin_va_arg
virtual void typecheck_expr_builtin_va_arg(exprt &expr)
Definition: c_typecheck_expr.cpp:516
c_typecheck_baset::implicit_typecast
virtual void implicit_typecast(exprt &expr, const typet &type)
Definition: c_typecheck_typecast.cpp:13
c_typecheck_baset::adjust_function_parameter
virtual void adjust_function_parameter(typet &type) const
Definition: c_typecheck_type.cpp:1655
codet
Data structure for representing an arbitrary statement in a program.
Definition: std_code_base.h:28
c_typecheck_baset::typecheck_expr_comma
virtual void typecheck_expr_comma(exprt &expr)
Definition: c_typecheck_expr.cpp:507
c_typecheck_baset::typecheck_expr_typecast
virtual void typecheck_expr_typecast(exprt &expr)
Definition: c_typecheck_expr.cpp:1067