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
a02389a8
Commit
a02389a8
authored
3 years ago
by
Virgile Prevosto
Committed by
David Bühler
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[kernel] ast-diff: correspondance between global vars
modulo implementation of correspondance between expressions
parent
40f8bfb1
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/kernel_services/ast_queries/ast_diff.ml
+40
-0
40 additions, 0 deletions
src/kernel_services/ast_queries/ast_diff.ml
with
40 additions
and
0 deletions
src/kernel_services/ast_queries/ast_diff.ml
+
40
−
0
View file @
a02389a8
...
...
@@ -200,6 +200,11 @@ let find_candidate_enuminfo ?loc:_loc ei =
Cil_datatype
.
Global
.
pretty
g
end
else
None
let
find_candidate_varinfo
?
loc
:_
loc
vi
where
=
try
Some
(
Globals
.
Vars
.
find_from_astinfo
vi
.
vname
where
)
with
Not_found
->
None
let
is_same_opt
f
o
o'
=
match
o
,
o'
with
|
None
,
None
->
true
...
...
@@ -247,8 +252,23 @@ and is_same_enuminfo _ei _ei' = false
and
is_same_formal
(
_
,
t
,
a
)
(
_
,
t'
,
a'
)
=
is_same_type
t
t'
&&
Cil_datatype
.
Attributes
.
equal
a
a'
and
is_same_compound_init
(
o
,
i
)
(
o'
,
i'
)
=
is_same_offset
o
o'
&&
is_same_init
i
i'
and
is_same_init
i
i'
=
match
i
,
i'
with
|
SingleInit
e
,
SingleInit
e'
->
is_same_exp
e
e'
|
CompoundInit
(
t
,
l
)
,
CompoundInit
(
t'
,
l'
)
->
is_same_type
t
t'
&&
Logic_utils
.
is_same_list
is_same_compound_init
l
l'
|
(
SingleInit
_
|
CompoundInit
_
)
,
_
->
false
and
is_same_initinfo
i
i'
=
is_same_opt
is_same_init
i
.
init
i'
.
init
and
is_same_exp
_e
_e'
=
false
and
is_same_offset
_o
_o'
=
false
and
typeinfo_correspondance
?
loc
ti
=
let
add
ti
=
match
find_candidate_type
?
loc
ti
with
...
...
@@ -276,9 +296,29 @@ and enuminfo_correspondance ?loc ei =
in
Enuminfo
.
memo
add
ei
let
gvar_correspondance
?
loc
vi
=
let
add
vi
=
match
find_candidate_varinfo
?
loc
vi
Cil_types
.
VGlobal
with
|
None
->
`Not_present
|
Some
vi'
->
let
selection
=
State_selection
.
singleton
Globals
.
Vars
.
self
in
let
init
=
Project
.
on
~
selection
(
Orig_project
.
get
()
)
Globals
.
Vars
.
find
vi
in
let
init'
=
Globals
.
Vars
.
find
vi'
in
if
is_same_initinfo
init
init'
then
`Same
vi'
else
`Not_present
in
Varinfo
.
memo
add
vi
let
global_correspondance
g
=
match
g
with
|
GType
(
ti
,
loc
)
->
ignore
(
typeinfo_correspondance
~
loc
ti
)
|
GCompTag
(
ci
,
loc
)
|
GCompTagDecl
(
ci
,
loc
)
->
ignore
(
compinfo_correspondance
~
loc
ci
)
|
GEnumTag
(
ei
,
loc
)
|
GEnumTagDecl
(
ei
,
loc
)
->
ignore
(
enuminfo_correspondance
~
loc
ei
)
|
GVar
(
vi
,_,
loc
)
|
GVarDecl
(
vi
,
loc
)
->
ignore
(
gvar_correspondance
~
loc
vi
)
|
_
->
()
let
compare_ast
prj
=
...
...
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