[Ada] Document attribute Has_Tagged_Values in GNAT RM

gcc/ada/

	* doc/gnat_rm/implementation_defined_attributes.rst
	(Has_Tagged_Values): Document based on the existing description
	of Has_Access_Type and the comment for Has_Tagged_Component,
	which is where frontend evaluates this attribute.
	* gnat_rm.texi: Regenerate.
	* sem_attr.adb (Analyze_Attribute): Merge processing of
	Has_Access_Type and Has_Tagged_Component attributes.
	* sem_util.adb (Has_Access_Type): Fix casing in comment.
	* sem_util.ads (Has_Tagged_Component): Remove wrong (or
	outdated) comment about the use of this routine to implement the
	equality operator.
This commit is contained in:
Piotr Trojanek 2020-10-14 15:49:17 +02:00 committed by Pierre-Marie de Rodat
parent 14a16e30ca
commit 47c2b77ffb
5 changed files with 516 additions and 487 deletions

View File

@ -483,6 +483,19 @@ otherwise. The intended use of this attribute is in conjunction with generic
definitions. If the attribute is applied to a generic private type, it
indicates whether or not the corresponding actual type has discriminants.
Attribute Has_Tagged_Values
===========================
.. index:: Tagged values, testing for
.. index:: Has_Tagged_Values
The prefix of the ``Has_Tagged_Values`` attribute is a type. The result is a
Boolean value which is True if the type is a composite type (array or record)
that is either a tagged type or has a subcomponent that is tagged, and is False
otherwise. The intended use of this attribute is in conjunction with generic
definitions. If the attribute is applied to a generic private type, it
indicates whether or not the corresponding actual type has access values.
Attribute Img
=============
.. index:: Img

File diff suppressed because it is too large Load Diff

View File

@ -3868,7 +3868,7 @@ package body Sem_Attr is
-- Elab_Spec --
---------------
-- Shares processing with Elab_Body
-- Shares processing with Elab_Body attribute
----------------
-- Elaborated --
@ -4118,7 +4118,9 @@ package body Sem_Attr is
-- Has_Access_Values --
-----------------------
when Attribute_Has_Access_Values =>
when Attribute_Has_Access_Values
| Attribute_Has_Tagged_Values
=>
Check_Type;
Check_E0;
Set_Etype (N, Standard_Boolean);
@ -4142,10 +4144,7 @@ package body Sem_Attr is
-- Has_Tagged_Values --
-----------------------
when Attribute_Has_Tagged_Values =>
Check_Type;
Check_E0;
Set_Etype (N, Standard_Boolean);
-- Shares processing with Has_Access_Values attribute
-----------------------
-- Has_Discriminants --

View File

@ -11396,7 +11396,7 @@ package body Sem_Util is
Comp : Entity_Id;
begin
-- Loop to Check components
-- Loop to check components
Comp := First_Component_Or_Discriminant (Typ);
while Present (Comp) loop

View File

@ -1503,9 +1503,7 @@ package Sem_Util is
function Has_Tagged_Component (Typ : Entity_Id) return Boolean;
-- Returns True if Typ is a composite type (array or record) that is either
-- a tagged type or has a subcomponent that is tagged. Returns False for a
-- noncomposite type, or if no tagged subcomponents are present. This
-- function is used to check if "=" has to be expanded into a bunch
-- component comparisons.
-- noncomposite type, or if no tagged subcomponents are present.
function Has_Unconstrained_Access_Discriminants
(Subtyp : Entity_Id) return Boolean;