annotate gcc/ada/itypes.adb @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT COMPILER COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- I T Y P E S --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- B o d y --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
111
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
12 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
kono
parents:
diff changeset
17 -- for more details. You should have received a copy of the GNU General --
kono
parents:
diff changeset
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
kono
parents:
diff changeset
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
kono
parents:
diff changeset
20 -- --
kono
parents:
diff changeset
21 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
23 -- --
kono
parents:
diff changeset
24 ------------------------------------------------------------------------------
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 with Atree; use Atree;
kono
parents:
diff changeset
27 with Opt; use Opt;
kono
parents:
diff changeset
28 with Sem; use Sem;
kono
parents:
diff changeset
29 with Sinfo; use Sinfo;
kono
parents:
diff changeset
30 with Stand; use Stand;
kono
parents:
diff changeset
31 with Targparm; use Targparm;
kono
parents:
diff changeset
32 with Uintp; use Uintp;
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 package body Itypes is
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 ------------------
kono
parents:
diff changeset
37 -- Create_Itype --
kono
parents:
diff changeset
38 ------------------
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 function Create_Itype
kono
parents:
diff changeset
41 (Ekind : Entity_Kind;
kono
parents:
diff changeset
42 Related_Nod : Node_Id;
kono
parents:
diff changeset
43 Related_Id : Entity_Id := Empty;
kono
parents:
diff changeset
44 Suffix : Character := ' ';
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
45 Suffix_Index : Int := 0;
111
kono
parents:
diff changeset
46 Scope_Id : Entity_Id := Current_Scope) return Entity_Id
kono
parents:
diff changeset
47 is
kono
parents:
diff changeset
48 Typ : Entity_Id;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 begin
kono
parents:
diff changeset
51 -- Should comment setting of Public_Status here ???
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 if Related_Id = Empty then
kono
parents:
diff changeset
54 Typ := New_Internal_Entity (Ekind, Scope_Id, Sloc (Related_Nod), 'T');
kono
parents:
diff changeset
55 Set_Public_Status (Typ);
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 else
kono
parents:
diff changeset
58 Typ :=
kono
parents:
diff changeset
59 New_External_Entity
kono
parents:
diff changeset
60 (Ekind, Scope_Id, Sloc (Related_Nod), Related_Id, Suffix,
kono
parents:
diff changeset
61 Suffix_Index, 'T');
kono
parents:
diff changeset
62 end if;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 -- Make sure Esize (Typ) was properly initialized, it should be since
kono
parents:
diff changeset
65 -- New_Internal_Entity/New_External_Entity call Init_Size_Align.
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 pragma Assert (Esize (Typ) = Uint_0);
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 Set_Etype (Typ, Any_Type);
kono
parents:
diff changeset
70 Set_Is_Itype (Typ);
kono
parents:
diff changeset
71 Set_Associated_Node_For_Itype (Typ, Related_Nod);
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 if In_Deleted_Code
kono
parents:
diff changeset
74 and then not ASIS_Mode
kono
parents:
diff changeset
75 then
kono
parents:
diff changeset
76 Set_Is_Frozen (Typ);
kono
parents:
diff changeset
77 end if;
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 if Ekind in Access_Subprogram_Kind then
kono
parents:
diff changeset
80 Set_Can_Use_Internal_Rep (Typ, not Always_Compatible_Rep_On_Target);
kono
parents:
diff changeset
81 end if;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 return Typ;
kono
parents:
diff changeset
84 end Create_Itype;
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 ---------------------------------
kono
parents:
diff changeset
87 -- Create_Null_Excluding_Itype --
kono
parents:
diff changeset
88 ---------------------------------
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 function Create_Null_Excluding_Itype
kono
parents:
diff changeset
91 (T : Entity_Id;
kono
parents:
diff changeset
92 Related_Nod : Node_Id;
kono
parents:
diff changeset
93 Scope_Id : Entity_Id := Current_Scope) return Entity_Id
kono
parents:
diff changeset
94 is
kono
parents:
diff changeset
95 I_Typ : Entity_Id;
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 begin
kono
parents:
diff changeset
98 pragma Assert (Is_Access_Type (T));
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 I_Typ := Create_Itype (Ekind => E_Access_Subtype,
kono
parents:
diff changeset
101 Related_Nod => Related_Nod,
kono
parents:
diff changeset
102 Scope_Id => Scope_Id);
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 Set_Directly_Designated_Type (I_Typ, Directly_Designated_Type (T));
kono
parents:
diff changeset
105 Set_Etype (I_Typ, Base_Type (T));
kono
parents:
diff changeset
106 Set_Depends_On_Private (I_Typ, Depends_On_Private (T));
kono
parents:
diff changeset
107 Set_Is_Public (I_Typ, Is_Public (T));
kono
parents:
diff changeset
108 Set_From_Limited_With (I_Typ, From_Limited_With (T));
kono
parents:
diff changeset
109 Set_Is_Access_Constant (I_Typ, Is_Access_Constant (T));
kono
parents:
diff changeset
110 Set_Is_Generic_Type (I_Typ, Is_Generic_Type (T));
kono
parents:
diff changeset
111 Set_Is_Volatile (I_Typ, Is_Volatile (T));
kono
parents:
diff changeset
112 Set_Treat_As_Volatile (I_Typ, Treat_As_Volatile (T));
kono
parents:
diff changeset
113 Set_Is_Atomic (I_Typ, Is_Atomic (T));
kono
parents:
diff changeset
114 Set_Is_Ada_2005_Only (I_Typ, Is_Ada_2005_Only (T));
kono
parents:
diff changeset
115 Set_Is_Ada_2012_Only (I_Typ, Is_Ada_2012_Only (T));
kono
parents:
diff changeset
116 Set_Can_Never_Be_Null (I_Typ);
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 return I_Typ;
kono
parents:
diff changeset
119 end Create_Null_Excluding_Itype;
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 end Itypes;