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] Cross-Reference information for build-in-place objects


An object declaration of an indefinite type whose expression is a build-in-
place function call is rewritten as a renaming declaration of a heap object.
This patch sets the source location and Comes_From_Source flag of the
entities involved in this rewriting, to ensure that references are properly
collected for the defining entity of the original declaration. This produces
a correct ALI file and removes spurious warnings.

The following must compile quietly:

gcc -c pack08.adb -gnat05 -gnatwu

---
package Pack08 is
  type Node_Type is limited interface;
  type Node_Ref is access all Node_Type'Class;

  type Node_Cursor is limited interface;

  function Element (Position : Node_Cursor) return Node_Ref is abstract;

  function First_Child (Node : Node_Type) return Node_Cursor'Class is abstract;

  procedure P (Node : Node_Type'Class);
end Pack08;
--
package body Pack08 is
  procedure P (Node : Node_Type'Class) is
     Cursor : Node_Cursor'Class := Node.First_Child;
     Index : Node_Ref;
  begin
     Index := Cursor.Element; -- Line where the variable is used.
  end P;
end Pack08;

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

2010-09-10  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch6.adb (Make_Build_In_Place_In_Object_Declaration): Use proper
	sloc for renaming declaration and set Comes_From_Source properly to
	ensure that references are properly generated for an object declaration
	that is built in place.

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]