20#ifndef GOTO_PROGRAMS_FRAME_ENFORCER_H
21#define GOTO_PROGRAMS_FRAME_ENFORCER_H
61 const std::vector<expr2tc> &vars_to_snapshot,
64 const std::string &scope_prefix);
78 const std::vector<expr2tc> &explicit_assigns,
114 return active_snapshots;
165 std::vector<snapshot_entryt> active_snapshots;
168 size_t snapshot_counter;
178 expr2tc create_snapshot_symbol(
180 const std::string &prefix,
expr2tc replace_old_with_snapshots(const expr2tc &expr) const
Replace old() references in an expression with snapshot variables.
Definition frame_enforcer.cpp:618
expr2tc in_pre_state(const expr2tc &expr) const
Rewrite expr to denote what it denoted before the havoc or call, by substituting each snapshotted sym...
Definition frame_enforcer.cpp:588
const std::vector< snapshot_entryt > & get_active_snapshots() const
Get the active snapshots (for debugging/inspection).
Definition frame_enforcer.h:112
void enforce_frame_rule(const std::vector< expr2tc > &explicit_assigns, goto_programt &dest, const locationt &loc, frame_modet mode=frame_modet::ASSUME)
Enforce frame rule with configurable mode.
Definition frame_enforcer.cpp:429
void patch_old_snapshot_assigns(goto_programt &prog) const
Patch old_snapshot side effects in a GOTO program to use frame snapshots.
Definition frame_enforcer.cpp:543
void materialize_snapshots(const std::vector< expr2tc > &vars_to_snapshot, goto_programt &dest, const locationt &loc, const std::string &scope_prefix)
Materialize snapshots for a set of variables.
Definition frame_enforcer.cpp:18
frame_enforcert(contextt &_context)
Definition frame_enforcer.cpp:13
static classified_assignst classify_assigns_targets(const std::vector< expr2tc > &explicit_assigns)
Classify assigns targets into direct and pointer categories.
Definition frame_enforcer.cpp:90
static std::vector< expr2tc > collect_global_variables(const contextt &context)
Collect all accessible global variables from the symbol table.
Definition frame_enforcer.cpp:508
A generic container class for a control flow graph for one function, in the form of a goto-program.
Definition goto_program.h:63
frame_modet
Enforcement mode: ASSUME constrains search space (loops), ASSERT checks compliance (contracts).
Definition frame_enforcer.h:33
@ ASSUME
Definition frame_enforcer.h:34
@ ASSERT
Definition goto_program.h:32
@ ASSUME
Definition goto_program.h:31
irep_container< expr2t > expr2tc
Definition irep2.h:431
Classification of assigns targets into direct, pointer, and struct-field categories.
Definition frame_enforcer.h:130
std::map< irep_idt, std::vector< expr2tc > > array_elem_targets
Array-element targets: maps an array symbol name to the indices the clause names.
Definition frame_enforcer.h:150
std::map< irep_idt, std::set< irep_idt > > ptr_field_targets
Pointer-struct-field targets: maps pointer symbol name to the set of field names explicitly assigned ...
Definition frame_enforcer.h:145
std::vector< expr2tc > direct_targets
Non-pointer targets matched structurally.
Definition frame_enforcer.h:132
std::map< irep_idt, std::set< irep_idt > > struct_field_targets
Direct struct field targets: maps global struct symbol name to the set of field names explicitly assi...
Definition frame_enforcer.h:140
std::vector< expr2tc > pointer_targets
Pointer-typed targets from *ptr pattern.
Definition frame_enforcer.h:134
Snapshot entry: maps an original expression to its snapshot symbol.
Definition frame_enforcer.h:43
expr2tc snapshot_sym
The snapshot symbol (e.g., "__ESBMC_frame_snap_loop_0_i").
Definition frame_enforcer.h:45
expr2tc original_expr
The variable being snapshotted (e.g., "i").
Definition frame_enforcer.h:44