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
4555d28c
Commit
4555d28c
authored
5 years ago
by
Allan Blanchard
Browse files
Options
Downloads
Patches
Plain Diff
[AST Printing] Exposes (private) in_ghost_if_needed in printer_api
parent
45b70e97
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_printing/printer.ml
+1
-15
1 addition, 15 deletions
src/kernel_services/ast_printing/printer.ml
src/kernel_services/ast_printing/printer_api.mli
+16
-0
16 additions, 0 deletions
src/kernel_services/ast_printing/printer_api.mli
with
17 additions
and
15 deletions
src/kernel_services/ast_printing/printer.ml
+
1
−
15
View file @
4555d28c
...
...
@@ -189,20 +189,6 @@ class printer_with_annot () = object (self)
fmt
annots
method
private
in_ghost_if_needed
fmt
ghost_flag
do_it
=
let
display_ghost
=
ghost_flag
&&
not
is_ghost
in
if
display_ghost
then
begin
is_ghost
<-
true
;
Format
.
fprintf
fmt
"@[%t %a@ "
(
fun
fmt
->
self
#
pp_open_annotation
fmt
)
self
#
pp_acsl_keyword
"ghost"
end
;
do_it
()
;
if
display_ghost
then
begin
is_ghost
<-
false
;
Format
.
fprintf
fmt
"%t@]"
(
fun
fmt
->
self
#
pp_close_annotation
fmt
)
end
method
!
annotated_stmt
next
fmt
s
=
(* To debug location setting:
(let loc = fst (Cil_datatype.Stmt.loc s.skind) in
...
...
@@ -227,7 +213,7 @@ class printer_with_annot () = object (self)
Cil_datatype
.
Code_annotation
.
compare
(
Annotations
.
code_annot
s
)
in
self
#
in_ghost_if_needed
fmt
s
.
ghost
self
#
in_ghost_if_needed
fmt
s
.
ghost
~
post_fmt
:
"%t"
(
fun
()
->
match
all_annot
with
|
[]
->
self
#
stmtkind
s
.
sattr
next
fmt
s
.
skind
;
|
[
a
]
when
Cil
.
is_skip
s
.
skind
&&
not
s
.
ghost
->
...
...
This diff is collapsed.
Click to expand it.
src/kernel_services/ast_printing/printer_api.mli
+
16
−
0
View file @
4555d28c
...
...
@@ -78,6 +78,22 @@ class type extensible_printer_type = object
method
private
has_annot
:
bool
(** [true] if [current_stmt] has some annotations attached to it. *)
method
private
in_ghost_if_needed
:
Format
.
formatter
->
bool
->
post_fmt
:
(((
Format
.
formatter
->
unit
)
->
unit
,
Format
.
formatter
,
unit
)
format
)
->
?
block
:
bool
->
(
unit
->
unit
)
->
unit
(** Open a ghost context if the the first [bool] is true and we are not already
in a ghost context. [post_fmt] is a format like ["%t"] and is used to define
the format of the end of the ghost context. [block] indicates whether we
should open a C block or not (and defaults to [true]). The last parameter is
the function to perform in the ghost context (generally some AST element).
@since 19.0-Potassium+dev
*)
method
private
current_stmt
:
stmt
option
(** @return the [stmt] being printed *)
...
...
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