1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
26 ------------------------------------------------------------------------------
28 -- This child package of Sinfo contains some routines that permit in place
29 -- alteration of existing tree nodes by changing the value in the Nkind
30 -- field. Since Nkind functions logically in a manner similart to a variant
31 -- record discriminant part, such alterations cannot be permitted in a
32 -- general manner, but in some specific cases, the fields of related nodes
33 -- have been deliberately layed out in a manner that permits such alteration.
36 with Atree; use Atree;
38 package body Sinfo.CN is
40 use Atree.Unchecked_Access;
41 -- This package is one of the few packages which is allowed to make direct
42 -- references to tree nodes (since it is in the business of providing a
43 -- higher level of tree access which other clients are expected to use and
44 -- which implements checks).
46 ------------------------------------------------------------
47 -- Change_Character_Literal_To_Defining_Character_Literal --
48 ------------------------------------------------------------
50 procedure Change_Character_Literal_To_Defining_Character_Literal
54 Set_Nkind (N, N_Defining_Character_Literal);
56 end Change_Character_Literal_To_Defining_Character_Literal;
58 ------------------------------------
59 -- Change_Conversion_To_Unchecked --
60 ------------------------------------
62 procedure Change_Conversion_To_Unchecked (N : Node_Id) is
64 Set_Do_Overflow_Check (N, False);
65 Set_Do_Tag_Check (N, False);
66 Set_Do_Length_Check (N, False);
67 Set_Nkind (N, N_Unchecked_Type_Conversion);
68 end Change_Conversion_To_Unchecked;
70 ----------------------------------------------
71 -- Change_Identifier_To_Defining_Identifier --
72 ----------------------------------------------
74 procedure Change_Identifier_To_Defining_Identifier (N : in out Node_Id) is
76 Set_Nkind (N, N_Defining_Identifier);
78 end Change_Identifier_To_Defining_Identifier;
80 --------------------------------------------------------
81 -- Change_Operator_Symbol_To_Defining_Operator_Symbol --
82 --------------------------------------------------------
84 procedure Change_Operator_Symbol_To_Defining_Operator_Symbol
88 Set_Nkind (N, N_Defining_Operator_Symbol);
89 Set_Node2 (N, Empty); -- Clear unused Str2 field
91 end Change_Operator_Symbol_To_Defining_Operator_Symbol;
93 ----------------------------------------------
94 -- Change_Operator_Symbol_To_String_Literal --
95 ----------------------------------------------
97 procedure Change_Operator_Symbol_To_String_Literal (N : Node_Id) is
99 Set_Nkind (N, N_String_Literal);
100 Set_Node1 (N, Empty); -- clear Name1 field
101 end Change_Operator_Symbol_To_String_Literal;
103 ------------------------------------------------
104 -- Change_Selected_Component_To_Expanded_Name --
105 ------------------------------------------------
107 procedure Change_Selected_Component_To_Expanded_Name (N : Node_Id) is
109 Set_Nkind (N, N_Expanded_Name);
110 Set_Chars (N, Chars (Selector_Name (N)));
111 end Change_Selected_Component_To_Expanded_Name;