forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request diffblue#2234 from nmanthey/upstream-fpr
Upstream fpr
- Loading branch information
Showing
5 changed files
with
33 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ Author: Daniel Kroening, [email protected] | |
/// get all functions whose address is taken | ||
void compute_address_taken_functions( | ||
const exprt &src, | ||
std::set<irep_idt> &address_taken) | ||
std::unordered_set<irep_idt> &address_taken) | ||
{ | ||
forall_operands(it, src) | ||
compute_address_taken_functions(*it, address_taken); | ||
|
@@ -35,7 +35,7 @@ void compute_address_taken_functions( | |
/// get all functions in the expression | ||
void compute_functions( | ||
const exprt &src, | ||
std::set<irep_idt> &address_taken) | ||
std::unordered_set<irep_idt> &address_taken) | ||
{ | ||
forall_operands(it, src) | ||
compute_functions(*it, address_taken); | ||
|
@@ -48,7 +48,7 @@ void compute_functions( | |
/// get all functions whose address is taken | ||
void compute_address_taken_functions( | ||
const goto_programt &goto_program, | ||
std::set<irep_idt> &address_taken) | ||
std::unordered_set<irep_idt> &address_taken) | ||
{ | ||
forall_goto_program_instructions(it, goto_program) | ||
{ | ||
|
@@ -60,28 +60,27 @@ void compute_address_taken_functions( | |
/// get all functions whose address is taken | ||
void compute_address_taken_functions( | ||
const goto_functionst &goto_functions, | ||
std::set<irep_idt> &address_taken) | ||
std::unordered_set<irep_idt> &address_taken) | ||
{ | ||
forall_goto_functions(it, goto_functions) | ||
compute_address_taken_functions(it->second.body, address_taken); | ||
} | ||
|
||
/// get all functions whose address is taken | ||
std::set<irep_idt> compute_address_taken_functions( | ||
const goto_functionst &goto_functions) | ||
std::unordered_set<irep_idt> | ||
compute_address_taken_functions(const goto_functionst &goto_functions) | ||
{ | ||
std::set<irep_idt> address_taken; | ||
std::unordered_set<irep_idt> address_taken; | ||
compute_address_taken_functions(goto_functions, address_taken); | ||
return address_taken; | ||
} | ||
|
||
/// computes the functions that are (potentially) called | ||
std::set<irep_idt> compute_called_functions( | ||
const goto_functionst &goto_functions) | ||
std::unordered_set<irep_idt> | ||
compute_called_functions(const goto_functionst &goto_functions) | ||
{ | ||
std::set<irep_idt> working_queue; | ||
std::set<irep_idt> done; | ||
std::set<irep_idt> functions; | ||
std::unordered_set<irep_idt> working_queue; | ||
std::unordered_set<irep_idt> functions; | ||
|
||
// start from entry point | ||
working_queue.insert(goto_functions.entry_point()); | ||
|
@@ -91,12 +90,9 @@ std::set<irep_idt> compute_called_functions( | |
irep_idt id=*working_queue.begin(); | ||
working_queue.erase(working_queue.begin()); | ||
|
||
if(done.find(id)!=done.end()) | ||
if(!functions.insert(id).second) | ||
continue; | ||
|
||
functions.insert(id); | ||
done.insert(id); | ||
|
||
const goto_functionst::function_mapt::const_iterator f_it= | ||
goto_functions.function_map.find(id); | ||
|
||
|
@@ -123,8 +119,8 @@ std::set<irep_idt> compute_called_functions( | |
} | ||
|
||
/// computes the functions that are (potentially) called | ||
std::set<irep_idt> compute_called_functions( | ||
const goto_modelt &goto_model) | ||
std::unordered_set<irep_idt> | ||
compute_called_functions(const goto_modelt &goto_model) | ||
{ | ||
return compute_called_functions(goto_model.goto_functions); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,18 +18,18 @@ Author: Daniel Kroening, [email protected] | |
|
||
void compute_address_taken_functions( | ||
const exprt &, | ||
std::set<irep_idt> &); | ||
std::unordered_set<irep_idt> &); | ||
|
||
void compute_address_taken_functions( | ||
const goto_programt &, | ||
std::set<irep_idt> &); | ||
std::unordered_set<irep_idt> &); | ||
|
||
void compute_address_taken_functions( | ||
const goto_functionst &, | ||
std::set<irep_idt> &); | ||
std::unordered_set<irep_idt> &); | ||
|
||
// computes the functions that are (potentially) called | ||
std::set<irep_idt> compute_called_functions(const goto_functionst &); | ||
std::set<irep_idt> compute_called_functions(const goto_modelt &); | ||
std::unordered_set<irep_idt> compute_called_functions(const goto_functionst &); | ||
std::unordered_set<irep_idt> compute_called_functions(const goto_modelt &); | ||
|
||
#endif // CPROVER_GOTO_PROGRAMS_COMPUTE_CALLED_FUNCTIONS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters