Skip to content
Snippets Groups Projects
Commit 89c4ee50 authored by Valentin Perrelle's avatar Valentin Perrelle Committed by David Bühler
Browse files

[kernel] Printer_tag add tags only to direct types

parent 59d3d7eb
No related branches found
No related tags found
No related merge requests found
......@@ -815,12 +815,41 @@ struct
Format.fprintf fmt "@{<%s>%a@}" tag (super#stmtkind sattr next) sk
method! typ ?fundecl fmt_opt fmt typ =
(* Extracted from Cil_printer *)
let pname fmt space = match fmt_opt with
| None -> ()
| Some d -> Format.fprintf fmt "%s%t" (if space then " " else "") d
in
match fundecl with
| Some _ -> super#typ ?fundecl fmt_opt fmt typ
| None ->
Format.fprintf fmt "@{<%s>%a@}"
(Tag.create (PType typ))
(super#typ ?fundecl fmt_opt) typ
match typ with
| TNamed (t, a) ->
Format.fprintf fmt "@{<%s>%a@}%a%a"
(Tag.create (PType (TNamed (t, []))))
self#varname t.tname
self#attributes a
pname true
| TComp (comp, a) ->
Format.fprintf fmt
"@{<%s>%a %a@}%a%a"
(Tag.create (PType (TComp (comp, []))))
self#pp_keyword (if comp.cstruct then "struct" else "union")
self#varname comp.cname
self#attributes a
pname true
| TEnum (enum, a) ->
Format.fprintf fmt "@{<%s>%a %a@}%a%a"
(Tag.create (PType (TEnum (enum, []))))
self#pp_keyword "enum"
self#varname enum.ename
self#attributes a
pname true
| _ ->
super#typ ?fundecl fmt_opt fmt typ
initializer force_brace <- true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment