* gimplify.c (find_single_pointer_decl_1): New static function.
[official-gcc.git] / gcc / ada / itypes.adb
blobf9f86d57e2e401a5b2b4305b2864651ae41fe609
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-2005 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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 with Atree; use Atree;
28 with Opt; use Opt;
29 with Sem; use Sem;
30 with Sinfo; use Sinfo;
31 with Stand; use Stand;
33 package body Itypes is
35 ------------------
36 -- Create_Itype --
37 ------------------
39 function Create_Itype
40 (Ekind : Entity_Kind;
41 Related_Nod : Node_Id;
42 Related_Id : Entity_Id := Empty;
43 Suffix : Character := ' ';
44 Suffix_Index : Nat := 0;
45 Scope_Id : Entity_Id := Current_Scope)
46 return Entity_Id
48 Typ : Entity_Id;
50 begin
51 if Related_Id = Empty then
52 Typ := New_Internal_Entity (Ekind, Scope_Id, Sloc (Related_Nod), 'T');
53 Set_Public_Status (Typ);
55 else
56 Typ := New_External_Entity
57 (Ekind, Scope_Id, Sloc (Related_Nod), Related_Id, Suffix,
58 Suffix_Index, 'T');
59 end if;
61 Init_Size_Align (Typ);
62 Set_Etype (Typ, Any_Type);
63 Set_Is_Itype (Typ);
64 Set_Associated_Node_For_Itype (Typ, Related_Nod);
66 if In_Deleted_Code
67 and then not ASIS_Mode
68 then
69 Set_Is_Frozen (Typ);
70 end if;
72 return Typ;
73 end Create_Itype;
75 ---------------------------------
76 -- Create_Null_Excluding_Itype --
77 ---------------------------------
79 function Create_Null_Excluding_Itype
80 (T : Entity_Id;
81 Related_Nod : Node_Id;
82 Scope_Id : Entity_Id := Current_Scope) return Entity_Id
84 I_Typ : Entity_Id;
86 begin
87 pragma Assert (Is_Access_Type (T));
89 I_Typ := Create_Itype (Ekind => E_Access_Subtype,
90 Related_Nod => Related_Nod,
91 Scope_Id => Scope_Id);
93 Set_Directly_Designated_Type (I_Typ,
94 Directly_Designated_Type (T));
95 Set_Etype (I_Typ, T);
96 Init_Size_Align (I_Typ);
97 Set_Depends_On_Private (I_Typ, Depends_On_Private (T));
98 Set_Is_Public (I_Typ, Is_Public (T));
99 Set_From_With_Type (I_Typ, From_With_Type (T));
100 Set_Is_Access_Constant (I_Typ, Is_Access_Constant (T));
101 Set_Is_Generic_Type (I_Typ, Is_Generic_Type (T));
102 Set_Is_Volatile (I_Typ, Is_Volatile (T));
103 Set_Treat_As_Volatile (I_Typ, Treat_As_Volatile (T));
104 Set_Is_Atomic (I_Typ, Is_Atomic (T));
105 Set_Is_Ada_2005 (I_Typ, Is_Ada_2005 (T));
106 Set_Can_Never_Be_Null (I_Typ);
108 return I_Typ;
109 end Create_Null_Excluding_Itype;
111 end Itypes;