CBMC
remove_function_pointers.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Program Transformation
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
13 
14 #include <util/arith_tools.h>
15 #include <util/byte_operators.h>
16 #include <util/c_types.h>
17 #include <util/fresh_symbol.h>
18 #include <util/invariant.h>
19 #include <util/message.h>
20 #include <util/pointer_expr.h>
22 #include <util/source_location.h>
23 #include <util/std_code.h>
24 #include <util/std_expr.h>
25 #include <util/string_utils.h>
26 
28 
30 #include "goto_model.h"
32 #include "remove_skip.h"
33 
35 {
36 public:
38  message_handlert &_message_handler,
39  symbol_tablet &_symbol_table,
41  const goto_functionst &goto_functions);
42 
43  void operator()(goto_functionst &goto_functions);
44 
46  goto_programt &goto_program,
47  const irep_idt &function_id);
48 
49 protected:
51  const namespacet ns;
53 
54  // We can optionally halt the FP removal if we aren't able to use
55  // remove_const_function_pointerst to successfully narrow to a small
56  // subset of possible functions and just leave the function pointer
57  // as it is.
58  // This can be activated in goto-instrument using
59  // --remove-const-function-pointers instead of --remove-function-pointers
61 
69  goto_programt &goto_program,
70  const irep_idt &function_id,
71  goto_programt::targett target);
72 
73  std::unordered_set<irep_idt> address_taken;
74 
75  typedef std::map<irep_idt, code_typet> type_mapt;
77 };
78 
80  message_handlert &_message_handler,
81  symbol_tablet &_symbol_table,
82  bool only_resolve_const_fps,
83  const goto_functionst &goto_functions)
84  : message_handler(_message_handler),
85  ns(_symbol_table),
86  symbol_table(_symbol_table),
87  only_resolve_const_fps(only_resolve_const_fps)
88 {
89  for(const auto &s : symbol_table.symbols)
91 
93 
94  // build type map
95  for(const auto &gf_entry : goto_functions.function_map)
96  {
97  type_map.emplace(
98  gf_entry.first, to_code_type(ns.lookup(gf_entry.first).type));
99  }
100 }
101 
103  const typet &call_type,
104  const typet &function_type,
105  const namespacet &ns)
106 {
107  if(call_type == function_type)
108  return true;
109 
110  // any integer-vs-enum-vs-pointer is ok
111  if(
112  call_type.id() == ID_signedbv || call_type.id() == ID_unsigned ||
113  call_type.id() == ID_bool || call_type.id() == ID_c_bool ||
114  call_type.id() == ID_c_enum_tag || call_type.id() == ID_c_enum ||
115  call_type.id() == ID_pointer)
116  {
117  return function_type.id() == ID_signedbv ||
118  function_type.id() == ID_unsigned || function_type.id() == ID_bool ||
119  function_type.id() == ID_c_bool ||
120  function_type.id() == ID_pointer ||
121  function_type.id() == ID_c_enum ||
122  function_type.id() == ID_c_enum_tag;
123  }
124 
125  return pointer_offset_bits(call_type, ns) ==
126  pointer_offset_bits(function_type, ns);
127 }
128 
130  bool return_value_used,
131  const code_typet &call_type,
132  const code_typet &function_type,
133  const namespacet &ns)
134 {
135  // we are willing to ignore anything that's returned
136  // if we call with 'void'
137  if(!return_value_used)
138  {
139  }
140  else if(call_type.return_type() == empty_typet())
141  {
142  // ok
143  }
144  else
145  {
147  call_type.return_type(), function_type.return_type(), ns))
148  return false;
149  }
150 
151  // let's look at the parameters
152  const code_typet::parameterst &call_parameters=call_type.parameters();
153  const code_typet::parameterst &function_parameters=function_type.parameters();
154 
155  if(function_type.has_ellipsis() &&
156  function_parameters.empty())
157  {
158  // always ok
159  }
160  else if(call_type.has_ellipsis() &&
161  call_parameters.empty())
162  {
163  // always ok
164  }
165  else
166  {
167  // we are quite strict here, could be much more generous
168  if(call_parameters.size()!=function_parameters.size())
169  return false;
170 
171  for(std::size_t i=0; i<call_parameters.size(); i++)
173  call_parameters[i].type(), function_parameters[i].type(), ns))
174  return false;
175  }
176 
177  return true;
178 }
179 
180 static void fix_argument_types(code_function_callt &function_call)
181 {
182  const code_typet &code_type = to_code_type(function_call.function().type());
183 
184  const code_typet::parameterst &function_parameters=
185  code_type.parameters();
186 
187  code_function_callt::argumentst &call_arguments=
188  function_call.arguments();
189 
190  for(std::size_t i=0; i<function_parameters.size(); i++)
191  {
192  if(i<call_arguments.size())
193  {
194  if(call_arguments[i].type() != function_parameters[i].type())
195  {
196  call_arguments[i] = make_byte_extract(
197  call_arguments[i],
199  function_parameters[i].type());
200  }
201  }
202  }
203 }
204 
205 static void fix_return_type(
206  const irep_idt &in_function_id,
207  code_function_callt &function_call,
208  symbol_tablet &symbol_table,
209  goto_programt &dest)
210 {
211  // are we returning anything at all?
212  if(function_call.lhs().is_nil())
213  return;
214 
215  const code_typet &code_type = to_code_type(function_call.function().type());
216 
217  // type already ok?
218  if(function_call.lhs().type() == code_type.return_type())
219  return;
220 
221  const namespacet ns(symbol_table);
222  const symbolt &function_symbol =
223  ns.lookup(to_symbol_expr(function_call.function()).get_identifier());
224 
225  symbolt &tmp_symbol = get_fresh_aux_symbol(
226  code_type.return_type(),
227  id2string(in_function_id),
228  "tmp_return_val_" + id2string(function_symbol.base_name),
229  function_call.source_location(),
230  function_symbol.mode,
231  symbol_table);
232 
233  const symbol_exprt tmp_symbol_expr = tmp_symbol.symbol_expr();
234 
235  exprt old_lhs=function_call.lhs();
236  function_call.lhs()=tmp_symbol_expr;
237 
239  old_lhs,
241  tmp_symbol_expr, from_integer(0, c_index_type()), old_lhs.type()))));
242 }
243 
245  goto_programt &goto_program,
246  const irep_idt &function_id,
247  goto_programt::targett target)
248 {
249  const auto &function = to_dereference_expr(as_const(*target).call_function());
250 
251  // this better have the right type
252  code_typet call_type=to_code_type(function.type());
253 
254  // refine the type in case the forward declaration was incomplete
255  if(call_type.has_ellipsis() &&
256  call_type.parameters().empty())
257  {
258  call_type.remove_ellipsis();
259  for(const auto &argument : as_const(*target).call_arguments())
260  {
261  call_type.parameters().push_back(code_typet::parametert(argument.type()));
262  }
263  }
264 
265  bool found_functions;
266 
267  const exprt &pointer = function.pointer();
269  does_remove_constt const_removal_check(goto_program);
270  const auto does_remove_const = const_removal_check();
272  if(does_remove_const.first)
273  {
274  log.warning().source_location = does_remove_const.second;
275  log.warning() << "cast from const to non-const pointer found, "
276  << "only worst case function pointer removal will be done."
277  << messaget::eom;
278  found_functions=false;
279  }
280  else
281  {
283  log.get_message_handler(), ns, symbol_table);
284 
285  found_functions=fpr(pointer, functions);
286 
287  // if found_functions is false, functions should be empty
288  // however, it is possible for found_functions to be true and functions
289  // to be empty (this happens if the pointer can only resolve to the null
290  // pointer)
291  CHECK_RETURN(found_functions || functions.empty());
292 
293  if(functions.size()==1)
294  {
295  target->call_function() = *functions.cbegin();
296  return;
297  }
298  }
299 
300  if(!found_functions)
301  {
303  {
304  // If this mode is enabled, we only remove function pointers
305  // that we can resolve either to an exact function, or an exact subset
306  // (e.g. a variable index in a constant array).
307  // Since we haven't found functions, we would now resort to
308  // replacing the function pointer with any function with a valid signature
309  // Since we don't want to do that, we abort.
310  return;
311  }
312 
313  bool return_value_used = as_const(*target).call_lhs().is_not_nil();
314 
315  // get all type-compatible functions
316  // whose address is ever taken
317  for(const auto &t : type_map)
318  {
319  // address taken?
320  if(address_taken.find(t.first)==address_taken.end())
321  continue;
322 
323  // type-compatible?
325  return_value_used, call_type, t.second, ns))
326  continue;
327 
328  if(t.first=="pthread_mutex_cleanup")
329  continue;
330 
331  symbol_exprt expr(t.first, t.second);
332  functions.insert(expr);
333  }
334  }
335 
338  symbol_table,
339  goto_program,
340  function_id,
341  target,
342  functions);
343 }
344 
346  const std::unordered_set<symbol_exprt, irep_hash> &candidates)
347 {
348  std::stringstream comment;
349 
350  comment << "dereferenced function pointer must be ";
351 
352  if(candidates.size() == 1)
353  {
354  comment << candidates.begin()->get_identifier();
355  }
356  else if(candidates.empty())
357  {
358  comment.str("no candidates for dereferenced function pointer");
359  }
360  else
361  {
362  comment << "one of [";
363 
364  join_strings(
365  comment,
366  candidates.begin(),
367  candidates.end(),
368  ", ",
369  [](const symbol_exprt &s) { return s.get_identifier(); });
370 
371  comment << ']';
372  }
373 
374  return comment.str();
375 }
376 
378  message_handlert &message_handler,
379  symbol_tablet &symbol_table,
380  goto_programt &goto_program,
381  const irep_idt &function_id,
382  goto_programt::targett target,
383  const std::unordered_set<symbol_exprt, irep_hash> &functions)
384 {
385  const exprt &function = target->call_function();
386  const exprt &pointer = to_dereference_expr(function).pointer();
387 
388  // the final target is a skip
389  goto_programt final_skip;
390 
391  goto_programt::targett t_final = final_skip.add(goto_programt::make_skip());
392 
393  // build the calls and gotos
394 
395  goto_programt new_code_calls;
396  goto_programt new_code_gotos;
397 
398  for(const auto &fun : functions)
399  {
400  // call function
401  auto new_call =
402  code_function_callt(target->call_lhs(), fun, target->call_arguments());
403 
404  // the signature of the function might not match precisely
405  fix_argument_types(new_call);
406 
407  goto_programt tmp;
408  fix_return_type(function_id, new_call, symbol_table, tmp);
409 
410  auto call = new_code_calls.add(goto_programt::make_function_call(new_call));
411  new_code_calls.destructive_append(tmp);
412 
413  // goto final
414  new_code_calls.add(goto_programt::make_goto(t_final, true_exprt()));
415 
416  // goto to call
417  const address_of_exprt address_of(fun, pointer_type(fun.type()));
418 
419  const auto casted_address =
420  typecast_exprt::conditional_cast(address_of, pointer.type());
421 
422  new_code_gotos.add(
423  goto_programt::make_goto(call, equal_exprt(pointer, casted_address)));
424  }
425 
426  // fall-through
428  new_code_gotos.add(goto_programt::make_assertion(false_exprt()));
429  t->source_location_nonconst().set_property_class("pointer dereference");
430  t->source_location_nonconst().set_comment(
433 
434  goto_programt new_code;
435 
436  // patch them all together
437  new_code.destructive_append(new_code_gotos);
438  new_code.destructive_append(new_code_calls);
439  new_code.destructive_append(final_skip);
440 
441  // set locations
442  for(auto &instruction : new_code.instructions)
443  {
444  source_locationt &source_location = instruction.source_location_nonconst();
445 
446  irep_idt property_class = source_location.get_property_class();
447  irep_idt comment = source_location.get_comment();
448  source_location = target->source_location();
449  if(!property_class.empty())
450  source_location.set_property_class(property_class);
451  if(!comment.empty())
452  source_location.set_comment(comment);
453  }
454 
455  goto_programt::targett next_target=target;
456  next_target++;
457 
458  goto_program.destructive_insert(next_target, new_code);
459 
460  // We preserve the original dereferencing to possibly catch
461  // further pointer-related errors.
462  code_expressiont code_expression(function);
463  code_expression.add_source_location()=function.source_location();
464  *target =
465  goto_programt::make_other(code_expression, target->source_location());
466 
467  // report statistics
468  messaget log{message_handler};
469  log.statistics().source_location = target->source_location();
470  log.statistics() << "replacing function pointer by " << functions.size()
471  << " possible targets" << messaget::eom;
472 
473  // list the names of functions when verbosity is at debug level
474  log.conditional_output(
475  log.debug(), [&functions](messaget::mstreamt &mstream) {
476  mstream << "targets: ";
477 
478  bool first = true;
479  for(const auto &function : functions)
480  {
481  if(!first)
482  mstream << ", ";
483 
484  mstream << function.get_identifier();
485  first = false;
486  }
487 
488  mstream << messaget::eom;
489  });
490 }
491 
493  goto_programt &goto_program,
494  const irep_idt &function_id)
495 {
496  bool did_something=false;
497 
498  Forall_goto_program_instructions(target, goto_program)
499  if(target->is_function_call())
500  {
501  if(target->call_function().id() == ID_dereference)
502  {
503  remove_function_pointer(goto_program, function_id, target);
504  did_something=true;
505  }
506  }
507 
508  if(did_something)
509  remove_skip(goto_program);
510 
511  return did_something;
512 }
513 
515 {
516  bool did_something=false;
517 
518  for(goto_functionst::function_mapt::iterator f_it=
519  functions.function_map.begin();
520  f_it!=functions.function_map.end();
521  f_it++)
522  {
523  goto_programt &goto_program=f_it->second.body;
524 
525  if(remove_function_pointers(goto_program, f_it->first))
526  did_something=true;
527  }
528 
529  if(did_something)
530  functions.compute_location_numbers();
531 }
532 
534  message_handlert &_message_handler,
535  goto_modelt &goto_model,
536  bool only_remove_const_fps)
537 {
539  _message_handler,
540  goto_model.symbol_table,
541  only_remove_const_fps,
542  goto_model.goto_functions);
543 
544  rfp(goto_model.goto_functions);
545 }
messaget
Class that provides messages with a built-in verbosity 'level'.
Definition: message.h:154
Forall_goto_program_instructions
#define Forall_goto_program_instructions(it, program)
Definition: goto_program.h:1234
goto_programt::make_other
static instructiont make_other(const goto_instruction_codet &_code, const source_locationt &l=source_locationt::nil())
Definition: goto_program.h:948
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
pointer_offset_size.h
source_locationt::get_comment
const irep_idt & get_comment() const
Definition: source_location.h:70
code_typet::has_ellipsis
bool has_ellipsis() const
Definition: std_types.h:611
make_byte_extract
byte_extract_exprt make_byte_extract(const exprt &_op, const exprt &_offset, const typet &_type)
Construct a byte_extract_exprt with endianness and byte width matching the current configuration.
Definition: byte_operators.cpp:48
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
source_locationt::get_property_class
const irep_idt & get_property_class() const
Definition: source_location.h:65
arg_is_type_compatible
static bool arg_is_type_compatible(const typet &call_type, const typet &function_type, const namespacet &ns)
Definition: remove_function_pointers.cpp:102
remove_function_pointerst::operator()
void operator()(goto_functionst &goto_functions)
Definition: remove_function_pointers.cpp:514
source_locationt::set_comment
void set_comment(const irep_idt &comment)
Definition: source_location.h:135
remove_function_pointerst::address_taken
std::unordered_set< irep_idt > address_taken
Definition: remove_function_pointers.cpp:73
arith_tools.h
to_dereference_expr
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
Definition: pointer_expr.h:716
remove_function_pointerst::message_handler
message_handlert & message_handler
Definition: remove_function_pointers.cpp:50
CHECK_RETURN
#define CHECK_RETURN(CONDITION)
Definition: invariant.h:495
string_utils.h
typet
The type of an expression, extends irept.
Definition: type.h:28
code_typet::parameterst
std::vector< parametert > parameterst
Definition: std_types.h:541
fresh_symbol.h
remove_function_pointerst::remove_function_pointer
void remove_function_pointer(goto_programt &goto_program, const irep_idt &function_id, goto_programt::targett target)
Replace a call to a dynamic function at location target in the given goto-program by determining func...
Definition: remove_function_pointers.cpp:244
remove_skip
void remove_skip(goto_programt &goto_program, goto_programt::targett begin, goto_programt::targett end)
remove unnecessary skip statements
Definition: remove_skip.cpp:87
invariant.h
goto_programt::add
targett add(instructiont &&instruction)
Adds a given instruction at the end.
Definition: goto_program.h:709
goto_model.h
goto_functionst::compute_location_numbers
void compute_location_numbers()
Definition: goto_functions.cpp:20
exprt
Base class for all expressions.
Definition: expr.h:55
goto_modelt
Definition: goto_model.h:25
symbolt::base_name
irep_idt base_name
Base (non-scoped) name.
Definition: symbol.h:46
messaget::eom
static eomt eom
Definition: message.h:297
goto_functionst::function_map
function_mapt function_map
Definition: goto_functions.h:29
symbol_exprt
Expression to hold a symbol (variable)
Definition: std_expr.h:112
equal_exprt
Equality.
Definition: std_expr.h:1305
code_typet::remove_ellipsis
void remove_ellipsis()
Definition: std_types.h:640
code_function_callt::lhs
exprt & lhs()
Definition: goto_instruction_code.h:297
goto_programt::make_assignment
static instructiont make_assignment(const code_assignt &_code, const source_locationt &l=source_locationt::nil())
Create an assignment instruction.
Definition: goto_program.h:1056
goto_programt::make_goto
static instructiont make_goto(targett _target, const source_locationt &l=source_locationt::nil())
Definition: goto_program.h:1030
remove_function_pointerst::remove_function_pointerst
remove_function_pointerst(message_handlert &_message_handler, symbol_tablet &_symbol_table, bool only_resolve_const_fps, const goto_functionst &goto_functions)
Definition: remove_function_pointers.cpp:79
remove_const_function_pointerst::functionst
std::unordered_set< symbol_exprt, irep_hash > functionst
Definition: remove_const_function_pointers.h:35
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
goto_programt::make_function_call
static instructiont make_function_call(const code_function_callt &_code, const source_locationt &l=source_locationt::nil())
Create a function call instruction.
Definition: goto_program.h:1081
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
remove_function_pointerst::type_map
type_mapt type_map
Definition: remove_function_pointers.cpp:76
byte_operators.h
Expression classes for byte-level operators.
to_code_type
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
Definition: std_types.h:744
remove_function_pointerst::symbol_table
symbol_tablet & symbol_table
Definition: remove_function_pointers.cpp:52
goto_programt::make_assertion
static instructiont make_assertion(const exprt &g, const source_locationt &l=source_locationt::nil())
Definition: goto_program.h:924
symbolt::mode
irep_idt mode
Language mode.
Definition: symbol.h:49
as_const
const T & as_const(T &value)
Return a reference to the same object but ensures the type is const.
Definition: as_const.h:14
empty_typet
The empty type.
Definition: std_types.h:50
goto_programt::destructive_insert
void destructive_insert(const_targett target, goto_programt &p)
Inserts the given program p before target.
Definition: goto_program.h:700
id2string
const std::string & id2string(const irep_idt &d)
Definition: irep.h:47
function_pointer_assertion_comment
static std::string function_pointer_assertion_comment(const std::unordered_set< symbol_exprt, irep_hash > &candidates)
Definition: remove_function_pointers.cpp:345
goto_programt::make_skip
static instructiont make_skip(const source_locationt &l=source_locationt::nil())
Definition: goto_program.h:882
join_strings
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
Definition: string_utils.h:62
symbol_exprt::get_identifier
const irep_idt & get_identifier() const
Definition: std_expr.h:142
dereference_exprt::pointer
exprt & pointer()
Definition: pointer_expr.h:673
pointer_offset_bits
optionalt< mp_integer > pointer_offset_bits(const typet &type, const namespacet &ns)
Definition: pointer_offset_size.cpp:101
remove_function_pointers
void remove_function_pointers(message_handlert &_message_handler, goto_modelt &goto_model, bool only_remove_const_fps)
Definition: remove_function_pointers.cpp:533
symbolt::symbol_expr
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
Definition: symbol.cpp:121
pointer_expr.h
source_location.h
pointer_type
pointer_typet pointer_type(const typet &subtype)
Definition: c_types.cpp:253
function_is_type_compatible
bool function_is_type_compatible(bool return_value_used, const code_typet &call_type, const code_typet &function_type, const namespacet &ns)
Returns true iff call_type can be converted to produce a function call of the same type as function_t...
Definition: remove_function_pointers.cpp:129
to_symbol_expr
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
Definition: std_expr.h:222
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
code_function_callt::argumentst
exprt::operandst argumentst
Definition: goto_instruction_code.h:281
dstringt::empty
bool empty() const
Definition: dstring.h:88
false_exprt
The Boolean constant false.
Definition: std_expr.h:3016
code_typet::parameters
const parameterst & parameters() const
Definition: std_types.h:655
std_code.h
code_function_callt::arguments
argumentst & arguments()
Definition: goto_instruction_code.h:317
remove_const_function_pointerst
Definition: remove_const_function_pointers.h:32
remove_function_pointer
void remove_function_pointer(message_handlert &message_handler, symbol_tablet &symbol_table, goto_programt &goto_program, const irep_idt &function_id, goto_programt::targett target, const std::unordered_set< symbol_exprt, irep_hash > &functions)
Replace a call to a dynamic function at location target in the given goto-program by a case-split ove...
Definition: remove_function_pointers.cpp:377
does_remove_constt
Definition: does_remove_const.h:21
goto_programt::destructive_append
void destructive_append(goto_programt &p)
Appends the given program p to *this. p is destroyed.
Definition: goto_program.h:692
source_locationt
Definition: source_location.h:18
goto_programt::instructions
instructionst instructions
The list of instructions in the goto program.
Definition: goto_program.h:592
goto_functionst
A collection of goto functions.
Definition: goto_functions.h:24
remove_const_function_pointers.h
does_remove_const.h
goto_modelt::goto_functions
goto_functionst goto_functions
GOTO functions.
Definition: goto_model.h:33
compute_address_taken_functions
void compute_address_taken_functions(const exprt &src, std::unordered_set< irep_idt > &address_taken)
get all functions whose address is taken
Definition: compute_called_functions.cpp:20
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
symbol_table_baset::symbols
const symbolst & symbols
Read-only field, used to look up symbols given their names.
Definition: symbol_table_base.h:30
remove_function_pointerst::only_resolve_const_fps
bool only_resolve_const_fps
Definition: remove_function_pointers.cpp:60
code_typet::parametert
Definition: std_types.h:555
goto_programt
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:72
fix_argument_types
static void fix_argument_types(code_function_callt &function_call)
Definition: remove_function_pointers.cpp:180
code_typet::return_type
const typet & return_type() const
Definition: std_types.h:645
messaget::mstreamt
Definition: message.h:223
goto_programt::make_assumption
static instructiont make_assumption(const exprt &g, const source_locationt &l=source_locationt::nil())
Definition: goto_program.h:936
compute_called_functions.h
remove_function_pointerst::ns
const namespacet ns
Definition: remove_function_pointers.cpp:51
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
remove_skip.h
code_assignt
A goto_instruction_codet representing an assignment in the program.
Definition: goto_instruction_code.h:22
message.h
true_exprt
The Boolean constant true.
Definition: std_expr.h:3007
c_index_type
bitvector_typet c_index_type()
Definition: c_types.cpp:16
comment
static std::string comment(const rw_set_baset::entryt &entry, bool write)
Definition: race_check.cpp:109
std_expr.h
remove_function_pointers.h
fix_return_type
static void fix_return_type(const irep_idt &in_function_id, code_function_callt &function_call, symbol_tablet &symbol_table, goto_programt &dest)
Definition: remove_function_pointers.cpp:205
exprt::source_location
const source_locationt & source_location() const
Definition: expr.h:211
goto_modelt::symbol_table
symbol_tablet symbol_table
Symbol table.
Definition: goto_model.h:30
c_types.h
get_fresh_aux_symbol
symbolt & get_fresh_aux_symbol(const typet &type, const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, const irep_idt &symbol_mode, const namespacet &ns, symbol_table_baset &symbol_table)
Installs a fresh-named symbol with respect to the given namespace ns with the requested name pattern ...
Definition: fresh_symbol.cpp:32
remove_function_pointerst::type_mapt
std::map< irep_idt, code_typet > type_mapt
Definition: remove_function_pointers.cpp:75
goto_programt::targett
instructionst::iterator targett
Definition: goto_program.h:586
code_function_callt::function
exprt & function()
Definition: goto_instruction_code.h:307
remove_function_pointerst
Definition: remove_function_pointers.cpp:34
code_expressiont
codet representation of an expression statement.
Definition: std_code.h:1393
remove_function_pointerst::remove_function_pointers
bool remove_function_pointers(goto_programt &goto_program, const irep_idt &function_id)
Definition: remove_function_pointers.cpp:492
source_locationt::set_property_class
void set_property_class(const irep_idt &property_class)
Definition: source_location.h:130