Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
ba19bf57
Commit
ba19bf57
authored
4 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] In locals_scoping, implements the substitution of local and formal variables.
parent
85c58cde
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/value/domains/cvalue/locals_scoping.ml
+26
-0
26 additions, 0 deletions
src/plugins/value/domains/cvalue/locals_scoping.ml
src/plugins/value/domains/cvalue/locals_scoping.mli
+2
-0
2 additions, 0 deletions
src/plugins/value/domains/cvalue/locals_scoping.mli
with
28 additions
and
0 deletions
src/plugins/value/domains/cvalue/locals_scoping.ml
+
26
−
0
View file @
ba19bf57
...
@@ -128,6 +128,32 @@ let make_escaping_fundec fundec clob vars state =
...
@@ -128,6 +128,32 @@ let make_escaping_fundec fundec clob vars state =
make_escaping
~
exact
:
true
~
escaping
~
on_escaping
~
within
:
clob
.
clob
state
make_escaping
~
exact
:
true
~
escaping
~
on_escaping
~
within
:
clob
.
clob
state
let
substitute
substitution
clob
state
=
(* Clean [offsm], and bind it to [base] if it is modified. *)
let
replace_offsm
base
offsm
state
=
let
f
v
=
snd
(
Cvalue
.
V_Or_Uninitialized
.
replace_base
substitution
v
)
in
let
offsm'
=
Cvalue
.
V_Offsetmap
.
map_on_values
f
offsm
in
if
Cvalue
.
V_Offsetmap
.
equal
offsm'
offsm
then
state
else
Cvalue
.
Model
.
add_base
base
offsm'
state
in
(* Clean the offsetmap bound to [base] in [state] *)
let
replace_base
base
state
=
try
match
Cvalue
.
Model
.
find_base
base
state
with
|
`Top
|
`Bottom
->
state
|
`Value
offsm
->
replace_offsm
base
offsm
state
with
Not_found
->
state
in
(* Iterate on all the bases that might contain a variable to substitute *)
try
Base
.
SetLattice
.
fold
replace_base
clob
.
clob
(
replace_base
Base
.
null
state
)
with
Abstract_interp
.
Error_Top
->
(* [clob] is too imprecise. Iterate on the entire memory state instead,
which is much slower. *)
match
state
with
|
Cvalue
.
Model
.
Top
|
Cvalue
.
Model
.
Bottom
->
state
|
Cvalue
.
Model
.
Map
map
->
Cvalue
.
Model
.
fold
replace_offsm
map
state
(*
(*
Local Variables:
Local Variables:
compile-command: "make -C ../../../../.."
compile-command: "make -C ../../../../.."
...
...
This diff is collapsed.
Click to expand it.
src/plugins/value/domains/cvalue/locals_scoping.mli
+
2
−
0
View file @
ba19bf57
...
@@ -70,6 +70,8 @@ val make_escaping_fundec:
...
@@ -70,6 +70,8 @@ val make_escaping_fundec:
[fdec] is used to detect whether we are deallocating the outer scope of a
[fdec] is used to detect whether we are deallocating the outer scope of a
function, in which case a different warning is emitted. *)
function, in which case a different warning is emitted. *)
val
substitute
:
Base
.
substitution
->
clobbered_set
->
Cvalue
.
Model
.
t
->
Cvalue
.
Model
.
t
(*
(*
Local Variables:
Local Variables:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment