aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/einfo-utils.adb
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2021-02-25 10:38:55 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-15 06:19:16 -0400
commita7cadd18606c9c3ce2776b6f876ca98849b24b84 (patch)
tree73551a1fc7c4fa7738d96349db729d5d2e805f3f /gcc/ada/einfo-utils.adb
parent81e68a1954366f6b1730d75c932814121d743aa3 (diff)
downloadgcc-a7cadd18606c9c3ce2776b6f876ca98849b24b84.zip
gcc-a7cadd18606c9c3ce2776b6f876ca98849b24b84.tar.gz
gcc-a7cadd18606c9c3ce2776b6f876ca98849b24b84.tar.bz2
[Ada] Variable-sized node types -- cleanup
gcc/ada/ * atree.ads, einfo-utils.ads, einfo-utils.adb, fe.h, gen_il.adb, gen_il.ads, gen_il-gen-gen_entities.adb, gen_il-gen-gen_nodes.adb, sem_ch12.adb, sem_ch3.adb, sem_util.adb, sinfo-utils.ads, treepr.adb, types.ads: Clean up ??? comments and other comments. * atree.adb: Clean up ??? comments and other comments. (Validate_Node): Fix bug: "Off_0 (N) < Off_L (N)" should be "Off_0 (N) <= Off_L (N)". * gen_il-gen.adb, gen_il-gen.ads: Clean up ??? comments and other comments. Add support for getter-specific and setter-specific preconditions. Detect the error of putting a field in the wrong subrange. Misc cleanup. (Node_Field vs. Entity_Field): Clean up Nmake. Improve comments. * gen_il-utils.ads: Misc cleanup. Move... * gen_il-internals.ads: ... here. * gen_il-utils.adb: Misc cleanup. Move... * gen_il-internals.adb: ... here. * gen_il-fields.ads: Move Was_Default_Init_Box_Association, which was in the wrong subrange. Add comments. Misc cleanup. * gen_il-types.ads: Add Named_Access_Kind. * sinfo-cn.adb: Clean up ??? comments and other comments. Remove redundant assertions. * einfo.ads, sinfo.ads: Clean up ??? comments and other comments. Remove all the comments indicating field offsets. These are obsolete now that Gen_IL computes the offsets automatically.
Diffstat (limited to 'gcc/ada/einfo-utils.adb')
-rw-r--r--gcc/ada/einfo-utils.adb34
1 files changed, 19 insertions, 15 deletions
diff --git a/gcc/ada/einfo-utils.adb b/gcc/ada/einfo-utils.adb
index f0dbf9c..0ed7c74 100644
--- a/gcc/ada/einfo-utils.adb
+++ b/gcc/ada/einfo-utils.adb
@@ -43,6 +43,24 @@ package body Einfo.Utils is
-- Determine whether abstract state State_Id has particular option denoted
-- by the name Option_Nam.
+ -----------------------------------
+ -- Renamings of Renamed_Or_Alias --
+ -----------------------------------
+
+ function Alias (N : Entity_Id) return Node_Id is
+ begin
+ pragma Assert
+ (Is_Overloadable (N) or else Ekind (N) = E_Subprogram_Type);
+ return Renamed_Or_Alias (N);
+ end Alias;
+
+ procedure Set_Alias (N : Entity_Id; Val : Node_Id) is
+ begin
+ pragma Assert
+ (Is_Overloadable (N) or else Ekind (N) = E_Subprogram_Type);
+ Set_Renamed_Or_Alias (N, Val);
+ end Set_Alias;
+
----------------
-- Has_Option --
----------------
@@ -253,8 +271,7 @@ package body Einfo.Utils is
function Is_Named_Access_Type (Id : E) return B is
begin
- return Ekind (Id) in E_Access_Type .. -- ????
- E_Access_Protected_Subprogram_Type;
+ return Ekind (Id) in Named_Access_Kind;
end Is_Named_Access_Type;
function Is_Named_Number (Id : E) return B is
@@ -1425,8 +1442,6 @@ package body Einfo.Utils is
function Is_Base_Type (Id : E) return Boolean is
begin
--- ???? pragma Assert (Is_Type (Id));
--- Apparently, Is_Base_Type is called on non-types, and returns True!
return Entity_Is_Base_Type (Ekind (Id));
end Is_Base_Type;
@@ -3123,17 +3138,6 @@ package body Einfo.Utils is
function Is_Volatile (Id : E) return B is
begin
- -- ????The old version has a comment that says:
- -- The flag is not set reliably on private subtypes,
- -- and is always retrieved from the base type (but this is not a
- -- base-type-only attribute because it applies to other entities).
- -- Perhaps it should be set reliably, and perhaps it should be
- -- Base_Type_Only, but that doesn't work because it is currently
- -- set on subtypes, so we have to explicitly fetch the Base_Type below.
- --
- -- It might be cleaner if the call sites called Is_Volatile_Type
- -- or Is_Volatile_Object directly; surely they know which it is.
-
pragma Assert (Nkind (Id) in N_Entity);
if Is_Type (Id) then