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
671dd517
Commit
671dd517
authored
6 years ago
by
Allan Blanchard
Committed by
Virgile Prevosto
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Kernel] Assure that queued or changed instructions remains ghost when needed
parent
a8162067
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/cil.ml
+18
-8
18 additions, 8 deletions
src/kernel_services/ast_queries/cil.ml
with
18 additions
and
8 deletions
src/kernel_services/ast_queries/cil.ml
+
18
−
8
View file @
671dd517
...
...
@@ -277,13 +277,20 @@ let mkStmt ?(ghost=false) ?(valid_sid=false) ?(sattr=[]) (sk: stmtkind) : stmt =
ghost
=
ghost
;
sattr
=
sattr
;}
let
stmt_of_instr_list
?
(
loc
=
Location
.
unknown
)
=
function
(* This function is considered unsafe since the ghost parameter can only be
taken in account if the list contains at least two elements.
It should not be exposed by the API.
*)
let
unsafe_stmt_of_instr_list
?
(
loc
=
Location
.
unknown
)
?
(
ghost
=
false
)
=
function
|
[]
->
Instr
(
Skip
loc
)
|
[
i
]
->
Instr
i
|
il
->
let
b
=
mkBlockNonScoping
(
List
.
map
(
fun
i
->
mkStmt
(
Instr
i
))
il
)
in
let
b
=
mkBlockNonScoping
(
List
.
map
(
fun
i
->
mkStmt
~
ghost
(
Instr
i
))
il
)
in
Block
b
let
stmt_of_instr_list
?
(
loc
=
Location
.
unknown
)
=
unsafe_stmt_of_instr_list
~
loc
~
ghost
:
false
(**** Utility functions ******)
(**** ATTRIBUTES ****)
...
...
@@ -2218,8 +2225,8 @@ let flatten_transient_sub_blocks b =
b
.
bstmts
<-
List
.
concat
(
List
.
map
treat_one_stmt
b
.
bstmts
);
b
let
stmt_of_instr_list_visitor
?
loc
l
=
let
res
=
stmt_of_instr_list
?
loc
l
in
let
stmt_of_instr_list_visitor
?
loc
?
ghost
l
=
let
res
=
unsafe_
stmt_of_instr_list
?
loc
?
ghost
l
in
match
res
with
|
Block
b
->
Block
(
transient_block
b
)
|
_
->
res
...
...
@@ -3351,6 +3358,7 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp =
(* visit all nodes in a Cil statement tree in preorder *)
and
visitCilStmt
(
vis
:
cilVisitor
)
(
s
:
stmt
)
:
stmt
=
let
ghost
=
s
.
ghost
in
let
oldloc
=
CurrentLoc
.
get
()
in
CurrentLoc
.
set
(
Stmt
.
loc
s
)
;
vis
#
push_stmt
s
;
(*(vis#behavior.memo_stmt s);*)
...
...
@@ -3366,8 +3374,8 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp =
|
_
->
let
b
=
mkBlockNonScoping
((
List
.
map
(
fun
i
->
mkStmt
(
Instr
i
))
!
toPrepend
)
@
[
mkStmt
res
.
skind
])
((
List
.
map
(
fun
i
->
mkStmt
~
ghost
(
Instr
i
))
!
toPrepend
)
@
[
mkStmt
~
ghost
res
.
skind
])
in
b
.
battrs
<-
addAttribute
(
Attr
(
vis_tmp_attr
,
[]
))
b
.
battrs
;
(* Make our statement contain the instructions to prepend *)
...
...
@@ -3447,7 +3455,8 @@ and childrenExp (vis: cilVisitor) (e: exp) : exp =
|
Instr
i
->
begin
match
fInst
i
with
|
[
i'
]
when
i'
==
i
->
s
.
skind
|
il
->
stmt_of_instr_list_visitor
~
loc
:
(
Cil_datatype
.
Instr
.
loc
i
)
il
|
il
->
stmt_of_instr_list_visitor
~
ghost
:
s
.
ghost
~
loc
:
(
Cil_datatype
.
Instr
.
loc
i
)
il
end
|
Block
b
->
let
b'
=
fBlock
b
in
...
...
@@ -6638,7 +6647,8 @@ let childrenFileSameGlobals vis f =
List
.
iter
(
fun
s
->
match
s
.
skind
with
|
Instr
i
->
s
.
skind
<-
stmt_of_instr_list
(
doInstrList
[
i
])
|
Instr
i
->
s
.
skind
<-
unsafe_stmt_of_instr_list
~
ghost
:
s
.
ghost
(
doInstrList
[
i
])
|
If
(
_e
,
tb
,
eb
,
_
)
->
peepHole1
doone
tb
.
bstmts
;
peepHole1
doone
eb
.
bstmts
...
...
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