This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Debug information for limited class-wide objects


This patch modifies the expansion of a build-in-place function call that
initializes a class-wide limited object to generate the necessary debug
information for the object.

------------
-- Source --
------------

--  types.ads

package Types is
   type Root_Type is tagged limited record
      I : Integer;
   end record;
   type Root_Access is access all Root_Type'Class;

   function Get return Root_Type'Class;
   procedure Ignore (O_Acc : Root_Access);
end Types;

--  types.adb

package body Types is
   function Get return Root_Type'Class is
   begin
      return Root_Type'(I => 0);
   end Get;

   procedure Ignore (O_Acc : Root_Access) is
   begin
      null;
   end Ignore;
end Types;

--  cw_debug_info.adb

with Types; use Types;

procedure CW_Debug_Info is
   Obj     : aliased Root_Type'Class := Get;
   Obj_Ptr : constant Root_Access    := Obj'Unchecked_Access;

begin
   Ignore (Obj_Ptr);
end CW_Debug_Info;

----------------------------
-- Compilation and output --
----------------------------

$ gnatmake -q -g cw_debug_info.adb
$ gdb ./cw_debug_info
$ b cw_debug_info.adb:5
$ r
$ print (obj)
$1 = (i => 0)

Tested on x86_64-pc-linux-gnu, committed on trunk

2015-10-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch6.adb (Expand_N_Extended_Return_Statement): Code cleanup.
	(Make_Build_In_Place_Call_In_Object_Declaration): Update the
	parameter profile.  Code cleanup. Request debug info for the
	object renaming declaration.
	(Move_Activation_Chain): Add new formal parameter and update the
	comment on usage.
	* exp_ch6.ads (Make_Build_In_Place_Call_In_Object_Declaration):
	Update the parameter profile and comment on usage.
	* sem_util.ads, sem_util.adb (Remove_Overloaded_Entity): New routine,
	currently unused.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]