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
59d95406
Commit
59d95406
authored
5 years ago
by
Allan Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
[Builtin] Smarter way to deal with properties
parent
4e3846e7
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/builtin/transform.ml
+15
-19
15 additions, 19 deletions
src/plugins/builtin/transform.ml
with
15 additions
and
19 deletions
src/plugins/builtin/transform.ml
+
15
−
19
View file @
59d95406
...
...
@@ -122,7 +122,7 @@ end
let
validate_property
p
=
Property_status
.
emit
Options
.
emitter
~
hyps
:
[]
p
Property_status
.
True
let
compute_preconditions_statuses
kf
=
let
compute_
call_
preconditions_statuses
kf
=
let
stmt
=
Kernel_function
.
find_first_stmt
kf
in
let
_
=
Kernel_function
.
find_all_enclosing_blocks
stmt
in
match
stmt
.
skind
with
...
...
@@ -135,26 +135,22 @@ let compute_preconditions_statuses kf =
List
.
iter
(
fun
(
_
,
p
)
->
validate_property
p
)
reqs
;
|
_
->
assert
false
let
compute_statuses_all_calls
()
=
let
kfs
=
get_kfs
()
in
List
.
iter
compute_preconditions_statuses
kfs
;
let
module
Kfs
=
Kernel_function
.
Hptset
in
let
open
Property
in
let
kfs
=
List
.
fold_left
(
fun
s
kf
->
Kfs
.
add
kf
s
)
Kfs
.
empty
kfs
in
let
validate_if_builtin_post
ip
=
match
ip
with
(* Constracts of generated functions *)
|
IPPredicate
{
ip_kf
=
kf
;
ip_kind
=
PKEnsures
_
}
|
IPAssigns
{
ias_kf
=
kf
}
|
IPFrom
{
if_kf
=
kf
}
when
Kfs
.
mem
kf
kfs
->
validate_property
ip
|
_
->
()
let
compute_postconditions_statuses
kf
=
let
open
Extlib
in
let
posts
bhv
=
let
active
=
[]
in
let
ensures
=
Property
.
ip_ensures_of_behavior
kf
Kglobal
bhv
in
let
assigns
=
Property
.
ip_assigns_of_behavior
~
active
kf
Kglobal
bhv
in
let
froms
=
Property
.
ip_from_of_behavior
~
active
kf
Kglobal
bhv
in
List
.
iter
validate_property
(
ensures
@
(
list_of_opt
assigns
)
@
froms
)
in
Property_status
.
iter
validate_if_builtin_post
Annotations
.
iter_behaviors
(
fun
_
->
posts
)
kf
let
compute_statuses_all_kfs
()
=
let
kfs
=
get_kfs
()
in
List
.
iter
compute_call_preconditions_statuses
kfs
;
List
.
iter
compute_postconditions_statuses
kfs
let
transform
file
=
Visitor
.
visitFramacFile
(
new
transformer
)
file
;
compute_statuses_all_
call
s
()
compute_statuses_all_
kf
s
()
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