diff options
author | Tristan Gingold <tgingold@free.fr> | 2019-06-04 18:26:09 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2019-06-04 18:26:09 +0200 |
commit | 3b5c385fbb252fc2a5a6c939ed5087bd36b1d6eb (patch) | |
tree | 5eaaaf25133d71c67b501f00e8d2c0e628a61df5 /src | |
parent | e54640fae9e30b6f842a857dbee7c9ae9243dbdd (diff) | |
download | ghdl-3b5c385fbb252fc2a5a6c939ed5087bd36b1d6eb.tar.gz ghdl-3b5c385fbb252fc2a5a6c939ed5087bd36b1d6eb.tar.bz2 ghdl-3b5c385fbb252fc2a5a6c939ed5087bd36b1d6eb.zip |
ghdl import: avoid a crash in case of error.
Diffstat (limited to 'src')
-rw-r--r-- | src/ghdldrv/ghdllocal.adb | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/ghdldrv/ghdllocal.adb b/src/ghdldrv/ghdllocal.adb index 3b4884acb..d7db3965f 100644 --- a/src/ghdldrv/ghdllocal.adb +++ b/src/ghdldrv/ghdllocal.adb @@ -702,28 +702,27 @@ package body Ghdllocal is for I in Args'Range loop Id := Name_Table.Get_Identifier (Args (I).all); Design_File := Vhdl.Sem_Lib.Load_File_Name (Id); - if Design_File /= Null_Iir then - Unit := Get_First_Design_Unit (Design_File); - while Unit /= Null_Iir loop - if Flag_Verbose then - Lib := Get_Library_Unit (Unit); - Disp_Library_Unit (Lib); - if Is_Top_Entity (Lib) then - Put (" **"); - end if; - New_Line; - end if; - Next_Unit := Get_Chain (Unit); - Set_Chain (Unit, Null_Iir); - Libraries.Add_Design_Unit_Into_Library (Unit); - Unit := Next_Unit; - end loop; + + if Nbr_Errors > 0 then + raise Compilation_Error; end if; - end loop; - if Nbr_Errors > 0 then - raise Compilation_Error; - end if; + Unit := Get_First_Design_Unit (Design_File); + while Unit /= Null_Iir loop + if Flag_Verbose then + Lib := Get_Library_Unit (Unit); + Disp_Library_Unit (Lib); + if Is_Top_Entity (Lib) then + Put (" **"); + end if; + New_Line; + end if; + Next_Unit := Get_Chain (Unit); + Set_Chain (Unit, Null_Iir); + Libraries.Add_Design_Unit_Into_Library (Unit); + Unit := Next_Unit; + end loop; + end loop; -- Analyze all files. if False then |