-
Notifications
You must be signed in to change notification settings - Fork 274
Use type equality, not base_type_eq in local safe pointers #4164
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,7 @@ Author: Daniel Kroening, [email protected] | |
|
||
#include <goto-programs/abstract_goto_model.h> | ||
|
||
#include "goto_symex_state.h" | ||
#include "path_storage.h" | ||
#include "symex_target_equation.h" | ||
|
||
class byte_extract_exprt; | ||
class typet; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,6 @@ Author: Daniel Kroening, [email protected] | |
#include <unordered_set> | ||
|
||
#include <analyses/dirty.h> | ||
#include <analyses/local_safe_pointers.h> | ||
|
||
#include <util/invariant.h> | ||
#include <util/guard.h> | ||
|
@@ -68,7 +67,6 @@ class goto_statet | |
/// Threads | ||
unsigned atomic_section_id = 0; | ||
|
||
std::unordered_map<irep_idt, local_safe_pointerst> safe_pointers; | ||
unsigned total_vccs = 0; | ||
unsigned remaining_vccs = 0; | ||
|
||
|
@@ -320,7 +318,6 @@ inline goto_statet::goto_statet(const class goto_symex_statet &s) | |
source(s.source), | ||
propagation(s.propagation), | ||
atomic_section_id(s.atomic_section_id), | ||
safe_pointers(s.safe_pointers), | ||
total_vccs(s.total_vccs), | ||
remaining_vccs(s.remaining_vccs) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,16 +5,18 @@ | |
#ifndef CPROVER_GOTO_SYMEX_PATH_STORAGE_H | ||
#define CPROVER_GOTO_SYMEX_PATH_STORAGE_H | ||
|
||
#include "goto_symex_state.h" | ||
#include "symex_target_equation.h" | ||
|
||
#include <util/options.h> | ||
#include <util/cmdline.h> | ||
#include <util/ui_message.h> | ||
#include <util/invariant.h> | ||
#include <util/message.h> | ||
#include <util/options.h> | ||
|
||
#include <analyses/local_safe_pointers.h> | ||
|
||
#include <memory> | ||
|
||
#include "goto_symex_state.h" | ||
#include "symex_target_equation.h" | ||
|
||
/// Functor generating fresh nondet symbols | ||
class symex_nondet_generatort | ||
{ | ||
|
@@ -90,6 +92,12 @@ class path_storaget | |
/// Counter for nondet objects, which require unique names | ||
symex_nondet_generatort build_symex_nondet; | ||
|
||
/// Map function identifiers to \ref local_safe_pointerst instances. This is | ||
/// to identify derferences that are guaranteed to be safe in a given | ||
/// execution context, thus helping to avoid symex to follow spurious | ||
/// error-handling paths. | ||
std::unordered_map<irep_idt, local_safe_pointerst> safe_pointers; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⛏️ You might choose to doxygen this variable, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Documentation added. |
||
|
||
private: | ||
// Derived classes should override these methods, allowing the base class to | ||
// enforce preconditions. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,9 +211,8 @@ void goto_symext::dereference_rec(exprt &expr, statet &state) | |
{ | ||
get_original_name(to_check); | ||
|
||
expr_is_not_null = | ||
state.safe_pointers.at(expr_function).is_safe_dereference( | ||
to_check, state.source.pc); | ||
expr_is_not_null = path_storage.safe_pointers.at(expr_function) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🕊️ |
||
.is_safe_dereference(to_check, state.source.pc); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,7 +240,7 @@ void goto_symext::symex_function_call_code( | |
state.dirty.populate_dirty_for_function(identifier, goto_function); | ||
|
||
auto emplace_safe_pointers_result = | ||
state.safe_pointers.emplace(identifier, local_safe_pointerst{ns}); | ||
path_storage.safe_pointers.emplace(identifier, local_safe_pointerst{}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⛏️ AFAICT this variable renaming should be done in a seperate commit, ideally with an explanation of why this name is more accurate (I don't know this code well enough to comment on whether this is a good renaming or not). 🕊️ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, no, this isn't variable renaming, it's an ownership change. |
||
if(emplace_safe_pointers_result.second) | ||
emplace_safe_pointers_result.first->second(goto_function.body); | ||
|
||
|
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.
⛏️ Ideally this removal would have gone in a different commit with an explanation of why not required.
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.
This PR is now composed of three commits:
base_type_eq
comparison fromlocal_safe_pointerst
.local_safe_pointerst
.goto_symex_statet
topath_storaget
.