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
b05f192a
Commit
b05f192a
authored
4 years ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[logic] improve expr_to_predicate on boolean-like expressions
parent
1f627326
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/kernel_services/ast_queries/logic_utils.ml
+10
-0
10 additions, 0 deletions
src/kernel_services/ast_queries/logic_utils.ml
with
10 additions
and
0 deletions
src/kernel_services/ast_queries/logic_utils.ml
+
10
−
0
View file @
b05f192a
...
...
@@ -442,6 +442,12 @@ let get_float_unop op typ =
|
TFloat
(
fkind
,_
)
,
Neg
->
float_builtin
"neg"
fkind
|
_
->
None
let
is_boolean_exp
e
=
match
e
.
enode
with
|
BinOp
(
op
,_,_,_
)
->
is_boolean_binop
op
|
UnOp
(
LNot
,_,_
)
->
true
|
_
->
false
let
rec
expr_to_term
?
(
coerce
=
false
)
e
=
let
loc
=
e
.
eloc
in
let
typ
=
Cil
.
typeOf
e
in
...
...
@@ -550,6 +556,10 @@ and expr_to_predicate e =
|
BinOp
(
Le
,
a
,
b
,
_
)
->
prel
Rle
a
b
|
BinOp
(
Gt
,
a
,
b
,
_
)
->
prel
Rgt
a
b
|
BinOp
(
Ge
,
a
,
b
,
_
)
->
prel
Rge
a
b
|
BinOp
(
Eq
,
a
,
b
,
_
)
when
Cil
.
isZero
b
&&
is_boolean_exp
a
->
pnot
@@
expr_to_predicate
a
|
BinOp
(
Ne
,
a
,
b
,
_
)
when
Cil
.
isZero
b
&&
is_boolean_exp
a
->
expr_to_predicate
a
|
BinOp
(
Eq
,
a
,
b
,
_
)
->
prel
Req
a
b
|
BinOp
(
Ne
,
a
,
b
,
_
)
->
prel
Rneq
a
b
|
BinOp
(
LAnd
,
a
,
b
,
_
)
->
...
...
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