aboutsummaryrefslogtreecommitdiffstats
path: root/translate/ghdldrv/ghdlcomp.adb
diff options
context:
space:
mode:
Diffstat (limited to 'translate/ghdldrv/ghdlcomp.adb')
-rw-r--r--translate/ghdldrv/ghdlcomp.adb14
1 files changed, 14 insertions, 0 deletions
diff --git a/translate/ghdldrv/ghdlcomp.adb b/translate/ghdldrv/ghdlcomp.adb
index 1d72394c5..ba755af8a 100644
--- a/translate/ghdldrv/ghdlcomp.adb
+++ b/translate/ghdldrv/ghdlcomp.adb
@@ -24,6 +24,7 @@ with Ada.Text_IO;
with Types;
with Iirs; use Iirs;
+with Nodes_GC;
with Flags;
with Back_End;
with Sem;
@@ -39,6 +40,9 @@ package body Ghdlcomp is
Flag_Expect_Failure : Boolean := False;
+ Flag_Debug_Nodes_Leak : Boolean := False;
+ -- If True, detect unreferenced nodes at the end of analysis.
+
-- Commands which use the mcode compiler.
type Command_Comp is abstract new Command_Lib with null record;
procedure Decode_Option (Cmd : in out Command_Comp;
@@ -56,6 +60,9 @@ package body Ghdlcomp is
if Option = "--expect-failure" then
Flag_Expect_Failure := True;
Res := Option_Ok;
+ elsif Option = "--debug-nodes-leak" then
+ Flag_Debug_Nodes_Leak := True;
+ Res := Option_Ok;
elsif Hooks.Decode_Option.all (Option) then
Res := Option_Ok;
else
@@ -318,6 +325,8 @@ package body Ghdlcomp is
raise Compilation_Error;
end if;
+ Free_Iir (Design_File);
+
-- Do late analysis checks.
Unit := Get_First_Design_Unit (New_Design_File);
while Unit /= Null_Iir loop
@@ -335,7 +344,12 @@ package body Ghdlcomp is
raise Compilation_Error;
end if;
+ if Flag_Debug_Nodes_Leak then
+ Nodes_GC.Report_Unreferenced;
+ end if;
+
Libraries.Save_Work_Library;
+
exception
when Compilation_Error =>
if Flag_Expect_Failure and Errorout.Nbr_Errors /= 0 then