From ad8bd3f47cd12be5905dd43d058b3f26319449a2 Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Tue, 29 Jul 2014 14:09:38 +0000 Subject: [PATCH] lib-xref.adb (Output_Refs, [...]): For a derived array type... 2014-07-29 Ed Schonberg * lib-xref.adb (Output_Refs, Check_Type_Reference): For a derived array type, add information about component type, which was previously missing in ali file. * gnat_rm.texi: Add documentation for Atomic_Always_Lock_Free. From-SVN: r213198 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/gnat_rm.texi | 30 +++++------------------------- gcc/ada/lib-xref.adb | 33 ++++++++++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b79abfab635..71009dc976f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2014-07-29 Ed Schonberg + + * lib-xref.adb (Output_Refs, Check_Type_Reference): For a + derived array type, add information about component type, which + was previously missing in ali file. + * gnat_rm.texi: Add documentation for Atomic_Always_Lock_Free. + 2014-07-29 Thomas Quinot * sem_ch3.adb (Constrain_Corresponding_Record): For the case diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index b61689696b6..c53ed275c9d 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -347,9 +347,7 @@ Implementation Defined Attributes * Attribute Bit_Position:: * Attribute Code_Address:: * Attribute Compiler_Version:: -* Attribute Constant_Indexing:: * Attribute Default_Bit_Order:: -* Attribute Default_Iterator:: * Attribute Descriptor_Size:: * Attribute Elaborated:: * Attribute Elab_Body:: @@ -370,7 +368,6 @@ Implementation Defined Attributes * Attribute Integer_Value:: * Attribute Invalid_Value:: * Attribute Iterable:: -* Attribute Iterator_Element:: * Attribute Large:: * Attribute Library_Level:: * Attribute Lock_Free:: @@ -8560,9 +8557,7 @@ consideration, you should minimize the use of these attributes. * Attribute Bit_Position:: * Attribute Code_Address:: * Attribute Compiler_Version:: -* Attribute Constant_Indexing:: * Attribute Default_Bit_Order:: -* Attribute Default_Iterator:: * Attribute Descriptor_Size:: * Attribute Elaborated:: * Attribute Elab_Body:: @@ -8582,7 +8577,6 @@ consideration, you should minimize the use of these attributes. * Attribute Implicit_Dereference:: * Attribute Integer_Value:: * Attribute Invalid_Value:: -* Attribute Iterator_Element:: * Attribute Iterable:: * Attribute Large:: * Attribute Library_Level:: @@ -8697,7 +8691,11 @@ Language Reference Manual}, section 9.12a. @unnumberedsec Attribute Atomic_Always_Lock_Free @findex Atomic_Always_Lock_Free @noindent -PLEASE ADD DOCUMENTATION HERE??? + +The prefix of the @code{Atomic_Always_Lock_Free} attribute is a type. +The result is a Boolean value which is True if the type has discriminants, +and False otherwise. The result indicate whether atomic operations are +supported by the target for the given type. @node Attribute Bit @unnumberedsec Attribute Bit @@ -8795,12 +8793,6 @@ prefix) yields a static string identifying the version of the compiler being used to compile the unit containing the attribute reference. A typical result would be something like "@value{EDITION} @value{gnat_version} (20090221)". -@node Attribute Constant_Indexing -@unnumberedsec Attribute Constant_Indexing -@findex Constant_Indexing -@noindent -PLEASE ADD DOCUMENTATION HERE??? - @node Attribute Default_Bit_Order @unnumberedsec Attribute Default_Bit_Order @cindex Big endian @@ -8813,12 +8805,6 @@ as a @code{Pos} value (0 for @code{High_Order_First}, 1 for @code{Low_Order_First}). This is used to construct the definition of @code{Default_Bit_Order} in package @code{System}. -@node Attribute Default_Iterator -@unnumberedsec Attribute Default_Iterator -@findex Default_Iterator -@noindent -PLEASE ADD DOCUMENTATION HERE??? - @node Attribute Descriptor_Size @unnumberedsec Attribute Descriptor_Size @cindex Descriptor @@ -9125,12 +9111,6 @@ uninitialized value of the type if pragma Initialize_Scalars is used, including the ability to modify the value with the binder -Sxx flag and relevant environment variables at run time. -@node Attribute Iterator_Element -@unnumberedsec Attribute Iterator_Element -@findex Iterator_Element -@noindent -PLEASE ADD DOCUMENTATION HERE??? - @node Attribute Iterable @unnumberedsec Attribute Iterable @findex Iterable diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb index 95c87ef7194..8cc8e2f6b83 100644 --- a/gcc/ada/lib-xref.adb +++ b/gcc/ada/lib-xref.adb @@ -1893,12 +1893,18 @@ package body Lib.Xref is procedure Check_Type_Reference (Ent : Entity_Id; - List_Interface : Boolean); + List_Interface : Boolean; + Is_Component : Boolean := False); -- Find whether there is a meaningful type reference for -- Ent, and display it accordingly. If List_Interface is -- true, then Ent is a progenitor interface of the current -- type entity being listed. In that case list it as is, - -- without looking for a type reference for it. + -- without looking for a type reference for it. Flag is also + -- used for index types of an array type, where the caller + -- supplies the intended type reference. Is_Component serves + -- the same purpose, to display the component type of a + -- derived array type, for which only the parent type has + -- ben displayed so far. procedure Output_Instantiation_Refs (Loc : Source_Ptr); -- Recursive procedure to output instantiation references for @@ -1915,7 +1921,8 @@ package body Lib.Xref is procedure Check_Type_Reference (Ent : Entity_Id; - List_Interface : Boolean) + List_Interface : Boolean; + Is_Component : Boolean := False) is begin if List_Interface then @@ -1927,6 +1934,13 @@ package body Lib.Xref is Left := '<'; Right := '>'; + -- The following is not documented in lib-xref.ads ??? + + elsif Is_Component then + Tref := Ent; + Left := '('; + Right := ')'; + else Get_Type_Reference (Ent, Tref, Left, Right); end if; @@ -2515,8 +2529,21 @@ package body Lib.Xref is if Is_Array_Type (XE.Key.Ent) then declare + A_Typ : constant Entity_Id := XE.Key.Ent; Indx : Node_Id; + begin + -- If this is a derived array type, we have + -- output the parent type, so add the component + -- type now. + + if Is_Derived_Type (A_Typ) then + Check_Type_Reference + (Component_Type (A_Typ), False, True); + end if; + + -- Add references to index types. + Indx := First_Index (XE.Key.Ent); while Present (Indx) loop Check_Type_Reference