|
| 1 | +/*******************************************************************\ |
| 2 | +
|
| 3 | +Module: Abstract GOTO Model |
| 4 | +
|
| 5 | +Author: Diffblue Ltd. |
| 6 | +
|
| 7 | +\*******************************************************************/ |
| 8 | + |
| 9 | +/// \file |
| 10 | +/// Abstract interface to eager or lazy GOTO models |
| 11 | + |
| 12 | +#ifndef CPROVER_GOTO_PROGRAMS_ABSTRACT_GOTO_MODEL_H |
| 13 | +#define CPROVER_GOTO_PROGRAMS_ABSTRACT_GOTO_MODEL_H |
| 14 | + |
| 15 | +#include "goto_functions.h" |
| 16 | +#include <util/symbol_table.h> |
| 17 | + |
| 18 | +/// Abstract interface to eager or lazy GOTO models |
| 19 | +class abstract_goto_modelt |
| 20 | +{ |
| 21 | +public: |
| 22 | + virtual ~abstract_goto_modelt() |
| 23 | + { |
| 24 | + } |
| 25 | + |
| 26 | + /// Determines if this model can produce a body for the given function |
| 27 | + /// \param id: function ID to query |
| 28 | + /// \return true if we can produce a function body, or false if we would leave |
| 29 | + /// it a bodyless stub. |
| 30 | + virtual bool can_produce_function(const irep_idt &id) const = 0; |
| 31 | + |
| 32 | + /// Get a GOTO function by name, or throw if no such function exists. |
| 33 | + /// May have side-effects on the GOTO function map provided by |
| 34 | + /// get_goto_functions, or the symbol table returned by get_symbol_table, |
| 35 | + /// so iterators pointing into either may be invalidated. |
| 36 | + /// \param id: function to get |
| 37 | + /// \return function body |
| 38 | + virtual const goto_functionst::goto_functiont &get_goto_function( |
| 39 | + const irep_idt &id) = 0; |
| 40 | + |
| 41 | + /// Accessor to get a raw goto_functionst. Concurrent use of get_goto_function |
| 42 | + /// may invalidate iterators or otherwise surprise users by modifying the map |
| 43 | + /// underneath them, so this should only be used to lend a reference to code |
| 44 | + /// that cannot also call get_goto_function. |
| 45 | + virtual const goto_functionst &get_goto_functions() const = 0; |
| 46 | + |
| 47 | + /// Accessor to get the symbol table. Concurrent use of get_goto_function |
| 48 | + /// may invalidate iterators or otherwise surprise users by modifying the map |
| 49 | + /// underneath them, so this should only be used to lend a reference to code |
| 50 | + /// that cannot also call get_goto_function. |
| 51 | + virtual const symbol_tablet &get_symbol_table() const = 0; |
| 52 | +}; |
| 53 | + |
| 54 | +#endif |
0 commit comments