Skip to content

Remove link_to_library(goto_functions, symbol_table, ...) [blocks: #4056] #4296

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 1 commit into from
Nov 7, 2020
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
66 changes: 0 additions & 66 deletions src/goto-programs/link_to_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,69 +85,3 @@ void link_to_library(
}
}
}

/// Complete missing function definitions using the \p library.
/// \param symbol_table: symbol table that may contain symbols with missing
/// function bodies
/// \param goto_functions: goto functions that may contain function calls with
/// missing function bodies
/// \param message_handler: message handler to report library processing
/// problems
/// \param library: generator function that produces function definitions for a
/// given set of symbol names that have no body.
void link_to_library(
symbol_tablet &symbol_table,
goto_functionst &goto_functions,
message_handlert &message_handler,
const std::function<
void(const std::set<irep_idt> &, symbol_tablet &, message_handlert &)>
&library)
{
// this needs a fixedpoint, as library functions
// may depend on other library functions

std::set<irep_idt> added_functions;

while(true)
{
std::unordered_set<irep_idt> called_functions =
compute_called_functions(goto_functions);

// eliminate those for which we already have a body

std::set<irep_idt> missing_functions;

for(const auto &id : called_functions)
{
goto_functionst::function_mapt::const_iterator
f_it=goto_functions.function_map.find(id);

if(f_it!=goto_functions.function_map.end() &&
f_it->second.body_available())
{
// it's overridden!
}
else if(added_functions.find(id)!=added_functions.end())
{
// already added
}
else
missing_functions.insert(id);
}

// done?
if(missing_functions.empty())
break;

library(missing_functions, symbol_table, message_handler);

// convert to CFG
for(const auto &id : missing_functions)
{
if(symbol_table.symbols.find(id)!=symbol_table.symbols.end())
goto_convert(id, symbol_table, goto_functions, message_handler);

added_functions.insert(id);
}
}
}
9 changes: 0 additions & 9 deletions src/goto-programs/link_to_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,10 @@ Author: Daniel Kroening, [email protected]
#include <util/deprecate.h>
#include <util/irep.h>

class goto_functionst;
class goto_modelt;
class message_handlert;
class symbol_tablet;

DEPRECATED(SINCE(2019, 2, 28, "Use link_to_library(goto_model, ...) instead"))
void link_to_library(
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't that DEPRECATED line go away?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for catching this!

symbol_tablet &,
goto_functionst &,
message_handlert &,
const std::function<
void(const std::set<irep_idt> &, symbol_tablet &, message_handlert &)> &);

void link_to_library(
goto_modelt &,
message_handlert &,
Expand Down