-
Notifications
You must be signed in to change notification settings - Fork 273
Refactoring in symex, replace nondet_count by a functor #3433
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
romainbrenguier
merged 4 commits into
diffblue:develop
from
romainbrenguier:refactor/symex-nondet-count
Nov 19, 2018
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -13,7 +13,6 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <util/simplify_expr.h> | ||
|
||
unsigned goto_symext::nondet_count=0; | ||
unsigned goto_symext::dynamic_counter=0; | ||
|
||
void goto_symext::do_simplify(exprt &expr) | ||
|
@@ -22,23 +21,9 @@ void goto_symext::do_simplify(exprt &expr) | |
simplify(expr, ns); | ||
} | ||
|
||
nondet_symbol_exprt goto_symext::build_symex_nondet(typet &type) | ||
nondet_symbol_exprt symex_nondet_generatort::operator()(typet &type) | ||
{ | ||
irep_idt identifier = "symex::nondet" + std::to_string(nondet_count++); | ||
nondet_symbol_exprt new_expr(identifier, type); | ||
return new_expr; | ||
} | ||
|
||
void goto_symext::replace_nondet(exprt &expr) | ||
{ | ||
if(expr.id()==ID_side_effect && | ||
expr.get(ID_statement)==ID_nondet) | ||
{ | ||
nondet_symbol_exprt new_expr = build_symex_nondet(expr.type()); | ||
new_expr.add_source_location()=expr.source_location(); | ||
expr.swap(new_expr); | ||
} | ||
else | ||
Forall_operands(it, expr) | ||
replace_nondet(*it); | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -22,8 +22,8 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <analyses/dirty.h> | ||
|
||
void goto_symext::symex_transition( | ||
statet &state, | ||
void symex_transition( | ||
goto_symext::statet &state, | ||
goto_programt::const_targett to, | ||
bool is_backwards_goto) | ||
{ | ||
|
@@ -34,7 +34,7 @@ void goto_symext::symex_transition( | |
// 1. the transition from state.source.pc to "to" is not a backwards goto | ||
// or | ||
// 2. we are arriving from an outer loop | ||
statet::framet &frame=state.top(); | ||
goto_symext::statet::framet &frame = state.top(); | ||
const goto_programt::instructiont &instruction=*to; | ||
for(const auto &i_e : instruction.incoming_edges) | ||
if(i_e->is_goto() && i_e->is_backwards_goto() && | ||
|
@@ -46,6 +46,13 @@ void goto_symext::symex_transition( | |
state.source.pc=to; | ||
} | ||
|
||
void symex_transition(goto_symext::statet &state) | ||
{ | ||
goto_programt::const_targett next = state.source.pc; | ||
++next; | ||
symex_transition(state, next, false); | ||
} | ||
|
||
void goto_symext::vcc( | ||
const exprt &vcc_expr, | ||
const std::string &msg, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Braces would be appreciated around a multiline block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now added