Go to the documentation of this file.
43 auto const entry_function_sym = symbol_table.
lookup(entry_function_name);
44 if(entry_function_sym ==
nullptr)
48 std::string{
"couldn't find function with name '"} +
49 id2string(entry_function_name) +
"' in symbol table",
55 entry_language->set_message_handler(message_handler);
56 entry_language->set_language_options(options);
57 return entry_language->generate_support_functions(symbol_table);
61 const std::list<std::string> &sources,
72 for(
const auto &filename : sources)
75 std::ifstream infile(
widen(filename));
77 std::ifstream infile(filename);
83 "Failed to open input file '" + filename +
'\'');
92 "Failed to figure out type of file", filename};
101 if(language.
parse(infile, filename))
111 if(language_files.
typecheck(symbol_table))
120 const std::function<
void(
const irep_idt &)> &unload,
122 bool try_mode_lookup,
125 bool binaries_provided_start =
128 bool entry_point_generation_failed=
false;
130 if(binaries_provided_start && options.
is_set(
"function"))
137 std::unique_ptr<languaget> language =
144 entry_point_generation_failed =
149 if(!entry_point_generation_failed)
152 else if(!binaries_provided_start)
154 if(try_mode_lookup && options.
is_set(
"function"))
159 options, symbol_table, message_handler);
162 !try_mode_lookup || entry_point_generation_failed ||
163 !options.
is_set(
"function"))
167 entry_point_generation_failed =
172 if(entry_point_generation_failed)
179 const std::vector<std::string> &files,
187 "missing program argument",
189 "one or more paths to program files");
192 std::list<std::string> binaries, sources;
194 for(
const auto &file : files)
197 binaries.push_back(file);
199 sources.push_back(file);
208 sources, options, language_files, goto_model.
symbol_table, message_handler);
216 [&goto_model](
const irep_idt &
id) { goto_model.goto_functions.unload(id); },
233 if(options.
is_set(
"validate-goto-model"))
236 goto_model_validation_optionst ::set_optionst::all_false};
Class that provides messages with a built-in verbosity 'level'.
bool has_symbol(const irep_idt &name) const
Check whether a symbol exists in the symbol table.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
std::unique_ptr< languaget > get_entry_point_language(const symbol_table_baset &symbol_table, const optionst &options, message_handlert &message_handler)
Find the language corresponding to the __CPROVER_start function.
#define CHECK_RETURN(CONDITION)
bool typecheck(symbol_tablet &symbol_table, const bool keep_file_local=false)
const std::string get_option(const std::string &option) const
mstreamt & status() const
static bool generate_entry_point_for_function(const optionst &options, symbol_tablet &symbol_table, message_handlert &message_handler)
Generate an entry point that calls a function with the given name, based on the functions language mo...
std::unique_ptr< languaget > get_language_from_mode(const irep_idt &mode)
Get the language corresponding to the given mode.
bool generate_support_functions(symbol_tablet &symbol_table)
virtual void set_language_options(const optionst &)
Set language-specific options.
Thrown when a goto program that's being processed is in an invalid format, for example passing the wr...
void goto_convert(const codet &code, symbol_table_baset &symbol_table, goto_programt &dest, message_handlert &message_handler, const irep_idt &mode)
void initialize_from_source_files(const std::list< std::string > &sources, const optionst &options, language_filest &language_files, symbol_tablet &symbol_table, message_handlert &message_handler)
Populate symbol_table from sources by parsing and type checking via language_files.
std::unique_ptr< languaget > get_language_from_filename(const std::string &filename)
Get the language corresponding to the registered file name extensions.
bool read_objects_and_link(const std::list< std::string > &file_names, goto_modelt &dest, message_handlert &message_handler)
Reads object files and updates the config if any files were read.
void remove_existing_entry_point(symbol_table_baset &symbol_table)
Eliminate the existing entry point function symbol and any symbols created in that scope from the sym...
const std::string & id2string(const irep_idt &d)
virtual bool generate_support_functions(symbol_tablet &symbol_table)=0
Create language-specific support functions, such as __CPROVER_start, __CPROVER_initialize and languag...
bool is_set(const std::string &option) const
N.B. opts.is_set("foo") does not imply opts.get_bool_option("foo")
#define PRECONDITION(CONDITION)
Thrown when some external system fails unexpectedly.
virtual bool parse(std::istream &instream, const std::string &path)=0
virtual void set_message_handler(message_handlert &_message_handler)
language_filet & add_file(const std::string &filename)
std::unique_ptr< languaget > language
std::wstring widen(const char *s)
bool final(symbol_table_baset &symbol_table)
goto_functionst goto_functions
GOTO functions.
bool is_goto_binary(const std::string &filename, message_handlert &message_handler)
void validate(const validation_modet vm=validation_modet::INVARIANT, const goto_model_validation_optionst &goto_model_validation_options=goto_model_validation_optionst{}) const override
Check that the goto model is well-formed.
const symbolt * lookup(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
goto_modelt initialize_goto_model(const std::vector< std::string > &files, message_handlert &message_handler, const optionst &options)
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
void set_object_bits_from_symbol_table(const symbol_tablet &)
Sets the number of bits used for object addresses.
symbol_tablet symbol_table
Symbol table.
void set_up_custom_entry_point(language_filest &language_files, symbol_tablet &symbol_table, const std::function< void(const irep_idt &)> &unload, const optionst &options, bool try_mode_lookup, message_handlert &message_handler)
Process the "function" option in options to prepare a custom entry point to replace __CPROVER_start.