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
5546f53d
Commit
5546f53d
authored
2 years ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[devman] fix visitor example following SO question
See
https://stackoverflow.com/questions/73094227/how-do-i-declare-a-logic-variable
parent
f2d5f39a
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
doc/developer/examples/syntactic_check.ml
+6
-0
6 additions, 0 deletions
doc/developer/examples/syntactic_check.ml
with
6 additions
and
0 deletions
doc/developer/examples/syntactic_check.ml
+
6
−
0
View file @
5546f53d
...
...
@@ -31,6 +31,12 @@ class non_zero_divisor prj = object (self)
(* A division is an expression: we override the vexpr method *)
method
!
vexpr
e
=
match
e
.
enode
with
|
BinOp
((
Div
|
Mod
)
,
_
,
denom
,
_
)
->
(* denom might contain references to variables. Since we haven't visited
the node yet, they're bound to the varinfo of the original project.
we perform a plain copy, which will just ensure that they are replaced
with varinfos of the new project: frama_c_plain_copy is a visitor that
performs a copy, using the same correspondance tables as self. *)
let
denom
=
Visitor
.
visitFramacExpr
self
#
frama_c_plain_copy
denom
in
let
logic_denom
=
Logic_utils
.
expr_to_term
~
coerce
:
false
denom
in
let
assertion
=
Logic_const
.
prel
(
Rneq
,
logic_denom
,
Cil
.
lzero
()
)
in
(* At this point, we have built the assertion we want to insert. It remains
...
...
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