]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ada/itypes.adb
exp_atag.ads, [...]: Replace headers with GPL v3 headers.
[thirdparty/gcc.git] / gcc / ada / itypes.adb
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- I T Y P E S --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
25
26 with Atree; use Atree;
27 with Opt; use Opt;
28 with Sem; use Sem;
29 with Sinfo; use Sinfo;
30 with Stand; use Stand;
31
32 package body Itypes is
33
34 ------------------
35 -- Create_Itype --
36 ------------------
37
38 function Create_Itype
39 (Ekind : Entity_Kind;
40 Related_Nod : Node_Id;
41 Related_Id : Entity_Id := Empty;
42 Suffix : Character := ' ';
43 Suffix_Index : Nat := 0;
44 Scope_Id : Entity_Id := Current_Scope) return Entity_Id
45 is
46 Typ : Entity_Id;
47
48 begin
49 if Related_Id = Empty then
50 Typ := New_Internal_Entity (Ekind, Scope_Id, Sloc (Related_Nod), 'T');
51 Set_Public_Status (Typ);
52
53 else
54 Typ := New_External_Entity
55 (Ekind, Scope_Id, Sloc (Related_Nod), Related_Id, Suffix,
56 Suffix_Index, 'T');
57 end if;
58
59 Init_Size_Align (Typ);
60 Set_Etype (Typ, Any_Type);
61 Set_Is_Itype (Typ);
62 Set_Associated_Node_For_Itype (Typ, Related_Nod);
63
64 if In_Deleted_Code
65 and then not ASIS_Mode
66 then
67 Set_Is_Frozen (Typ);
68 end if;
69
70 return Typ;
71 end Create_Itype;
72
73 ---------------------------------
74 -- Create_Null_Excluding_Itype --
75 ---------------------------------
76
77 function Create_Null_Excluding_Itype
78 (T : Entity_Id;
79 Related_Nod : Node_Id;
80 Scope_Id : Entity_Id := Current_Scope) return Entity_Id
81 is
82 I_Typ : Entity_Id;
83
84 begin
85 pragma Assert (Is_Access_Type (T));
86
87 I_Typ := Create_Itype (Ekind => E_Access_Subtype,
88 Related_Nod => Related_Nod,
89 Scope_Id => Scope_Id);
90
91 Set_Directly_Designated_Type (I_Typ, Directly_Designated_Type (T));
92 Set_Etype (I_Typ, T);
93 Init_Size_Align (I_Typ);
94 Set_Depends_On_Private (I_Typ, Depends_On_Private (T));
95 Set_Is_Public (I_Typ, Is_Public (T));
96 Set_From_With_Type (I_Typ, From_With_Type (T));
97 Set_Is_Access_Constant (I_Typ, Is_Access_Constant (T));
98 Set_Is_Generic_Type (I_Typ, Is_Generic_Type (T));
99 Set_Is_Volatile (I_Typ, Is_Volatile (T));
100 Set_Treat_As_Volatile (I_Typ, Treat_As_Volatile (T));
101 Set_Is_Atomic (I_Typ, Is_Atomic (T));
102 Set_Is_Ada_2005_Only (I_Typ, Is_Ada_2005_Only (T));
103 Set_Can_Never_Be_Null (I_Typ);
104
105 return I_Typ;
106 end Create_Null_Excluding_Itype;
107
108 end Itypes;