aboutsummaryrefslogtreecommitdiffstats
path: root/cparser/Cleanup.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2015-10-01 09:41:06 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2015-10-01 09:41:06 +0200
commit06a1a35d759dc780e389218b5f78ce3415d4b3cd (patch)
tree963823fdd3a84b946dffefb956a455b5bef26479 /cparser/Cleanup.ml
parent4421b4168ad82d326665662a1a56a4db3cd41a11 (diff)
downloadcompcert-kvx-06a1a35d759dc780e389218b5f78ce3415d4b3cd.tar.gz
compcert-kvx-06a1a35d759dc780e389218b5f78ce3415d4b3cd.zip
Remove unused globals also from the debug informations.
Diffstat (limited to 'cparser/Cleanup.ml')
-rw-r--r--cparser/Cleanup.ml7
1 files changed, 6 insertions, 1 deletions
diff --git a/cparser/Cleanup.ml b/cparser/Cleanup.ml
index 254f6fed..c81fd498 100644
--- a/cparser/Cleanup.ml
+++ b/cparser/Cleanup.ml
@@ -184,6 +184,11 @@ let saturate p =
(* Remove unreferenced definitions *)
+let remove_unused_debug = function
+ | Gdecl (_,id,_,_) -> Debug.remove_unused id
+ | Gfundef f -> Debug.remove_unused f.fd_name
+ | _ -> ()
+
let rec simpl_globdecls accu = function
| [] -> accu
| g :: rem ->
@@ -199,7 +204,7 @@ let rec simpl_globdecls accu = function
| Gpragma s -> true in
if need
then simpl_globdecls (g :: accu) rem
- else simpl_globdecls accu rem
+ else begin remove_unused_debug g.gdesc; simpl_globdecls accu rem end
let program p =
referenced := IdentSet.empty;