Skip to content

Fixup e59511c9168f04cb21e85642aa8875c1cb4b4 #2964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/goto-instrument/goto_instrument_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,14 +897,16 @@ void goto_instrument_parse_optionst::get_goto_program()
{
status() << "Reading GOTO program from `" << cmdline.args[0] << "'" << eom;

config.set(cmdline);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually necessary/useful at all? AFAIK the config will be overwritten below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but not all of it -- only what is called 'architectural configuration'. Say include paths aren't.

auto result = read_goto_binary(cmdline.args[0], get_message_handler());

if(!result.has_value())
throw 0;

goto_model = std::move(result.value());

config.set(cmdline);
config.set_from_symbol_table(goto_model.symbol_table);
}

void goto_instrument_parse_optionst::instrument_goto_program()
Expand Down
27 changes: 23 additions & 4 deletions src/goto-programs/read_goto_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ Module: Read Goto Programs
#include "elf_reader.h"
#include "osx_fat_reader.h"

/// \brief Read a goto binary from a file, but do not update \ref config
/// \param filename the file name of the goto binary
/// \param dest the goto model returned
/// \param message_handler for diagnostics
/// \deprecated Use read_goto_binary(file, message_handler) instead
/// \return true on failure, false on success
bool read_goto_binary(
const std::string &filename,
goto_modelt &dest,
Expand All @@ -36,6 +42,10 @@ bool read_goto_binary(
filename, dest.symbol_table, dest.goto_functions, message_handler);
}

/// \brief Read a goto binary from a file, but do not update \ref config
/// \param filename the file name of the goto binary
/// \param message_handler for diagnostics
/// \return goto model on success, {} on failure
optionalt<goto_modelt>
read_goto_binary(const std::string &filename, message_handlert &message_handler)
{
Expand All @@ -50,6 +60,12 @@ read_goto_binary(const std::string &filename, message_handlert &message_handler)
return std::move(dest);
}

/// \brief Read a goto binary from a file, but do not update \ref config
/// \param filename the file name of the goto binary
/// \param symbol_table the symbol table from the goto binary
/// \param goto_functions the goto functions from the goto binary
/// \param message_handler for diagnostics
/// \return true on failure, false on success
bool read_goto_binary(
const std::string &filename,
symbol_tablet &symbol_table,
Expand Down Expand Up @@ -206,8 +222,10 @@ bool is_goto_binary(const std::string &filename)
return false;
}

/// reads an object file
/// \par parameters: a file_name
/// \brief reads an object file, and also updates config
/// \param file_name file name of the goto binary
/// \param dest the goto model returned
/// \param message_handler for diagnostics
/// \return true on error, false otherwise
bool read_object_and_link(
const std::string &file_name,
Expand Down Expand Up @@ -241,8 +259,9 @@ bool read_object_and_link(
return false;
}

/// reads an object file
/// \par parameters: a file_name
/// \brief reads an object file, and also updates the config
/// \param file_name file name of the goto binary
/// \param message_handler for diagnostics
/// \return true on error, false otherwise
bool read_object_and_link(
const std::string &file_name,
Expand Down