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
b03557d4
Commit
b03557d4
authored
4 years ago
by
Allan Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
[wp] Simplifies vist callees in WpTarget
parent
8d584744
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/WpTarget.ml
+17
-35
17 additions, 35 deletions
src/plugins/wp/WpTarget.ml
with
17 additions
and
35 deletions
src/plugins/wp/WpTarget.ml
+
17
−
35
View file @
b03557d4
...
...
@@ -32,25 +32,15 @@ module TargetKfs =
let
name
=
"WpTarget.TargetKfs"
end
)
let
calls_visitor
callees
=
object
(
self
)
inherit
Visitor
.
frama_c_inplace
method
private
add
kf
=
callees
:=
Fct
.
add
kf
!
callees
method
!
vinst
=
function
|
Call
(
_
,
{
enode
=
Lval
(
Var
vi
,
NoOffset
)
}
,
_
,
_
)
|
Local_init
(
_
,
ConsInit
(
vi
,_,_
)
,_
)
->
let
kf
=
Globals
.
Functions
.
get
vi
in
self
#
add
kf
;
Cil
.
SkipChildren
|
Call
_
->
begin
match
Extlib
.
opt_map
Dyncall
.
get
self
#
current_stmt
with
|
Some
(
Some
(
_
,
l
))
->
List
.
iter
self
#
add
l
|
_
->
()
end
;
Cil
.
SkipChildren
|
_
->
Cil
.
SkipChildren
end
let
get_called_stmt
stmt
=
match
stmt
.
skind
with
|
Instr
(
Call
(
_
,
fct
,
_
,
_
))
->
begin
match
Kernel_function
.
get_called
fct
with
|
Some
kf
->
[
kf
]
|
None
->
Extlib
.(
opt_conv
[]
(
opt_map
snd
(
Dyncall
.
get
stmt
)))
end
|
Instr
(
Local_init
(
_
,
ConsInit
(
vi
,_,_
)
,_
))
->
[
Globals
.
Functions
.
get
vi
]
|
_
->
[]
module
Callees
=
State_builder
.
Hashtbl
...
...
@@ -71,12 +61,13 @@ module Callees =
are under verification.
*)
let
with_callees
kf
=
if
Kernel_function
.
has_definition
kf
then
begin
let
set
=
ref
(
Fct
.
singleton
kf
)
in
ignore
(
Visitor
.
visitFramacKf
(
calls_visitor
set
)
kf
)
;
!
set
end
else
Fct
.
empty
try
let
stmts
=
(
Kernel_function
.
get_definition
kf
)
.
sallstmts
in
let
fold
s
stmt
=
List
.
fold_left
(
fun
s
kf
->
Fct
.
add
kf
s
)
s
(
get_called_stmt
stmt
)
in
List
.
fold_left
fold
(
Fct
.
singleton
kf
)
stmts
with
Kernel_function
.
No_Definition
->
Fct
.
empty
let
with_callees
=
Callees
.
memo
with_callees
...
...
@@ -147,16 +138,7 @@ let check_properties behaviors props kf =
end
kf_behaviors
in
match
stmt
.
skind
with
|
Instr
(
Call
(
_
,
{
enode
=
Lval
(
Var
vi
,
NoOffset
)
}
,
_
,
_
))
|
Instr
(
Local_init
(
_
,
ConsInit
(
vi
,_,_
)
,_
))
->
check_callee
(
Globals
.
Functions
.
get
vi
)
|
Instr
(
Call
_
)
->
begin
match
Dyncall
.
get
stmt
with
|
None
->
()
|
Some
(
_
,
l
)
->
List
.
iter
check_callee
l
end
|
_
->
()
List
.
iter
check_callee
(
get_called_stmt
stmt
)
in
let
check_stmt
stmt
=
check_call
stmt
;
...
...
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