1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
11 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
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. --
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). --
27 ------------------------------------------------------------------------------
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.
37 with Atree
; use Atree
;
39 package body Sinfo
.CN
is
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).
47 ------------------------------------------------------------
48 -- Change_Character_Literal_To_Defining_Character_Literal --
49 ------------------------------------------------------------
51 procedure Change_Character_Literal_To_Defining_Character_Literal
55 Set_Nkind
(N
, N_Defining_Character_Literal
);
57 end Change_Character_Literal_To_Defining_Character_Literal
;
59 ------------------------------------
60 -- Change_Conversion_To_Unchecked --
61 ------------------------------------
63 procedure Change_Conversion_To_Unchecked
(N
: Node_Id
) is
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
;
71 ----------------------------------------------
72 -- Change_Identifier_To_Defining_Identifier --
73 ----------------------------------------------
75 procedure Change_Identifier_To_Defining_Identifier
(N
: in out Node_Id
) is
77 Set_Nkind
(N
, N_Defining_Identifier
);
79 end Change_Identifier_To_Defining_Identifier
;
81 --------------------------------------------------------
82 -- Change_Operator_Symbol_To_Defining_Operator_Symbol --
83 --------------------------------------------------------
85 procedure Change_Operator_Symbol_To_Defining_Operator_Symbol
89 Set_Nkind
(N
, N_Defining_Operator_Symbol
);
90 Set_Node2
(N
, Empty
); -- Clear unused Str2 field
92 end Change_Operator_Symbol_To_Defining_Operator_Symbol
;
94 ----------------------------------------------
95 -- Change_Operator_Symbol_To_String_Literal --
96 ----------------------------------------------
98 procedure Change_Operator_Symbol_To_String_Literal
(N
: Node_Id
) is
100 Set_Nkind
(N
, N_String_Literal
);
101 Set_Node1
(N
, Empty
); -- clear Name1 field
102 end Change_Operator_Symbol_To_String_Literal
;
104 ------------------------------------------------
105 -- Change_Selected_Component_To_Expanded_Name --
106 ------------------------------------------------
108 procedure Change_Selected_Component_To_Expanded_Name
(N
: Node_Id
) is
110 Set_Nkind
(N
, N_Expanded_Name
);
111 Set_Chars
(N
, Chars
(Selector_Name
(N
)));
112 end Change_Selected_Component_To_Expanded_Name
;