1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
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. --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
25 ------------------------------------------------------------------------------
27 -- This child package of Sinfo contains some routines that permit in place
28 -- alteration of existing tree nodes by changing the value in the Nkind
29 -- field. Since Nkind functions logically in a manner similar to a variant
30 -- record discriminant part, such alterations cannot be permitted in a
31 -- general manner, but in some specific cases, the fields of related nodes
32 -- have been deliberately layed out in a manner that permits such alteration.
35 with Atree
; use Atree
;
37 package body Sinfo
.CN
is
39 use Atree
.Unchecked_Access
;
40 -- This package is one of the few packages which is allowed to make direct
41 -- references to tree nodes (since it is in the business of providing a
42 -- higher level of tree access which other clients are expected to use and
43 -- which implements checks).
45 ------------------------------------------------------------
46 -- Change_Character_Literal_To_Defining_Character_Literal --
47 ------------------------------------------------------------
49 procedure Change_Character_Literal_To_Defining_Character_Literal
53 Set_Nkind
(N
, N_Defining_Character_Literal
);
55 end Change_Character_Literal_To_Defining_Character_Literal
;
57 ------------------------------------
58 -- Change_Conversion_To_Unchecked --
59 ------------------------------------
61 procedure Change_Conversion_To_Unchecked
(N
: Node_Id
) is
63 Set_Do_Overflow_Check
(N
, False);
64 Set_Do_Tag_Check
(N
, False);
65 Set_Do_Length_Check
(N
, False);
66 Set_Nkind
(N
, N_Unchecked_Type_Conversion
);
67 end Change_Conversion_To_Unchecked
;
69 ----------------------------------------------
70 -- Change_Identifier_To_Defining_Identifier --
71 ----------------------------------------------
73 procedure Change_Identifier_To_Defining_Identifier
(N
: in out Node_Id
) is
75 Set_Nkind
(N
, N_Defining_Identifier
);
77 end Change_Identifier_To_Defining_Identifier
;
79 --------------------------------------------------------
80 -- Change_Operator_Symbol_To_Defining_Operator_Symbol --
81 --------------------------------------------------------
83 procedure Change_Operator_Symbol_To_Defining_Operator_Symbol
87 Set_Nkind
(N
, N_Defining_Operator_Symbol
);
88 Set_Node2
(N
, Empty
); -- Clear unused Str2 field
90 end Change_Operator_Symbol_To_Defining_Operator_Symbol
;
92 ----------------------------------------------
93 -- Change_Operator_Symbol_To_String_Literal --
94 ----------------------------------------------
96 procedure Change_Operator_Symbol_To_String_Literal
(N
: Node_Id
) is
98 Set_Nkind
(N
, N_String_Literal
);
99 Set_Node1
(N
, Empty
); -- clear Name1 field
100 end Change_Operator_Symbol_To_String_Literal
;
102 ------------------------------------------------
103 -- Change_Selected_Component_To_Expanded_Name --
104 ------------------------------------------------
106 procedure Change_Selected_Component_To_Expanded_Name
(N
: Node_Id
) is
108 Set_Nkind
(N
, N_Expanded_Name
);
109 Set_Chars
(N
, Chars
(Selector_Name
(N
)));
110 end Change_Selected_Component_To_Expanded_Name
;