OSDN Git Service

* sem_ch3.adb (Find_Type_Of_Subtype_Indic): If subtype indication
[pf3gnuchains/gcc-fork.git] / gcc / ada / sinfo-cn.adb
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                             S I N F O . C N                              --
6 --                                                                          --
7 --                                 B o d y                                  --
8 --                                                                          --
9 --                            $Revision: 1.7 $
10 --                                                                          --
11 --          Copyright (C) 1992-2001 Free Software Foundation, Inc.          --
12 --                                                                          --
13 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
14 -- terms of the  GNU General Public License as published  by the Free Soft- --
15 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
16 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
17 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
18 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
19 -- for  more details.  You should have  received  a copy of the GNU General --
20 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
21 -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
22 -- MA 02111-1307, USA.                                                      --
23 --                                                                          --
24 -- GNAT was originally developed  by the GNAT team at  New York University. --
25 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
26 --                                                                          --
27 ------------------------------------------------------------------------------
28
29 --  This child package of Sinfo contains some routines that permit in place
30 --  alteration of existing tree nodes by changing the value in the Nkind
31 --  field. Since Nkind functions logically in a manner similart to a variant
32 --  record discriminant part, such alterations cannot be permitted in a
33 --  general manner, but in some specific cases, the fields of related nodes
34 --  have been deliberately layed out in a manner that permits such alteration.
35 --  that determin
36
37 with Atree; use Atree;
38
39 package body Sinfo.CN is
40
41    use Atree.Unchecked_Access;
42    --  This package is one of the few packages which is allowed to make direct
43    --  references to tree nodes (since it is in the business of providing a
44    --  higher level of tree access which other clients are expected to use and
45    --  which implements checks).
46
47    ------------------------------------------------------------
48    -- Change_Character_Literal_To_Defining_Character_Literal --
49    ------------------------------------------------------------
50
51    procedure Change_Character_Literal_To_Defining_Character_Literal
52      (N : in out Node_Id)
53    is
54    begin
55       Set_Nkind (N, N_Defining_Character_Literal);
56       N := Extend_Node (N);
57    end Change_Character_Literal_To_Defining_Character_Literal;
58
59    ------------------------------------
60    -- Change_Conversion_To_Unchecked --
61    ------------------------------------
62
63    procedure Change_Conversion_To_Unchecked (N : Node_Id) is
64    begin
65       Set_Do_Overflow_Check (N, False);
66       Set_Do_Tag_Check (N, False);
67       Set_Do_Length_Check (N, False);
68       Set_Nkind (N, N_Unchecked_Type_Conversion);
69    end Change_Conversion_To_Unchecked;
70
71    ----------------------------------------------
72    -- Change_Identifier_To_Defining_Identifier --
73    ----------------------------------------------
74
75    procedure Change_Identifier_To_Defining_Identifier (N : in out Node_Id) is
76    begin
77       Set_Nkind (N, N_Defining_Identifier);
78       N := Extend_Node (N);
79    end Change_Identifier_To_Defining_Identifier;
80
81    --------------------------------------------------------
82    -- Change_Operator_Symbol_To_Defining_Operator_Symbol --
83    --------------------------------------------------------
84
85    procedure Change_Operator_Symbol_To_Defining_Operator_Symbol
86      (N : in out Node_Id)
87    is
88    begin
89       Set_Nkind (N, N_Defining_Operator_Symbol);
90       Set_Node2 (N, Empty); -- Clear unused Str2 field
91       N := Extend_Node (N);
92    end Change_Operator_Symbol_To_Defining_Operator_Symbol;
93
94    ----------------------------------------------
95    -- Change_Operator_Symbol_To_String_Literal --
96    ----------------------------------------------
97
98    procedure Change_Operator_Symbol_To_String_Literal (N : Node_Id) is
99    begin
100       Set_Nkind (N, N_String_Literal);
101       Set_Node1 (N, Empty); -- clear Name1 field
102    end Change_Operator_Symbol_To_String_Literal;
103
104    ------------------------------------------------
105    -- Change_Selected_Component_To_Expanded_Name --
106    ------------------------------------------------
107
108    procedure Change_Selected_Component_To_Expanded_Name (N : Node_Id) is
109    begin
110       Set_Nkind (N, N_Expanded_Name);
111       Set_Chars (N, Chars (Selector_Name (N)));
112    end Change_Selected_Component_To_Expanded_Name;
113
114 end Sinfo.CN;