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
23f2b4bb
Commit
23f2b4bb
authored
2 years ago
by
Virgile Prevosto
Browse files
Options
Downloads
Patches
Plain Diff
[kernel] correspondance -> correspondence in AST diff
parent
c028c472
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/kernel_services/ast_queries/ast_diff.ml
+105
-105
105 additions, 105 deletions
src/kernel_services/ast_queries/ast_diff.ml
src/kernel_services/ast_queries/ast_diff.mli
+37
-37
37 additions, 37 deletions
src/kernel_services/ast_queries/ast_diff.mli
with
142 additions
and
142 deletions
src/kernel_services/ast_queries/ast_diff.ml
+
105
−
105
View file @
23f2b4bb
...
@@ -29,16 +29,16 @@ module Orig_project =
...
@@ -29,16 +29,16 @@ module Orig_project =
let
dependencies
=
[]
let
dependencies
=
[]
end
)
end
)
type
'
a
correspond
a
nce
=
type
'
a
correspond
e
nce
=
[
`Same
of
'
a
(** symbol with identical definition has been found. *)
[
`Same
of
'
a
(** symbol with identical definition has been found. *)
|
`Not_present
(** no correspond
a
nce *)
|
`Not_present
(** no correspond
e
nce *)
]
]
module
Correspond
a
nce_input
=
module
Correspond
e
nce_input
=
struct
struct
type
'
a
t
=
'
a
correspond
a
nce
type
'
a
t
=
'
a
correspond
e
nce
let
name
a
=
Type
.
name
a
^
" correspond
a
nce"
let
name
a
=
Type
.
name
a
^
" correspond
e
nce"
let
module_name
=
"Correspond
a
nce"
let
module_name
=
"Correspond
e
nce"
let
structural_descr
_
=
Structural_descr
.
t_abstract
let
structural_descr
_
=
Structural_descr
.
t_abstract
let
reprs
x
=
[
`Not_present
;
`Same
x
]
let
reprs
x
=
[
`Not_present
;
`Same
x
]
let
mk_equal
eq
x
y
=
let
mk_equal
eq
x
y
=
...
@@ -67,7 +67,7 @@ struct
...
@@ -67,7 +67,7 @@ struct
|
`Same
x
->
mem
query
x
|
`Same
x
->
mem
query
x
end
end
module
Correspond
a
nce
=
Datatype
.
Polymorphic
(
Correspond
a
nce_input
)
module
Correspond
e
nce
=
Datatype
.
Polymorphic
(
Correspond
e
nce_input
)
(* for kernel function, we are a bit more precise than a yes/no answer.
(* for kernel function, we are a bit more precise than a yes/no answer.
More precisely, we check whether a function has the same spec,
More precisely, we check whether a function has the same spec,
...
@@ -75,14 +75,14 @@ module Correspondance = Datatype.Polymorphic(Correspondance_input)
...
@@ -75,14 +75,14 @@ module Correspondance = Datatype.Polymorphic(Correspondance_input)
the body itself is identical, otherwise, there's no point in checking
the body itself is identical, otherwise, there's no point in checking
the callees.
the callees.
*)
*)
type
partial_correspond
a
nce
=
type
partial_correspond
e
nce
=
[
`Spec_changed
(* body and callees haven't changed *)
[
`Spec_changed
(* body and callees haven't changed *)
|
`Body_changed
(* spec hasn't changed *)
|
`Body_changed
(* spec hasn't changed *)
|
`Callees_changed
(* spec and body haven't changed *)
|
`Callees_changed
(* spec and body haven't changed *)
|
`Callees_spec_changed
(* body hasn't changed *)
|
`Callees_spec_changed
(* body hasn't changed *)
]
]
type
body_correspond
a
nce
=
type
body_correspond
e
nce
=
[
`Body_changed
[
`Body_changed
|
`Callees_changed
|
`Callees_changed
|
`Same_body
|
`Same_body
...
@@ -111,24 +111,24 @@ let pretty_pc fmt =
...
@@ -111,24 +111,24 @@ let pretty_pc fmt =
|
`Callees_changed
->
pp_print_string
fmt
"(callees changed)"
|
`Callees_changed
->
pp_print_string
fmt
"(callees changed)"
|
`Callees_spec_changed
->
pp_print_string
fmt
"(callees and spec changed)"
|
`Callees_spec_changed
->
pp_print_string
fmt
"(callees and spec changed)"
type
'
a
code_correspond
a
nce
=
type
'
a
code_correspond
e
nce
=
[
'
a
correspond
a
nce
[
'
a
correspond
e
nce
|
`Partial
of
'
a
*
partial_correspond
a
nce
|
`Partial
of
'
a
*
partial_correspond
e
nce
]
]
module
Code_correspond
a
nce_input
=
module
Code_correspond
e
nce_input
=
struct
struct
type
'
a
t
=
'
a
code_correspond
a
nce
type
'
a
t
=
'
a
code_correspond
e
nce
let
name
a
=
Type
.
name
a
^
" code_correspond
a
nce"
let
name
a
=
Type
.
name
a
^
" code_correspond
e
nce"
let
module_name
=
"Code_correspond
a
nce"
let
module_name
=
"Code_correspond
e
nce"
let
structural_descr
_
=
Structural_descr
.
t_abstract
let
structural_descr
_
=
Structural_descr
.
t_abstract
let
reprs
=
Correspond
a
nce_input
.
reprs
let
reprs
=
Correspond
e
nce_input
.
reprs
let
mk_equal
eq
x
y
=
let
mk_equal
eq
x
y
=
match
x
,
y
with
match
x
,
y
with
|
`Partial
(
x
,
pc
)
,
`Partial
(
x'
,
pc'
)
->
eq
x
x'
&&
(
compare_pc
pc
pc'
=
0
)
|
`Partial
(
x
,
pc
)
,
`Partial
(
x'
,
pc'
)
->
eq
x
x'
&&
(
compare_pc
pc
pc'
=
0
)
|
`Partial
_
,
_
|
_
,
`Partial
_
->
false
|
`Partial
_
,
_
|
_
,
`Partial
_
->
false
|
(
#
correspond
a
nce
as
c
)
,
(
#
correspond
a
nce
as
c'
)
->
|
(
#
correspond
e
nce
as
c
)
,
(
#
correspond
e
nce
as
c'
)
->
Correspond
a
nce_input
.
mk_equal
eq
c
c'
Correspond
e
nce_input
.
mk_equal
eq
c
c'
let
mk_compare
cmp
x
y
=
let
mk_compare
cmp
x
y
=
match
x
,
y
with
match
x
,
y
with
...
@@ -138,28 +138,28 @@ struct
...
@@ -138,28 +138,28 @@ struct
|
`Same
_
,
`Partial
_
->
1
|
`Same
_
,
`Partial
_
->
1
|
`Partial
_
,
`Not_present
->
1
|
`Partial
_
,
`Not_present
->
1
|
`Not_present
,
`Partial
_
->
-
1
|
`Not_present
,
`Partial
_
->
-
1
|
(
#
correspond
a
nce
as
c
)
,
(
#
correspond
a
nce
as
c'
)
->
|
(
#
correspond
e
nce
as
c
)
,
(
#
correspond
e
nce
as
c'
)
->
Correspond
a
nce_input
.
mk_compare
cmp
c
c'
Correspond
e
nce_input
.
mk_compare
cmp
c
c'
let
mk_hash
hash
=
function
let
mk_hash
hash
=
function
|
`Partial
(
x
,_
)
->
57
*
hash
x
|
`Partial
(
x
,_
)
->
57
*
hash
x
|
#
correspond
a
nce
as
x
->
Correspond
a
nce_input
.
mk_hash
hash
x
|
#
correspond
e
nce
as
x
->
Correspond
e
nce_input
.
mk_hash
hash
x
let
map
f
=
function
let
map
f
=
function
|
`Partial
(
x
,
pc
)
->
`Partial
(
f
x
,
pc
)
|
`Partial
(
x
,
pc
)
->
`Partial
(
f
x
,
pc
)
|
(
#
correspond
a
nce
as
x
)
->
Correspond
a
nce_input
.
map
f
x
|
(
#
correspond
e
nce
as
x
)
->
Correspond
e
nce_input
.
map
f
x
let
mk_pretty
pp
fmt
=
function
let
mk_pretty
pp
fmt
=
function
|
`Partial
(
x
,
flags
)
->
|
`Partial
(
x
,
flags
)
->
Format
.
fprintf
fmt
"-> %a %a"
pp
x
pretty_pc
flags
Format
.
fprintf
fmt
"-> %a %a"
pp
x
pretty_pc
flags
|
#
correspond
a
nce
as
x
->
Correspond
a
nce_input
.
mk_pretty
pp
fmt
x
|
#
correspond
e
nce
as
x
->
Correspond
e
nce_input
.
mk_pretty
pp
fmt
x
let
mk_mem_project
f
p
=
function
let
mk_mem_project
f
p
=
function
|
`Partial
(
x
,_
)
->
f
p
x
|
`Partial
(
x
,_
)
->
f
p
x
|
#
correspond
a
nce
as
x
->
Correspond
a
nce_input
.
mk_mem_project
f
p
x
|
#
correspond
e
nce
as
x
->
Correspond
e
nce_input
.
mk_mem_project
f
p
x
end
end
module
Code_correspond
a
nce
=
Datatype
.
Polymorphic
(
Code_correspond
a
nce_input
)
module
Code_correspond
e
nce
=
Datatype
.
Polymorphic
(
Code_correspond
e
nce_input
)
module
Info
(
I
:
sig
val
name
:
string
end
)
=
module
Info
(
I
:
sig
val
name
:
string
end
)
=
(
struct
(
struct
...
@@ -189,13 +189,13 @@ type is_same_env =
...
@@ -189,13 +189,13 @@ type is_same_env =
goto_targets
:
(
stmt
*
stmt
)
list
;
goto_targets
:
(
stmt
*
stmt
)
list
;
}
}
module
type
Correspond
a
nce_table
=
sig
module
type
Correspond
e
nce_table
=
sig
include
State_builder
.
Hashtbl
include
State_builder
.
Hashtbl
val
pretty_data
:
Format
.
formatter
->
data
->
unit
val
pretty_data
:
Format
.
formatter
->
data
->
unit
end
end
module
Build
(
H
:
Datatype
.
S_with_collections
)(
D
:
Datatype
.
S
)
:
module
Build
(
H
:
Datatype
.
S_with_collections
)(
D
:
Datatype
.
S
)
:
Correspond
a
nce_table
with
type
key
=
H
.
t
and
type
data
=
D
.
t
=
Correspond
e
nce_table
with
type
key
=
H
.
t
and
type
data
=
D
.
t
=
struct
struct
include
include
State_builder
.
Hashtbl
(
H
.
Hashtbl
)(
D
)
State_builder
.
Hashtbl
(
H
.
Hashtbl
)(
D
)
...
@@ -203,43 +203,43 @@ struct
...
@@ -203,43 +203,43 @@ struct
let
pretty_data
=
D
.
pretty
let
pretty_data
=
D
.
pretty
end
end
module
Build_correspond
a
nce
(
H
:
Datatype
.
S_with_collections
)
=
module
Build_correspond
e
nce
(
H
:
Datatype
.
S_with_collections
)
=
Build
(
H
)(
Correspond
a
nce
.
Make
(
H
))
Build
(
H
)(
Correspond
e
nce
.
Make
(
H
))
module
Build_code_correspond
a
nce
(
H
:
Datatype
.
S_with_collections
)
=
module
Build_code_correspond
e
nce
(
H
:
Datatype
.
S_with_collections
)
=
Build
(
H
)(
Code_correspond
a
nce
.
Make
(
H
))
Build
(
H
)(
Code_correspond
e
nce
.
Make
(
H
))
module
Varinfo
=
Build_correspond
a
nce
(
Cil_datatype
.
Varinfo
)
module
Varinfo
=
Build_correspond
e
nce
(
Cil_datatype
.
Varinfo
)
module
Compinfo
=
Build_correspond
a
nce
(
Cil_datatype
.
Compinfo
)
module
Compinfo
=
Build_correspond
e
nce
(
Cil_datatype
.
Compinfo
)
module
Enuminfo
=
Build_correspond
a
nce
(
Cil_datatype
.
Enuminfo
)
module
Enuminfo
=
Build_correspond
e
nce
(
Cil_datatype
.
Enuminfo
)
module
Enumitem
=
Build_correspond
a
nce
(
Cil_datatype
.
Enumitem
)
module
Enumitem
=
Build_correspond
e
nce
(
Cil_datatype
.
Enumitem
)
module
Typeinfo
=
Build_correspond
a
nce
(
Cil_datatype
.
Typeinfo
)
module
Typeinfo
=
Build_correspond
e
nce
(
Cil_datatype
.
Typeinfo
)
module
Stmt
=
Build_code_correspond
a
nce
(
Cil_datatype
.
Stmt
)
module
Stmt
=
Build_code_correspond
e
nce
(
Cil_datatype
.
Stmt
)
module
Logic_info
=
Build_correspond
a
nce
(
Cil_datatype
.
Logic_info
)
module
Logic_info
=
Build_correspond
e
nce
(
Cil_datatype
.
Logic_info
)
module
Logic_type_info
=
Build_correspond
a
nce
(
Cil_datatype
.
Logic_type_info
)
module
Logic_type_info
=
Build_correspond
e
nce
(
Cil_datatype
.
Logic_type_info
)
module
Logic_ctor_info
=
Build_correspond
a
nce
(
Cil_datatype
.
Logic_ctor_info
)
module
Logic_ctor_info
=
Build_correspond
e
nce
(
Cil_datatype
.
Logic_ctor_info
)
module
Fieldinfo
=
Build_correspond
a
nce
(
Cil_datatype
.
Fieldinfo
)
module
Fieldinfo
=
Build_correspond
e
nce
(
Cil_datatype
.
Fieldinfo
)
module
Model_info
=
Build_correspond
a
nce
(
Cil_datatype
.
Model_info
)
module
Model_info
=
Build_correspond
e
nce
(
Cil_datatype
.
Model_info
)
module
Logic_var
=
Build_correspond
a
nce
(
Cil_datatype
.
Logic_var
)
module
Logic_var
=
Build_correspond
e
nce
(
Cil_datatype
.
Logic_var
)
module
Kf
=
Kernel_function
module
Kf
=
Kernel_function
module
Kernel_function
=
Build_code_correspond
a
nce
(
Kernel_function
)
module
Kernel_function
=
Build_code_correspond
e
nce
(
Kernel_function
)
module
Fundec
=
Build_correspond
a
nce
(
Cil_datatype
.
Fundec
)
module
Fundec
=
Build_correspond
e
nce
(
Cil_datatype
.
Fundec
)
let
make_correspond
a
nce
candidate
has_same_spec
code_corres
=
let
make_correspond
e
nce
candidate
has_same_spec
code_corres
=
match
has_same_spec
,
code_corres
with
match
has_same_spec
,
code_corres
with
|
false
,
`Body_changed
->
`Not_present
|
false
,
`Body_changed
->
`Not_present
|
false
,
`Callees_changed
->
|
false
,
`Callees_changed
->
...
@@ -281,7 +281,7 @@ let add_locals f f' env =
...
@@ -281,7 +281,7 @@ let add_locals f f' env =
List
.
fold_left2
add_one
env
f
f'
List
.
fold_left2
add_one
env
f
f'
(* local static variables are in fact global. As soon as we have determined
(* local static variables are in fact global. As soon as we have determined
that they have a correspond
a
nce, we add them to the global bindings *)
that they have a correspond
e
nce, we add them to the global bindings *)
let
add_statics
l
l'
=
let
add_statics
l
l'
=
let
add_one
v
v'
=
Varinfo
.
add
v
(
`Same
v'
)
in
let
add_one
v
v'
=
Varinfo
.
add
v
(
`Same
v'
)
in
List
.
iter2
add_one
l
l'
List
.
iter2
add_one
l
l'
...
@@ -306,11 +306,11 @@ let logic_type_vars_env l l' env =
...
@@ -306,11 +306,11 @@ let logic_type_vars_env l l' env =
true
,
{
env
with
logic_type_vars
}
true
,
{
env
with
logic_type_vars
}
end
else
false
,
env
end
else
false
,
env
let
formals_correspond
a
nce
f
f'
=
let
formals_correspond
e
nce
f
f'
=
let
add_one
v
v'
=
Varinfo
.
add
v
(
`Same
v'
)
in
let
add_one
v
v'
=
Varinfo
.
add
v
(
`Same
v'
)
in
List
.
iter2
add_one
f
f'
List
.
iter2
add_one
f
f'
let
logic_prms_correspond
a
nce
p
p'
=
let
logic_prms_correspond
e
nce
p
p'
=
let
add_one
lv
lv'
=
let
add_one
lv
lv'
=
Logic_var
.
add
lv
(
`Same
lv'
)
in
Logic_var
.
add
lv
(
`Same
lv'
)
in
List
.
iter2
add_one
p
p'
List
.
iter2
add_one
p
p'
...
@@ -400,7 +400,7 @@ let check_goto_targets env =
...
@@ -400,7 +400,7 @@ let check_goto_targets env =
|
`Not_present
->
false
|
`Not_present
->
false
|
`Same
s''
|
`Partial
(
s''
,_
)
->
|
`Same
s''
|
`Partial
(
s''
,_
)
->
(* From the goto point of view, what matters is that the targets
(* From the goto point of view, what matters is that the targets
themselves have a correspond
a
nce. If they're e.g. calls to a
themselves have a correspond
e
nce. If they're e.g. calls to a
function that has itself changed, or blocks whose content has
function that has itself changed, or blocks whose content has
changed, it has already been detected when comparing the targets,
changed, it has already been detected when comparing the targets,
and will be dealt with accordingly as the fundec level. *)
and will be dealt with accordingly as the fundec level. *)
...
@@ -553,7 +553,7 @@ and is_same_predicate_node p p' env =
...
@@ -553,7 +553,7 @@ and is_same_predicate_node p p' env =
and
is_same_logic_constant
c
c'
env
=
and
is_same_logic_constant
c
c'
env
=
match
c
,
c'
with
match
c
,
c'
with
|
LEnum
ei
,
LEnum
ei'
->
|
LEnum
ei
,
LEnum
ei'
->
(
match
enumitem_correspond
a
nce
ei
env
with
(
match
enumitem_correspond
e
nce
ei
env
with
|
`Same
ei''
->
Cil_datatype
.
Enumitem
.
equal
ei'
ei''
|
`Same
ei''
->
Cil_datatype
.
Enumitem
.
equal
ei'
ei''
|
`Not_present
->
false
)
|
`Not_present
->
false
)
|
LEnum
_
,
_
|
_
,
LEnum
_
->
false
|
LEnum
_
,
_
|
_
,
LEnum
_
->
false
...
@@ -657,13 +657,13 @@ and is_matching_logic_var lv lv' env =
...
@@ -657,13 +657,13 @@ and is_matching_logic_var lv lv' env =
if
lv
.
lv_name
=
"
\\
exit_status"
&&
lv'
.
lv_name
=
"
\\
exit_status"
if
lv
.
lv_name
=
"
\\
exit_status"
&&
lv'
.
lv_name
=
"
\\
exit_status"
then
begin
Logic_var
.
add
lv
(
`Same
lv'
);
true
end
then
begin
Logic_var
.
add
lv
(
`Same
lv'
);
true
end
else
begin
else
begin
match
logic_var_correspond
a
nce
lv
env
with
match
logic_var_correspond
e
nce
lv
env
with
|
None
->
false
|
None
->
false
|
Some
lv''
->
Cil_datatype
.
Logic_var
.
equal
lv'
lv''
|
Some
lv''
->
Cil_datatype
.
Logic_var
.
equal
lv'
lv''
end
))
end
))
|
_
->
false
|
_
->
false
and
logic_var_correspond
a
nce
lv
env
=
and
logic_var_correspond
e
nce
lv
env
=
match
find_candidate_logic_var
lv
env
with
match
find_candidate_logic_var
lv
env
with
|
None
->
None
|
None
->
None
|
Some
lv'
->
Logic_var
.
add
lv
(
`Same
lv'
);
Some
lv'
|
Some
lv'
->
Logic_var
.
add
lv
(
`Same
lv'
);
Some
lv'
...
@@ -889,20 +889,20 @@ and is_same_type t t' env =
...
@@ -889,20 +889,20 @@ and is_same_type t t' env =
(
var
=
var'
)
&&
(
var
=
var'
)
&&
Cil_datatype
.
Attributes
.
equal
a
a'
Cil_datatype
.
Attributes
.
equal
a
a'
|
TNamed
(
t
,
a
)
,
TNamed
(
t'
,
a'
)
->
|
TNamed
(
t
,
a
)
,
TNamed
(
t'
,
a'
)
->
let
correspond
a
nce
=
typeinfo_correspond
a
nce
t
env
in
let
correspond
e
nce
=
typeinfo_correspond
e
nce
t
env
in
(
match
correspond
a
nce
with
(
match
correspond
e
nce
with
|
`Not_present
->
false
|
`Not_present
->
false
|
`Same
t''
->
Cil_datatype
.
Typeinfo
.
equal
t'
t''
)
&&
|
`Same
t''
->
Cil_datatype
.
Typeinfo
.
equal
t'
t''
)
&&
Cil_datatype
.
Attributes
.
equal
a
a'
Cil_datatype
.
Attributes
.
equal
a
a'
|
TComp
(
c
,
a
)
,
TComp
(
c'
,
a'
)
->
|
TComp
(
c
,
a
)
,
TComp
(
c'
,
a'
)
->
let
correspond
a
nce
=
compinfo_correspond
a
nce
c
env
in
let
correspond
e
nce
=
compinfo_correspond
e
nce
c
env
in
(
match
correspond
a
nce
with
(
match
correspond
e
nce
with
|
`Not_present
->
false
|
`Not_present
->
false
|
`Same
c''
->
Cil_datatype
.
Compinfo
.
equal
c'
c''
)
&&
|
`Same
c''
->
Cil_datatype
.
Compinfo
.
equal
c'
c''
)
&&
Cil_datatype
.
Attributes
.
equal
a
a'
Cil_datatype
.
Attributes
.
equal
a
a'
|
TEnum
(
e
,
a
)
,
TEnum
(
e'
,
a'
)
->
|
TEnum
(
e
,
a
)
,
TEnum
(
e'
,
a'
)
->
let
correspond
a
nce
=
enuminfo_correspond
a
nce
e
env
in
let
correspond
e
nce
=
enuminfo_correspond
e
nce
e
env
in
(
match
correspond
a
nce
with
(
match
correspond
e
nce
with
|
`Not_present
->
false
|
`Not_present
->
false
|
`Same
e''
->
Cil_datatype
.
Enuminfo
.
equal
e'
e''
)
&&
|
`Same
e''
->
Cil_datatype
.
Enuminfo
.
equal
e'
e''
)
&&
Cil_datatype
.
Attributes
.
equal
a
a'
Cil_datatype
.
Attributes
.
equal
a
a'
...
@@ -955,7 +955,7 @@ and is_same_local_init i i' env =
...
@@ -955,7 +955,7 @@ and is_same_local_init i i' env =
if
is_same_varinfo
c
c'
env
&&
if
is_same_varinfo
c
c'
env
&&
is_same_list
is_same_exp
args
args'
env
is_same_list
is_same_exp
args
args'
env
then
begin
then
begin
match
gfun_correspond
a
nce
c
env
with
match
gfun_correspond
e
nce
c
env
with
|
`Partial
_
|
`Not_present
->
`Callees_changed
|
`Partial
_
|
`Not_present
->
`Callees_changed
|
`Same
_
->
`Same_body
|
`Same
_
->
`Same_body
end
else
`Body_changed
end
else
`Body_changed
...
@@ -964,7 +964,7 @@ and is_same_local_init i i' env =
...
@@ -964,7 +964,7 @@ and is_same_local_init i i' env =
and
is_same_constant
c
c'
env
=
and
is_same_constant
c
c'
env
=
match
c
,
c'
with
match
c
,
c'
with
|
CEnum
ei
,
CEnum
ei'
->
|
CEnum
ei
,
CEnum
ei'
->
(
match
enumitem_correspond
a
nce
ei
env
with
(
match
enumitem_correspond
e
nce
ei
env
with
|
`Same
ei''
->
Cil_datatype
.
Enumitem
.
equal
ei'
ei''
|
`Same
ei''
->
Cil_datatype
.
Enumitem
.
equal
ei'
ei''
|
`Not_present
->
false
)
|
`Not_present
->
false
)
|
CEnum
_
,
_
|
_
,
CEnum
_
->
false
|
CEnum
_
,
_
|
_
,
CEnum
_
->
false
...
@@ -1002,7 +1002,7 @@ and is_same_lhost h h' env =
...
@@ -1002,7 +1002,7 @@ and is_same_lhost h h' env =
and
is_matching_varinfo
vi
vi'
env
=
and
is_matching_varinfo
vi
vi'
env
=
if
vi
.
vglob
then
begin
if
vi
.
vglob
then
begin
match
gvar_correspond
a
nce
vi
env
with
match
gvar_correspond
e
nce
vi
env
with
|
`Not_present
->
false
|
`Not_present
->
false
|
`Same
vi''
->
Cil_datatype
.
Varinfo
.
equal
vi'
vi''
|
`Same
vi''
->
Cil_datatype
.
Varinfo
.
equal
vi'
vi''
end
else
begin
end
else
begin
...
@@ -1043,7 +1043,7 @@ and is_same_extended_asm a a' env =
...
@@ -1043,7 +1043,7 @@ and is_same_extended_asm a a' env =
in
in
(
res
,
env
)
&&&
is_same_list_env
bind
a
.
asm_gotos
a'
.
asm_gotos
(
res
,
env
)
&&&
is_same_list_env
bind
a
.
asm_gotos
a'
.
asm_gotos
and
is_same_instr
i
i'
env
:
body_correspond
a
nce
*
is_same_env
=
and
is_same_instr
i
i'
env
:
body_correspond
e
nce
*
is_same_env
=
match
i
,
i'
with
match
i
,
i'
with
|
Set
(
lv
,
e
,_
)
,
Set
(
lv'
,
e'
,_
)
->
|
Set
(
lv
,
e
,_
)
,
Set
(
lv'
,
e'
,_
)
->
if
is_same_lval
lv
lv'
env
&&
is_same_exp
e
e'
env
then
if
is_same_lval
lv
lv'
env
&&
is_same_exp
e
e'
env
then
...
@@ -1056,7 +1056,7 @@ and is_same_instr i i' env: body_correspondance*is_same_env =
...
@@ -1056,7 +1056,7 @@ and is_same_instr i i' env: body_correspondance*is_same_env =
then
begin
then
begin
match
f
.
enode
,
f'
.
enode
with
match
f
.
enode
,
f'
.
enode
with
|
Lval
(
Var
f
,
NoOffset
)
,
Lval
(
Var
f'
,
NoOffset
)
->
|
Lval
(
Var
f
,
NoOffset
)
,
Lval
(
Var
f'
,
NoOffset
)
->
(
match
gfun_correspond
a
nce
f
env
with
(
match
gfun_correspond
e
nce
f
env
with
|
`Partial
_
|
`Not_present
->
`Callees_changed
,
env
|
`Partial
_
|
`Not_present
->
`Callees_changed
,
env
|
`Same
f''
->
|
`Same
f''
->
if
Cil_datatype
.
Varinfo
.
equal
f'
(
Kf
.
get_vi
f''
)
then
if
Cil_datatype
.
Varinfo
.
equal
f'
(
Kf
.
get_vi
f''
)
then
...
@@ -1179,11 +1179,11 @@ and is_same_stmt s s' env =
...
@@ -1179,11 +1179,11 @@ and is_same_stmt s s' env =
|
_
->
`Body_changed
,
env
|
_
->
`Body_changed
,
env
end
else
`Body_changed
,
env
end
else
`Body_changed
,
env
in
in
let
res
=
make_correspond
a
nce
s'
annot_res
code_res
in
let
res
=
make_correspond
e
nce
s'
annot_res
code_res
in
Stmt
.
add
s
res
;
code_res
,
env
Stmt
.
add
s
res
;
code_res
,
env
(* is_same_block will return its modified environment in order
(* is_same_block will return its modified environment in order
to update correspond
a
nce table with respect to locals, in case
to update correspond
e
nce table with respect to locals, in case
the body of the enclosing function is unchanged. *)
the body of the enclosing function is unchanged. *)
and
is_same_block
b
b'
env
=
and
is_same_block
b
b'
env
=
let
local_decls
=
List
.
filter
(
fun
x
->
not
x
.
vdefined
)
b
.
blocals
in
let
local_decls
=
List
.
filter
(
fun
x
->
not
x
.
vdefined
)
b
.
blocals
in
...
@@ -1226,10 +1226,10 @@ and is_same_binder b b' env =
...
@@ -1226,10 +1226,10 @@ and is_same_binder b b' env =
|
Catch_all
,
Catch_all
->
`Same_body
,
env
|
Catch_all
,
Catch_all
->
`Same_body
,
env
|
(
Catch_exn
_
|
Catch_all
)
,
_
->
`Body_changed
,
env
|
(
Catch_exn
_
|
Catch_all
)
,
_
->
`Body_changed
,
env
(* correspond
a
nce of formals is supposed to have already been checked,
(* correspond
e
nce of formals is supposed to have already been checked,
and formals mapping to have been put in the local env
and formals mapping to have been put in the local env
*)
*)
and
is_same_fundec
f
f'
env
:
body_correspond
a
nce
=
and
is_same_fundec
f
f'
env
:
body_correspond
e
nce
=
(* The goto_targets field of [env] accumulates visited goto targets to be
(* The goto_targets field of [env] accumulates visited goto targets to be
verified after the function body. If the given environment is not empty,
verified after the function body. If the given environment is not empty,
resets this field for this function. *)
resets this field for this function. *)
...
@@ -1297,7 +1297,7 @@ and find_candidate_model_info ?loc:_loc mi env =
...
@@ -1297,7 +1297,7 @@ and find_candidate_model_info ?loc:_loc mi env =
in
in
List
.
find_opt
find_one
candidates
List
.
find_opt
find_one
candidates
and
typeinfo_correspond
a
nce
?
loc
ti
env
=
and
typeinfo_correspond
e
nce
?
loc
ti
env
=
let
add
ti
=
let
add
ti
=
match
find_candidate_type
?
loc
ti
with
match
find_candidate_type
?
loc
ti
with
|
None
->
`Not_present
|
None
->
`Not_present
...
@@ -1307,7 +1307,7 @@ and typeinfo_correspondance ?loc ti env =
...
@@ -1307,7 +1307,7 @@ and typeinfo_correspondance ?loc ti env =
in
in
Typeinfo
.
memo
add
ti
Typeinfo
.
memo
add
ti
and
compinfo_correspond
a
nce
?
loc
ci
env
=
and
compinfo_correspond
e
nce
?
loc
ci
env
=
let
add
ci
=
let
add
ci
=
match
find_candidate_compinfo
?
loc
ci
with
match
find_candidate_compinfo
?
loc
ci
with
|
None
->
`Not_present
|
None
->
`Not_present
...
@@ -1337,13 +1337,13 @@ and compinfo_correspondance ?loc ci env =
...
@@ -1337,13 +1337,13 @@ and compinfo_correspondance ?loc ci env =
|
Some
ci'
->
`Same
ci'
|
Some
ci'
->
`Same
ci'
|
None
->
Compinfo
.
memo
add
ci
|
None
->
Compinfo
.
memo
add
ci
and
enuminfo_correspond
a
nce
?
loc
ei
env
=
and
enuminfo_correspond
e
nce
?
loc
ei
env
=
let
add
ei
=
let
add
ei
=
match
find_candidate_enuminfo
?
loc
ei
with
match
find_candidate_enuminfo
?
loc
ei
with
|
None
->
`Not_present
|
None
->
`Not_present
|
Some
ei'
->
|
Some
ei'
->
if
is_same_enuminfo
ei
ei'
env
then
begin
if
is_same_enuminfo
ei
ei'
env
then
begin
(* add items correspond
a
nce. By definition, we have
(* add items correspond
e
nce. By definition, we have
the same number of items here. *)
the same number of items here. *)
List
.
iter2
(
fun
ei
ei'
->
Enumitem
.
add
ei
(
`Same
ei'
))
List
.
iter2
(
fun
ei
ei'
->
Enumitem
.
add
ei
(
`Same
ei'
))
ei
.
eitems
ei'
.
eitems
;
ei
.
eitems
ei'
.
eitems
;
...
@@ -1359,21 +1359,21 @@ and enuminfo_correspondance ?loc ei env =
...
@@ -1359,21 +1359,21 @@ and enuminfo_correspondance ?loc ei env =
(* For now, all enumitems are treated with their parent enuminfo: if
(* For now, all enumitems are treated with their parent enuminfo: if
we don't find one, we let enuminfo_correspondance do the job. *)
we don't find one, we let enuminfo_correspondance do the job. *)
and
enumitem_correspond
a
nce
?
loc
ei
env
=
and
enumitem_correspond
e
nce
?
loc
ei
env
=
let
add
ei
=
let
add
ei
=
match
enuminfo_correspond
a
nce
?
loc
ei
.
eihost
env
with
match
enuminfo_correspond
e
nce
?
loc
ei
.
eihost
env
with
|
`Not_present
->
`Not_present
|
`Not_present
->
`Not_present
|
`Same
_
->
Enumitem
.
find
ei
|
`Same
_
->
Enumitem
.
find
ei
in
in
try
Enumitem
.
find
ei
with
try
Enumitem
.
find
ei
with
|
Not_found
->
add
ei
|
Not_found
->
add
ei
and
gvar_correspond
a
nce
?
loc
vi
env
=
and
gvar_correspond
e
nce
?
loc
vi
env
=
let
add
vi
=
let
add
vi
=
match
find_candidate_varinfo
?
loc
vi
Cil_types
.
VGlobal
with
match
find_candidate_varinfo
?
loc
vi
Cil_types
.
VGlobal
with
|
None
when
Cil
.
isFunctionType
vi
.
vtype
->
|
None
when
Cil
.
isFunctionType
vi
.
vtype
->
begin
begin
match
gfun_correspond
a
nce
?
loc
vi
env
with
match
gfun_correspond
e
nce
?
loc
vi
env
with
|
`Same
kf'
->
`Same
(
Kf
.
get_vi
kf'
)
|
`Same
kf'
->
`Same
(
Kf
.
get_vi
kf'
)
|
`Partial
(
kf'
,_
)
->
|
`Partial
(
kf'
,_
)
->
(* a partial match at kf level is still the
(* a partial match at kf level is still the
...
@@ -1396,8 +1396,8 @@ and gvar_correspondance ?loc vi env =
...
@@ -1396,8 +1396,8 @@ and gvar_correspondance ?loc vi env =
in
in
Varinfo
.
memo
add
vi
Varinfo
.
memo
add
vi
and
gfun_correspond
a
nce
?
loc
vi
env
=
and
gfun_correspond
e
nce
?
loc
vi
env
=
(* NB: we also take care of the correspond
a
nce between the underlying varinfo,
(* NB: we also take care of the correspond
e
nce between the underlying varinfo,
in case we have to refer to it directly, e.g. as an AddrOf argument.
in case we have to refer to it directly, e.g. as an AddrOf argument.
*)
*)
let
kf
=
get_original_kf
vi
in
let
kf
=
get_original_kf
vi
in
...
@@ -1415,7 +1415,7 @@ and gfun_correspondance ?loc vi env =
...
@@ -1415,7 +1415,7 @@ and gfun_correspondance ?loc vi env =
(* from a variable point of view, e.g. if we take its address,
(* from a variable point of view, e.g. if we take its address,
they are similar *)
they are similar *)
Varinfo
.
add
vi
(
`Same
(
Kf
.
get_vi
kf'
));
Varinfo
.
add
vi
(
`Same
(
Kf
.
get_vi
kf'
));
(* we only add formals to global correspond
a
nce tables if some
(* we only add formals to global correspond
e
nce tables if some
part of the kf is unchanged (otherwise, we can't reuse information
part of the kf is unchanged (otherwise, we can't reuse information
about the formals anyways). Hence, we only add them into the local
about the formals anyways). Hence, we only add them into the local
env for now. *)
env for now. *)
...
@@ -1430,10 +1430,10 @@ and gfun_correspondance ?loc vi env =
...
@@ -1430,10 +1430,10 @@ and gfun_correspondance ?loc vi env =
|
true
,
true
->
|
true
,
true
->
is_same_fundec
(
Kf
.
get_definition
kf
)
(
Kf
.
get_definition
kf'
)
env
is_same_fundec
(
Kf
.
get_definition
kf
)
(
Kf
.
get_definition
kf'
)
env
in
in
let
res
=
make_correspond
a
nce
kf'
same_spec
same_body
in
let
res
=
make_correspond
e
nce
kf'
same_spec
same_body
in
(
match
res
with
(
match
res
with
|
`Not_present
->
()
|
`Not_present
->
()
|
`Same
_
|
`Partial
_
->
formals_correspond
a
nce
formals
formals'
);
|
`Same
_
|
`Partial
_
->
formals_correspond
e
nce
formals
formals'
);
res
res
end
else
begin
end
else
begin
(* signatures do not match, we consider that pointers
(* signatures do not match, we consider that pointers
...
@@ -1454,7 +1454,7 @@ and is_matching_logic_info li li' env =
...
@@ -1454,7 +1454,7 @@ and is_matching_logic_info li li' env =
|
`Same
li''
->
Cil_datatype
.
Logic_info
.
equal
li'
li''
|
`Same
li''
->
Cil_datatype
.
Logic_info
.
equal
li'
li''
|
exception
Not_found
->
|
exception
Not_found
->
begin
begin
let
res
=
logic_info_correspond
a
nce
li
env
in
let
res
=
logic_info_correspond
e
nce
li
env
in
Logic_info
.
add
li
res
;
Logic_info
.
add
li
res
;
match
res
with
match
res
with
|
`Not_present
->
false
|
`Not_present
->
false
...
@@ -1462,7 +1462,7 @@ and is_matching_logic_info li li' env =
...
@@ -1462,7 +1462,7 @@ and is_matching_logic_info li li' env =
end
)
end
)
|
Some
li''
->
Cil_datatype
.
Logic_info
.
equal
li'
li''
|
Some
li''
->
Cil_datatype
.
Logic_info
.
equal
li'
li''
and
logic_info_correspond
a
nce
?
loc
li
env
=
and
logic_info_correspond
e
nce
?
loc
li
env
=
let
add
li
=
let
add
li
=
match
find_candidate_logic_info
?
loc
li
env
with
match
find_candidate_logic_info
?
loc
li
env
with
|
None
->
`Not_present
|
None
->
`Not_present
...
@@ -1473,7 +1473,7 @@ and logic_info_correspondance ?loc li env =
...
@@ -1473,7 +1473,7 @@ and logic_info_correspondance ?loc li env =
in
in
let
res
=
is_same_logic_info
li
li'
env
in
let
res
=
is_same_logic_info
li
li'
env
in
if
res
then
begin
if
res
then
begin
logic_prms_correspond
a
nce
li
.
l_profile
li'
.
l_profile
;
logic_prms_correspond
e
nce
li
.
l_profile
li'
.
l_profile
;
`Same
li'
`Same
li'
end
else
`Not_present
end
else
`Not_present
in
in
...
@@ -1487,7 +1487,7 @@ and is_matching_logic_ctor c c' env =
...
@@ -1487,7 +1487,7 @@ and is_matching_logic_ctor c c' env =
|
`Same
c''
->
Cil_datatype
.
Logic_ctor_info
.
equal
c'
c''
|
`Same
c''
->
Cil_datatype
.
Logic_ctor_info
.
equal
c'
c''
|
exception
Not_found
->
|
exception
Not_found
->
let
ty
=
c
.
ctor_type
in
let
ty
=
c
.
ctor_type
in
let
res
=
logic_type_correspond
a
nce
ty
env
in
let
res
=
logic_type_correspond
e
nce
ty
env
in
Logic_type_info
.
add
ty
res
;
Logic_type_info
.
add
ty
res
;
if
not
(
Logic_ctor_info
.
mem
c
)
then
if
not
(
Logic_ctor_info
.
mem
c
)
then
Kernel
.
fatal
"Unbound logic type constructor %a in AST diff"
Kernel
.
fatal
"Unbound logic type constructor %a in AST diff"
...
@@ -1502,13 +1502,13 @@ and is_matching_logic_type_info t t' env =
...
@@ -1502,13 +1502,13 @@ and is_matching_logic_type_info t t' env =
(
match
Cil_datatype
.
Logic_type_info
.
Map
.
find_opt
t
env
.
logic_type_info
with
(
match
Cil_datatype
.
Logic_type_info
.
Map
.
find_opt
t
env
.
logic_type_info
with
|
Some
t''
->
Cil_datatype
.
Logic_type_info
.
equal
t'
t''
|
Some
t''
->
Cil_datatype
.
Logic_type_info
.
equal
t'
t''
|
None
->
|
None
->
let
res
=
logic_type_correspond
a
nce
t
env
in
let
res
=
logic_type_correspond
e
nce
t
env
in
Logic_type_info
.
add
t
res
;
Logic_type_info
.
add
t
res
;
(
match
res
with
(
match
res
with
|
`Same
t''
->
Cil_datatype
.
Logic_type_info
.
equal
t'
t''
|
`Same
t''
->
Cil_datatype
.
Logic_type_info
.
equal
t'
t''
|
`Not_present
->
false
))
|
`Not_present
->
false
))
and
logic_type_correspond
a
nce
?
loc
ti
env
=
and
logic_type_correspond
e
nce
?
loc
ti
env
=
let
add
ti
=
let
add
ti
=
match
find_candidate_logic_type
?
loc
ti
with
match
find_candidate_logic_type
?
loc
ti
with
|
None
->
`Not_present
|
None
->
`Not_present
...
@@ -1527,7 +1527,7 @@ and logic_type_correspondance ?loc ti env =
...
@@ -1527,7 +1527,7 @@ and logic_type_correspondance ?loc ti env =
|
Some
ti'
->
`Same
ti'
|
Some
ti'
->
`Same
ti'
|
None
->
Logic_type_info
.
memo
add
ti
|
None
->
Logic_type_info
.
memo
add
ti
let
model_info_correspond
a
nce
?
loc
mi
=
let
model_info_correspond
e
nce
?
loc
mi
=
let
add
mi
=
let
add
mi
=
match
find_candidate_model_info
?
loc
mi
empty_env
with
match
find_candidate_model_info
?
loc
mi
empty_env
with
|
None
->
`Not_present
|
None
->
`Not_present
...
@@ -1537,49 +1537,49 @@ let model_info_correspondance ?loc mi =
...
@@ -1537,49 +1537,49 @@ let model_info_correspondance ?loc mi =
in
in
Model_info
.
memo
add
mi
Model_info
.
memo
add
mi
let
rec
gannot_correspond
a
nce
=
let
rec
gannot_correspond
e
nce
=
function
function
|
Dfun_or_pred
(
li
,
loc
)
->
|
Dfun_or_pred
(
li
,
loc
)
->
ignore
(
logic_info_correspond
a
nce
~
loc
li
empty_env
)
ignore
(
logic_info_correspond
e
nce
~
loc
li
empty_env
)
|
Dvolatile
_
->
()
|
Dvolatile
_
->
()
(* reading and writing function themselves will be checked elsewhere. *)
(* reading and writing function themselves will be checked elsewhere. *)
|
Daxiomatic
(
_
,
l
,_,_
)
->
|
Daxiomatic
(
_
,
l
,_,_
)
->
List
.
iter
gannot_correspond
a
nce
l
List
.
iter
gannot_correspond
e
nce
l
|
Dtype
(
ti
,
loc
)
->
ignore
(
logic_type_correspond
a
nce
~
loc
ti
empty_env
)
|
Dtype
(
ti
,
loc
)
->
ignore
(
logic_type_correspond
e
nce
~
loc
ti
empty_env
)
|
Dlemma
_
->
()
|
Dlemma
_
->
()
(* TODO: we currently do not have any appropriate structure for
(* TODO: we currently do not have any appropriate structure for
storing information about lemmas. *)
storing information about lemmas. *)
|
Dinvariant
(
li
,
loc
)
->
|
Dinvariant
(
li
,
loc
)
->
ignore
(
logic_info_correspond
a
nce
~
loc
li
empty_env
)
ignore
(
logic_info_correspond
e
nce
~
loc
li
empty_env
)
|
Dtype_annot
(
li
,
loc
)
->
|
Dtype_annot
(
li
,
loc
)
->
ignore
(
logic_info_correspond
a
nce
~
loc
li
empty_env
)
ignore
(
logic_info_correspond
e
nce
~
loc
li
empty_env
)
|
Dmodel_annot
(
mi
,
loc
)
->
|
Dmodel_annot
(
mi
,
loc
)
->
ignore
(
model_info_correspond
a
nce
~
loc
mi
)
ignore
(
model_info_correspond
e
nce
~
loc
mi
)
|
Dextended
_
->
()
|
Dextended
_
->
()
(* TODO: provide mechanism for extension themselves
(* TODO: provide mechanism for extension themselves
to give relevant information. *)
to give relevant information. *)
let
global_correspond
a
nce
g
=
let
global_correspond
e
nce
g
=
match
g
with
match
g
with
|
GType
(
ti
,
loc
)
->
ignore
(
typeinfo_correspond
a
nce
~
loc
ti
empty_env
)
|
GType
(
ti
,
loc
)
->
ignore
(
typeinfo_correspond
e
nce
~
loc
ti
empty_env
)
|
GCompTag
(
ci
,
loc
)
|
GCompTagDecl
(
ci
,
loc
)
->
|
GCompTag
(
ci
,
loc
)
|
GCompTagDecl
(
ci
,
loc
)
->
ignore
(
compinfo_correspond
a
nce
~
loc
ci
empty_env
)
ignore
(
compinfo_correspond
e
nce
~
loc
ci
empty_env
)
|
GEnumTag
(
ei
,
loc
)
|
GEnumTagDecl
(
ei
,
loc
)
->
|
GEnumTag
(
ei
,
loc
)
|
GEnumTagDecl
(
ei
,
loc
)
->
ignore
(
enuminfo_correspond
a
nce
~
loc
ei
empty_env
)
ignore
(
enuminfo_correspond
e
nce
~
loc
ei
empty_env
)
|
GVar
(
vi
,_,
loc
)
|
GVarDecl
(
vi
,
loc
)
->
|
GVar
(
vi
,_,
loc
)
|
GVarDecl
(
vi
,
loc
)
->
ignore
(
gvar_correspond
a
nce
~
loc
vi
empty_env
)
ignore
(
gvar_correspond
e
nce
~
loc
vi
empty_env
)
|
GFunDecl
(
_
,
vi
,
loc
)
->
ignore
(
gfun_correspond
a
nce
~
loc
vi
empty_env
)
|
GFunDecl
(
_
,
vi
,
loc
)
->
ignore
(
gfun_correspond
e
nce
~
loc
vi
empty_env
)
|
GFun
(
f
,
loc
)
->
ignore
(
gfun_correspond
a
nce
~
loc
f
.
svar
empty_env
)
|
GFun
(
f
,
loc
)
->
ignore
(
gfun_correspond
e
nce
~
loc
f
.
svar
empty_env
)
|
GAnnot
(
g
,_
)
->
gannot_correspond
a
nce
g
|
GAnnot
(
g
,_
)
->
gannot_correspond
e
nce
g
|
GAsm
_
|
GPragma
_
|
GText
_
->
()
|
GAsm
_
|
GPragma
_
|
GText
_
->
()
let
compare_ast
()
=
let
compare_ast
()
=
let
prj
=
Orig_project
.
get
()
in
let
prj
=
Orig_project
.
get
()
in
let
ast
=
Project
.
on
prj
Ast
.
get
()
in
let
ast
=
Project
.
on
prj
Ast
.
get
()
in
Cil
.
iterGlobals
ast
global_correspond
a
nce
Cil
.
iterGlobals
ast
global_correspond
e
nce
let
compare_from_prj
prj
=
let
compare_from_prj
prj
=
Orig_project
.
set
prj
;
Orig_project
.
set
prj
;
...
...
This diff is collapsed.
Click to expand it.
src/kernel_services/ast_queries/ast_diff.mli
+
37
−
37
View file @
23f2b4bb
...
@@ -30,10 +30,10 @@ open Cil_types
...
@@ -30,10 +30,10 @@ open Cil_types
(** the original project from which a diff is computed. *)
(** the original project from which a diff is computed. *)
module
Orig_project
:
State_builder
.
Option_ref
with
type
data
=
Project
.
t
module
Orig_project
:
State_builder
.
Option_ref
with
type
data
=
Project
.
t
(** possible correspond
a
nces between new items and original ones. *)
(** possible correspond
e
nces between new items and original ones. *)
type
'
a
correspond
a
nce
=
type
'
a
correspond
e
nce
=
[
`Same
of
'
a
(** symbol with identical definition has been found. *)
[
`Same
of
'
a
(** symbol with identical definition has been found. *)
|
`Not_present
(** no correspond
a
nce *)
|
`Not_present
(** no correspond
e
nce *)
]
]
(** for kernel function, we are a bit more precise than a yes/no answer.
(** for kernel function, we are a bit more precise than a yes/no answer.
...
@@ -42,80 +42,80 @@ type 'a correspondance =
...
@@ -42,80 +42,80 @@ type 'a correspondance =
the body itself is identical, otherwise, there's no point in checking
the body itself is identical, otherwise, there's no point in checking
the callees.
the callees.
*)
*)
type
partial_correspond
a
nce
=
type
partial_correspond
e
nce
=
[
`Spec_changed
(** body and callees haven't changed *)
[
`Spec_changed
(** body and callees haven't changed *)
|
`Body_changed
(** spec hasn't changed *)
|
`Body_changed
(** spec hasn't changed *)
|
`Callees_changed
(** spec and body haven't changed *)
|
`Callees_changed
(** spec and body haven't changed *)
|
`Callees_spec_changed
(** body hasn't changed *)
|
`Callees_spec_changed
(** body hasn't changed *)
]
]
type
'
a
code_correspond
a
nce
=
type
'
a
code_correspond
e
nce
=
[
'
a
correspond
a
nce
[
'
a
correspond
e
nce
|
`Partial
of
'
a
*
partial_correspond
a
nce
|
`Partial
of
'
a
*
partial_correspond
e
nce
]
]
module
type
Correspond
a
nce_table
=
sig
module
type
Correspond
e
nce_table
=
sig
include
State_builder
.
Hashtbl
include
State_builder
.
Hashtbl
val
pretty_data
:
Format
.
formatter
->
data
->
unit
val
pretty_data
:
Format
.
formatter
->
data
->
unit
end
end
(** varinfos correspond
a
nces *)
(** varinfos correspond
e
nces *)
module
Varinfo
:
module
Varinfo
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
varinfo
and
type
data
=
varinfo
correspond
a
nce
with
type
key
=
varinfo
and
type
data
=
varinfo
correspond
e
nce
module
Compinfo
:
module
Compinfo
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
compinfo
and
type
data
=
compinfo
correspond
a
nce
with
type
key
=
compinfo
and
type
data
=
compinfo
correspond
e
nce
module
Enuminfo
:
module
Enuminfo
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
enuminfo
and
type
data
=
enuminfo
correspond
a
nce
with
type
key
=
enuminfo
and
type
data
=
enuminfo
correspond
e
nce
module
Enumitem
:
module
Enumitem
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
enumitem
and
type
data
=
enumitem
correspond
a
nce
with
type
key
=
enumitem
and
type
data
=
enumitem
correspond
e
nce
module
Typeinfo
:
module
Typeinfo
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
typeinfo
and
type
data
=
typeinfo
correspond
a
nce
with
type
key
=
typeinfo
and
type
data
=
typeinfo
correspond
e
nce
module
Stmt
:
module
Stmt
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
stmt
and
type
data
=
stmt
code_correspond
a
nce
with
type
key
=
stmt
and
type
data
=
stmt
code_correspond
e
nce
module
Logic_info
:
module
Logic_info
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
logic_info
and
type
data
=
logic_info
correspond
a
nce
with
type
key
=
logic_info
and
type
data
=
logic_info
correspond
e
nce
module
Logic_type_info
:
module
Logic_type_info
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
logic_type_info
and
type
data
=
logic_type_info
correspond
a
nce
with
type
key
=
logic_type_info
and
type
data
=
logic_type_info
correspond
e
nce
module
Logic_ctor_info
:
module
Logic_ctor_info
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
logic_ctor_info
and
type
data
=
logic_ctor_info
correspond
a
nce
with
type
key
=
logic_ctor_info
and
type
data
=
logic_ctor_info
correspond
e
nce
module
Fieldinfo
:
module
Fieldinfo
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
fieldinfo
and
type
data
=
fieldinfo
correspond
a
nce
with
type
key
=
fieldinfo
and
type
data
=
fieldinfo
correspond
e
nce
module
Model_info
:
module
Model_info
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
model_info
and
type
data
=
model_info
correspond
a
nce
with
type
key
=
model_info
and
type
data
=
model_info
correspond
e
nce
module
Logic_var
:
module
Logic_var
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
logic_var
and
type
data
=
logic_var
correspond
a
nce
with
type
key
=
logic_var
and
type
data
=
logic_var
correspond
e
nce
module
Kernel_function
:
module
Kernel_function
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
kernel_function
with
type
key
=
kernel_function
and
type
data
=
kernel_function
code_correspond
a
nce
and
type
data
=
kernel_function
code_correspond
e
nce
module
Fundec
:
module
Fundec
:
Correspond
a
nce_table
Correspond
e
nce_table
with
type
key
=
fundec
and
type
data
=
fundec
correspond
a
nce
with
type
key
=
fundec
and
type
data
=
fundec
correspond
e
nce
(** performs a comparison of AST between the current and the original
(** performs a comparison of AST between the current and the original
project, which must have been set beforehand.
project, which must have been set beforehand.
...
...
This diff is collapsed.
Click to expand it.
Virgile Prevosto
@virgile
mentioned in issue
#2619 (closed)
·
2 years ago
mentioned in issue
#2619 (closed)
mentioned in issue #2619
Toggle commit list
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