diff options
Diffstat (limited to 'gcc/ada/lib-load.adb')
-rw-r--r-- | gcc/ada/lib-load.adb | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb index 508b2e871ad..c582e1e5841 100644 --- a/gcc/ada/lib-load.adb +++ b/gcc/ada/lib-load.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -766,17 +766,27 @@ package body Lib.Load is -- declaration has been attached to a new compilation unit node, and -- code will have to be generated for it. - procedure Make_Instance_Unit (N : Node_Id) is + procedure Make_Instance_Unit (N : Node_Id; In_Main : Boolean) is Sind : constant Source_File_Index := Source_Index (Main_Unit); begin Units.Increment_Last; - Units.Table (Units.Last) := Units.Table (Main_Unit); - Units.Table (Units.Last).Cunit := Library_Unit (N); - Units.Table (Units.Last).Generate_Code := True; - Units.Table (Main_Unit).Cunit := N; - Units.Table (Main_Unit).Unit_Name := - Get_Body_Name (Unit_Name (Get_Cunit_Unit_Number (Library_Unit (N)))); - Units.Table (Main_Unit).Version := Source_Checksum (Sind); + + if In_Main then + Units.Table (Units.Last) := Units.Table (Main_Unit); + Units.Table (Units.Last).Cunit := Library_Unit (N); + Units.Table (Units.Last).Generate_Code := True; + Units.Table (Main_Unit).Cunit := N; + Units.Table (Main_Unit).Unit_Name := + Get_Body_Name + (Unit_Name (Get_Cunit_Unit_Number (Library_Unit (N)))); + Units.Table (Main_Unit).Version := Source_Checksum (Sind); + + else + -- Duplicate information from instance unit, for the body. + Units.Table (Units.Last) := + Units.Table (Get_Cunit_Unit_Number (Library_Unit (N))); + Units.Table (Units.Last).Cunit := N; + end if; end Make_Instance_Unit; ------------------------ |