CBMC
ansi_c_entry_point.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 #include "ansi_c_entry_point.h"
10 
11 #include <util/arith_tools.h>
12 #include <util/c_types.h>
13 #include <util/config.h>
14 #include <util/message.h>
15 #include <util/pointer_expr.h>
16 #include <util/range.h>
17 #include <util/symbol_table.h>
18 
20 
22 
24 #include "expr2c.h"
25 
27  const code_typet::parameterst &parameters,
28  code_blockt &init_code,
29  symbol_tablet &symbol_table,
30  const c_object_factory_parameterst &object_factory_parameters)
31 {
32  exprt::operandst main_arguments;
33  main_arguments.resize(parameters.size());
34 
35  for(std::size_t param_number=0;
36  param_number<parameters.size();
37  param_number++)
38  {
39  const code_typet::parametert &p=parameters[param_number];
40  const irep_idt base_name=p.get_base_name().empty()?
41  ("argument#"+std::to_string(param_number)):p.get_base_name();
42 
43  main_arguments[param_number] = c_nondet_symbol_factory(
44  init_code,
45  symbol_table,
46  base_name,
47  p.type(),
48  p.source_location(),
49  object_factory_parameters,
51  }
52 
53  return main_arguments;
54 }
55 
57  const symbolt &function,
58  code_blockt &init_code,
59  symbol_tablet &symbol_table)
60 {
61  bool has_return_value =
62  to_code_type(function.type).return_type() != void_type();
63 
64  if(has_return_value)
65  {
66  const symbolt &return_symbol = symbol_table.lookup_ref("return'");
67 
68  // record return value
69  init_code.add(code_outputt{
70  return_symbol.base_name, return_symbol.symbol_expr(), function.location});
71  }
72 
73  #if 0
74  std::size_t i=0;
75 
76  for(const auto &p : parameters)
77  {
78  if(p.get_identifier().empty())
79  continue;
80 
81  irep_idt identifier=p.get_identifier();
82 
83  const symbolt &symbol=symbol_table.lookup(identifier);
84 
85  if(symbol.type.id()==ID_pointer)
86  {
87  codet output(ID_output);
88  output.operands().resize(2);
89 
90  output.op0()=
94  from_integer(0, index_type())));
95  output.op1()=symbol.symbol_expr();
96  output.add_source_location()=p.source_location();
97 
98  init_code.add(std::move(output));
99  }
100 
101  i++;
102  }
103  #endif
104 }
105 
107  symbol_tablet &symbol_table,
108  message_handlert &message_handler,
109  const c_object_factory_parameterst &object_factory_parameters)
110 {
111  // check if entry point is already there
112  if(symbol_table.symbols.find(goto_functionst::entry_point())!=
113  symbol_table.symbols.end())
114  return false; // silently ignore
115 
116  irep_idt main_symbol;
117 
118  // find main symbol, if any is given
119  if(config.main.has_value())
120  {
121  std::list<irep_idt> matches;
122 
123  for(const auto &symbol_name_entry :
124  equal_range(symbol_table.symbol_base_map, config.main.value()))
125  {
126  // look it up
127  symbol_tablet::symbolst::const_iterator s_it =
128  symbol_table.symbols.find(symbol_name_entry.second);
129 
130  if(s_it==symbol_table.symbols.end())
131  continue;
132 
133  if(s_it->second.type.id() == ID_code && !s_it->second.is_property)
134  matches.push_back(symbol_name_entry.second);
135  }
136 
137  if(matches.empty())
138  {
139  messaget message(message_handler);
140  message.error() << "main symbol '" << config.main.value() << "' not found"
141  << messaget::eom;
142  return true; // give up
143  }
144 
145  if(matches.size()>=2)
146  {
147  messaget message(message_handler);
148  message.error() << "main symbol '" << config.main.value()
149  << "' is ambiguous" << messaget::eom;
150  return true;
151  }
152 
153  main_symbol=matches.front();
154  }
155  else
156  main_symbol=ID_main;
157 
158  // look it up
159  symbol_tablet::symbolst::const_iterator s_it=
160  symbol_table.symbols.find(main_symbol);
161 
162  if(s_it==symbol_table.symbols.end())
163  return false; // give up silently
164 
165  const symbolt &symbol=s_it->second;
166 
167  // check if it has a body
168  if(symbol.value.is_nil())
169  {
170  messaget message(message_handler);
171  message.error() << "main symbol '" << id2string(main_symbol)
172  << "' has no body" << messaget::eom;
173  return false; // give up
174  }
175 
176  static_lifetime_init(symbol_table, symbol.location);
177 
179  symbol, symbol_table, message_handler, object_factory_parameters);
180 }
181 
192  const symbolt &symbol,
193  symbol_tablet &symbol_table,
194  message_handlert &message_handler,
195  const c_object_factory_parameterst &object_factory_parameters)
196 {
197  PRECONDITION(!symbol.value.is_nil());
198  code_blockt init_code;
199 
200  // add 'HIDE' label
201  init_code.add(code_labelt(CPROVER_PREFIX "HIDE", code_skipt()));
202 
203  // build call to initialization function
204 
205  {
206  symbol_tablet::symbolst::const_iterator init_it=
207  symbol_table.symbols.find(INITIALIZE_FUNCTION);
208 
209  if(init_it==symbol_table.symbols.end())
210  {
211  messaget message(message_handler);
212  message.error() << "failed to find " INITIALIZE_FUNCTION " symbol"
213  << messaget::eom;
214  return true;
215  }
216 
217  code_function_callt call_init(init_it->second.symbol_expr());
218  call_init.add_source_location()=symbol.location;
219 
220  init_code.add(std::move(call_init));
221  }
222 
223  // build call to main function
224 
225  code_function_callt call_main(symbol.symbol_expr());
226  call_main.add_source_location()=symbol.location;
227  call_main.function().add_source_location()=symbol.location;
228 
229  if(to_code_type(symbol.type).return_type() != void_type())
230  {
231  auxiliary_symbolt return_symbol;
232  return_symbol.mode=ID_C;
233  return_symbol.is_static_lifetime=false;
234  return_symbol.name="return'";
235  return_symbol.base_name = "return'";
236  return_symbol.type=to_code_type(symbol.type).return_type();
237 
238  symbol_table.add(return_symbol);
239  call_main.lhs()=return_symbol.symbol_expr();
240  }
241 
242  const code_typet::parameterst &parameters=
243  to_code_type(symbol.type).parameters();
244 
245  if(symbol.name==ID_main)
246  {
247  if(parameters.empty())
248  {
249  // ok
250  }
251  // The C standard (and any related architecture descriptions) enforces an
252  // order of parameters. The user, however, may supply arbitrary
253  // (syntactically valid) C code, even one that does not respect the calling
254  // conventions set out in the C standard. If the user does supply such code,
255  // then we can only tell them that they got it wrong, which is what we do
256  // via the error message in the else branch of this code.
257  else if(
258  parameters.size() >= 2 && parameters[1].type().id() == ID_pointer &&
259  (parameters.size() == 2 ||
260  (parameters.size() == 3 && parameters[2].type().id() == ID_pointer)))
261  {
262  namespacet ns(symbol_table);
263 
264  {
265  symbolt argc_symbol;
266 
267  argc_symbol.base_name = "argc'";
268  argc_symbol.name = "argc'";
269  argc_symbol.type = signed_int_type();
270  argc_symbol.is_static_lifetime = true;
271  argc_symbol.is_lvalue = true;
272  argc_symbol.mode = ID_C;
273 
274  auto r = symbol_table.insert(argc_symbol);
275  if(!r.second && r.first != argc_symbol)
276  {
277  messaget message(message_handler);
278  message.error() << "argc already exists but is not usable"
279  << messaget::eom;
280  return true;
281  }
282  }
283 
284  const symbolt &argc_symbol = ns.lookup("argc'");
285 
286  {
287  // we make the type of this thing an array of pointers
288  // need to add one to the size -- the array is terminated
289  // with NULL
290  const exprt one_expr = from_integer(1, argc_symbol.type);
291  const plus_exprt size_expr(argc_symbol.symbol_expr(), one_expr);
292  const array_typet argv_type(pointer_type(char_type()), size_expr);
293 
294  symbolt argv_symbol;
295 
296  argv_symbol.base_name = "argv'";
297  argv_symbol.name = "argv'";
298  argv_symbol.type = argv_type;
299  argv_symbol.is_static_lifetime = true;
300  argv_symbol.is_lvalue = true;
301  argv_symbol.mode = ID_C;
302 
303  auto r = symbol_table.insert(argv_symbol);
304  if(!r.second && r.first != argv_symbol)
305  {
306  messaget message(message_handler);
307  message.error() << "argv already exists but is not usable"
308  << messaget::eom;
309  return true;
310  }
311  }
312 
313  const symbolt &argv_symbol=ns.lookup("argv'");
314  const array_typet &argv_array_type = to_array_type(argv_symbol.type);
315 
316  {
317  // Assume argc is at least zero. Note that we don't assume it's
318  // at least one, since this isn't guaranteed, as exemplified by
319  // https://www.qualys.com/2022/01/25/cve-2021-4034/pwnkit.txt
320  // The C standard only guarantees "The value of argc shall be
321  // nonnegative." and "argv[argc] shall be a null pointer."
322  exprt zero = from_integer(0, argc_symbol.type);
323 
325  argc_symbol.symbol_expr(), ID_ge, std::move(zero));
326 
327  init_code.add(code_assumet(std::move(ge)));
328  }
329 
330  if(config.ansi_c.max_argc.has_value())
331  {
332  exprt bound_expr =
333  from_integer(*config.ansi_c.max_argc, argc_symbol.type);
334 
336  argc_symbol.symbol_expr(), ID_le, std::move(bound_expr));
337 
338  init_code.add(code_assumet(std::move(le)));
339  }
340 
341  // record argc as an input
342  init_code.add(code_inputt{"argc", argc_symbol.symbol_expr()});
343 
344  if(parameters.size()==3)
345  {
346  {
347  symbolt envp_size_symbol;
348  envp_size_symbol.base_name = "envp_size'";
349  envp_size_symbol.name = "envp_size'";
350  envp_size_symbol.type = size_type();
351  envp_size_symbol.is_static_lifetime = true;
352  envp_size_symbol.mode = ID_C;
353 
354  if(!symbol_table.insert(std::move(envp_size_symbol)).second)
355  {
356  messaget message(message_handler);
357  message.error()
358  << "failed to insert envp_size symbol" << messaget::eom;
359  return true;
360  }
361  }
362 
363  const symbolt &envp_size_symbol=ns.lookup("envp_size'");
364 
365  {
366  symbolt envp_symbol;
367  envp_symbol.base_name = "envp'";
368  envp_symbol.name = "envp'";
369  envp_symbol.type = array_typet(
370  pointer_type(char_type()), envp_size_symbol.symbol_expr());
371  envp_symbol.is_static_lifetime = true;
372  envp_symbol.mode = ID_C;
373 
374  if(!symbol_table.insert(std::move(envp_symbol)).second)
375  {
376  messaget message(message_handler);
377  message.error() << "failed to insert envp symbol" << messaget::eom;
378  return true;
379  }
380  }
381 
382  // assume envp_size is INTMAX-1
383  const mp_integer max =
384  to_integer_bitvector_type(envp_size_symbol.type).largest();
385 
386  exprt max_minus_one=from_integer(max-1, envp_size_symbol.type);
387 
389  envp_size_symbol.symbol_expr(), ID_le, std::move(max_minus_one));
390 
391  init_code.add(code_assumet(le));
392  }
393 
394  {
395  /* zero_string doesn't work yet */
396 
397  /*
398  exprt zero_string(ID_zero_string, array_typet());
399  zero_string.type().subtype()=char_type();
400  zero_string.type().set(ID_size, "infinity");
401  const index_exprt index(zero_string, from_integer(0, uint_type()));
402  exprt address_of =
403  typecast_exprt::conditional_cast(
404  address_of_exprt(index, pointer_type(char_type())),
405  argv_symbol.type.subtype());
406 
407  // assign argv[*] to the address of a string-object
408  array_of_exprt array_of(address_of, argv_symbol.type);
409 
410  init_code.copy_to_operands(
411  code_assignt(argv_symbol.symbol_expr(), array_of));
412  */
413  }
414 
415  {
416  // assign argv[argc] to NULL
417  const null_pointer_exprt null(
418  to_pointer_type(argv_array_type.element_type()));
419 
420  index_exprt index_expr(
421  argv_symbol.symbol_expr(),
423  argc_symbol.symbol_expr(), argv_array_type.index_type()));
424 
425  init_code.add(code_frontend_assignt(index_expr, null));
426  // disable bounds check on that one
427  init_code.statements().back().add_source_location().add_pragma(
428  "disable:bounds-check");
429  }
430 
431  if(parameters.size()==3)
432  {
433  const symbolt &envp_symbol=ns.lookup("envp'");
434  const array_typet &envp_array_type = to_array_type(envp_symbol.type);
435  const symbolt &envp_size_symbol=ns.lookup("envp_size'");
436 
437  // assume envp[envp_size] is NULL
438  null_pointer_exprt null(
439  to_pointer_type(envp_array_type.element_type()));
440 
441  index_exprt index_expr(
442  envp_symbol.symbol_expr(),
444  envp_size_symbol.symbol_expr(), envp_array_type.index_type()));
445 
446  equal_exprt is_null(std::move(index_expr), std::move(null));
447 
448  init_code.add(code_assumet(is_null));
449  // disable bounds check on that one
450  init_code.statements().back().add_source_location().add_pragma(
451  "disable:bounds-check");
452  }
453 
454  {
455  exprt::operandst &operands=call_main.arguments();
456 
457  if(parameters.size()==3)
458  operands.resize(3);
459  else
460  operands.resize(2);
461 
462  exprt &op0=operands[0];
463  exprt &op1=operands[1];
464 
466  argc_symbol.symbol_expr(), parameters[0].type());
467 
468  {
469  index_exprt index_expr(
470  argv_symbol.symbol_expr(),
471  from_integer(0, argv_array_type.index_type()));
472  // disable bounds check on that one
473  index_expr.add_source_location().add_pragma("disable:bounds-check");
474 
475  const pointer_typet &pointer_type =
476  to_pointer_type(parameters[1].type());
477 
479  address_of_exprt(index_expr), pointer_type);
480  }
481 
482  // do we need envp?
483  if(parameters.size()==3)
484  {
485  const symbolt &envp_symbol=ns.lookup("envp'");
486  const array_typet &envp_array_type = to_array_type(envp_symbol.type);
487 
488  index_exprt index_expr(
489  envp_symbol.symbol_expr(),
490  from_integer(0, envp_array_type.index_type()));
491 
492  const pointer_typet &pointer_type =
493  to_pointer_type(parameters[2].type());
494 
495  operands[2] = typecast_exprt::conditional_cast(
496  address_of_exprt(index_expr), pointer_type);
497  }
498  }
499  }
500  else
501  {
502  const namespacet ns{symbol_table};
503  const std::string main_signature = type2c(symbol.type, ns);
504  messaget message(message_handler);
505  message.error().source_location = symbol.location;
506  message.error() << "'main' with signature '" << main_signature
507  << "' found,"
508  << " but expecting one of:\n"
509  << " int main(void)\n"
510  << " int main(int argc, char *argv[])\n"
511  << " int main(int argc, char *argv[], char *envp[])\n"
512  << "If this is a non-standard main entry point please "
513  "provide a custom\n"
514  << "entry function and use --function instead"
515  << messaget::eom;
516  return true;
517  }
518  }
519  else
520  {
521  // produce nondet arguments
523  parameters, init_code, symbol_table, object_factory_parameters);
524  }
525 
526  init_code.add(std::move(call_main));
527 
528  // TODO: add read/modified (recursively in call graph) globals as INPUT/OUTPUT
529 
530  record_function_outputs(symbol, init_code, symbol_table);
531 
532  // now call destructor functions (a GCC extension)
533 
534  for(const auto &symbol_table_entry : symbol_table.symbols)
535  {
536  const symbolt &symbol = symbol_table_entry.second;
537 
538  if(symbol.type.id() != ID_code)
539  continue;
540 
541  const code_typet &code_type = to_code_type(symbol.type);
542  if(
543  code_type.return_type().id() == ID_destructor &&
544  code_type.parameters().empty())
545  {
546  code_function_callt destructor_call(symbol.symbol_expr());
547  destructor_call.add_source_location() = symbol.location;
548  init_code.add(std::move(destructor_call));
549  }
550  }
551 
552  // add the entry point symbol
553  symbolt new_symbol;
554 
555  new_symbol.name=goto_functionst::entry_point();
557  new_symbol.type = code_typet({}, void_type());
558  new_symbol.value.swap(init_code);
559  new_symbol.mode=symbol.mode;
560 
561  if(!symbol_table.insert(std::move(new_symbol)).second)
562  {
563  messaget message(message_handler);
564  message.error() << "failed to insert main symbol" << messaget::eom;
565  return true;
566  }
567 
568  return false;
569 }
c_nondet_symbol_factory.h
messaget
Class that provides messages with a built-in verbosity 'level'.
Definition: message.h:154
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
code_blockt
A codet representing sequential composition of program statements.
Definition: std_code.h:129
typecast_exprt::conditional_cast
static exprt conditional_cast(const exprt &expr, const typet &type)
Definition: std_expr.h:2025
symbol_tablet
The symbol table.
Definition: symbol_table.h:13
symbol_table_baset::lookup_ref
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
Definition: symbol_table_base.h:104
mp_integer
BigInt mp_integer
Definition: smt_terms.h:17
arith_tools.h
symbol_table_baset::symbol_base_map
const symbol_base_mapt & symbol_base_map
Read-only field, used to look up symbol names given their base names.
Definition: symbol_table_base.h:33
codet::op0
exprt & op0()
Definition: expr.h:125
lifetimet::AUTOMATIC_LOCAL
@ AUTOMATIC_LOCAL
Allocate local objects with automatic lifetime.
ansi_c_entry_point.h
code_typet::parameterst
std::vector< parametert > parameterst
Definition: std_types.h:541
symbolt::type
typet type
Type of symbol.
Definition: symbol.h:31
to_integer_bitvector_type
const integer_bitvector_typet & to_integer_bitvector_type(const typet &type)
Cast a typet to an integer_bitvector_typet.
Definition: bitvector_types.h:142
configt::main
optionalt< std::string > main
Definition: config.h:341
source_locationt::add_pragma
void add_pragma(const irep_idt &pragma)
Definition: source_location.h:184
plus_exprt
The plus expression Associativity is not specified.
Definition: std_expr.h:946
c_nondet_symbol_factory
symbol_exprt c_nondet_symbol_factory(code_blockt &init_code, symbol_tablet &symbol_table, const irep_idt base_name, const typet &type, const source_locationt &loc, const c_object_factory_parameterst &object_factory_parameters, const lifetimet lifetime)
Creates a symbol and generates code so that it can vary over all possible values for its type.
Definition: c_nondet_symbol_factory.cpp:202
exprt
Base class for all expressions.
Definition: expr.h:55
symbolt::base_name
irep_idt base_name
Base (non-scoped) name.
Definition: symbol.h:46
build_function_environment
exprt::operandst build_function_environment(const code_typet::parameterst &parameters, code_blockt &init_code, symbol_tablet &symbol_table, const c_object_factory_parameterst &object_factory_parameters)
Definition: ansi_c_entry_point.cpp:26
to_string
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
Definition: string_constraint.cpp:58
messaget::eom
static eomt eom
Definition: message.h:297
auxiliary_symbolt
Internally generated symbol table entry.
Definition: symbol.h:146
configt::ansi_c
struct configt::ansi_ct ansi_c
string_constantt
Definition: string_constant.h:14
index_type
bitvector_typet index_type()
Definition: c_types.cpp:22
equal_exprt
Equality.
Definition: std_expr.h:1305
void_type
empty_typet void_type()
Definition: c_types.cpp:263
record_function_outputs
void record_function_outputs(const symbolt &function, code_blockt &init_code, symbol_tablet &symbol_table)
Definition: ansi_c_entry_point.cpp:56
code_function_callt::lhs
exprt & lhs()
Definition: goto_instruction_code.h:297
code_blockt::statements
code_operandst & statements()
Definition: std_code.h:138
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
code_outputt
A goto_instruction_codet representing the declaration that an output of a particular description has ...
Definition: goto_instruction_code.h:454
exprt::type
typet & type()
Return the type of the expression.
Definition: expr.h:84
namespacet::lookup
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
Definition: namespace.cpp:138
code_function_callt
goto_instruction_codet representation of a function call statement.
Definition: goto_instruction_code.h:271
to_code_type
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
Definition: std_types.h:744
symbolt::mode
irep_idt mode
Language mode.
Definition: symbol.h:49
messaget::error
mstreamt & error() const
Definition: message.h:399
code_typet::parametert::get_base_name
const irep_idt & get_base_name() const
Definition: std_types.h:595
signed_int_type
signedbv_typet signed_int_type()
Definition: c_types.cpp:40
c_object_factory_parameterst
Definition: c_object_factory_parameters.h:14
null_pointer_exprt
The null pointer constant.
Definition: pointer_expr.h:734
id2string
const std::string & id2string(const irep_idt &d)
Definition: irep.h:47
messaget::mstreamt::source_location
source_locationt source_location
Definition: message.h:247
expr2c.h
code_labelt
codet representation of a label for branch targets.
Definition: std_code.h:958
PRECONDITION
#define PRECONDITION(CONDITION)
Definition: invariant.h:463
code_assumet
An assumption, which must hold in subsequent code.
Definition: std_code.h:216
symbolt::symbol_expr
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
Definition: symbol.cpp:121
pointer_expr.h
INITIALIZE_FUNCTION
#define INITIALIZE_FUNCTION
Definition: static_lifetime_init.h:22
configt::ansi_ct::max_argc
optionalt< mp_integer > max_argc
Maximum value of argc, which is operating-systems dependent: Windows limits the number of characters ...
Definition: config.h:280
to_pointer_type
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
Definition: pointer_expr.h:79
symbol_tablet::insert
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.
Definition: symbol_table.cpp:17
pointer_type
pointer_typet pointer_type(const typet &subtype)
Definition: c_types.cpp:253
code_frontend_assignt
A codet representing an assignment in the program.
Definition: std_code.h:23
irept::swap
void swap(irept &irep)
Definition: irep.h:442
code_typet
Base type of functions.
Definition: std_types.h:538
irept::is_nil
bool is_nil() const
Definition: irep.h:376
irept::id
const irep_idt & id() const
Definition: irep.h:396
message_handlert
Definition: message.h:27
range.h
exprt::operandst
std::vector< exprt > operandst
Definition: expr.h:58
dstringt::empty
bool empty() const
Definition: dstring.h:88
code_blockt::add
void add(const codet &code)
Definition: std_code.h:168
generate_ansi_c_start_function
bool generate_ansi_c_start_function(const symbolt &symbol, symbol_tablet &symbol_table, message_handlert &message_handler, const c_object_factory_parameterst &object_factory_parameters)
Generate a _start function for a specific function.
Definition: ansi_c_entry_point.cpp:191
code_typet::parameters
const parameterst & parameters() const
Definition: std_types.h:655
ansi_c_entry_point
bool ansi_c_entry_point(symbol_tablet &symbol_table, message_handlert &message_handler, const c_object_factory_parameterst &object_factory_parameters)
Definition: ansi_c_entry_point.cpp:106
code_function_callt::arguments
argumentst & arguments()
Definition: goto_instruction_code.h:317
config
configt config
Definition: config.cpp:25
char_type
bitvector_typet char_type()
Definition: c_types.cpp:124
symbol_table_baset::add
bool add(const symbolt &symbol)
Add a new symbol to the symbol table.
Definition: symbol_table_base.cpp:18
symbolt::value
exprt value
Initial value of symbol.
Definition: symbol.h:34
array_typet
Arrays with given size.
Definition: std_types.h:762
code_skipt
A codet representing a skip statement.
Definition: std_code.h:321
is_null
static exprt is_null(const array_string_exprt &string, array_poolt &array_pool)
Expression which is true when the string is equal to the literal "null".
Definition: string_format_builtin_function.cpp:94
symbolt::location
source_locationt location
Source code location of definition of symbol.
Definition: symbol.h:37
code_inputt
A goto_instruction_codet representing the declaration that an input of a particular description has a...
Definition: goto_instruction_code.h:407
symbolt
Symbol table entry.
Definition: symbol.h:27
from_integer
constant_exprt from_integer(const mp_integer &int_value, const typet &type)
Definition: arith_tools.cpp:100
static_lifetime_init
static optionalt< codet > static_lifetime_init(const irep_idt &identifier, symbol_tablet &symbol_table)
Definition: static_lifetime_init.cpp:22
symbol_table_baset::symbols
const symbolst & symbols
Read-only field, used to look up symbols given their names.
Definition: symbol_table_base.h:30
binary_relation_exprt
A base class for relations, i.e., binary predicates whose two operands have the same type.
Definition: std_expr.h:706
CPROVER_PREFIX
#define CPROVER_PREFIX
Definition: cprover_prefix.h:14
to_array_type
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
Definition: std_types.h:844
code_typet::parametert
Definition: std_types.h:555
symbolt::is_static_lifetime
bool is_static_lifetime
Definition: symbol.h:65
goto_functions.h
config.h
integer_bitvector_typet::largest
mp_integer largest() const
Return the largest value that can be represented using this type.
Definition: bitvector_types.cpp:38
symbol_table_baset::lookup
const symbolt * lookup(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
Definition: symbol_table_base.h:95
code_typet::return_type
const typet & return_type() const
Definition: std_types.h:645
exprt::operands
operandst & operands()
Definition: expr.h:94
r
static int8_t r
Definition: irep_hash.h:60
symbolt::is_lvalue
bool is_lvalue
Definition: symbol.h:66
type2c
std::string type2c(const typet &type, const namespacet &ns, const expr2c_configurationt &configuration)
Definition: expr2c.cpp:4062
goto_functionst::entry_point
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
Definition: goto_functions.h:92
codet::op1
exprt & op1()
Definition: expr.h:128
index_exprt
Array index operator.
Definition: std_expr.h:1409
static_lifetime_init.h
address_of_exprt
Operator to return the address of an object.
Definition: pointer_expr.h:370
exprt::add_source_location
source_locationt & add_source_location()
Definition: expr.h:216
symbol_table.h
Author: Diffblue Ltd.
pointer_typet
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
Definition: pointer_expr.h:23
size_type
unsignedbv_typet size_type()
Definition: c_types.cpp:68
message.h
exprt::source_location
const source_locationt & source_location() const
Definition: expr.h:211
array_typet::index_type
typet index_type() const
The type of the index expressions into any instance of this type.
Definition: std_types.cpp:33
c_types.h
symbolt::name
irep_idt name
The unique identifier.
Definition: symbol.h:40
code_function_callt::function
exprt & function()
Definition: goto_instruction_code.h:307
array_typet::element_type
const typet & element_type() const
The type of the elements of the array.
Definition: std_types.h:785
codet
Data structure for representing an arbitrary statement in a program.
Definition: std_code_base.h:28
equal_range
ranget< typename multimapt::const_iterator > equal_range(const multimapt &multimap, const typename multimapt::key_type &key)
Utility function to make equal_range method of multimap easier to use by returning a ranget object.
Definition: range.h:541