fixing pr42337
[official-gcc.git] / gcc / ada / sinfo-cn.adb
blob2b4eaa2d961013b0aecd9b48e72a51af566025b4
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S I N F O . C N --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2008, 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 3, 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 COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
20 -- --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
23 -- --
24 ------------------------------------------------------------------------------
26 -- This child package of Sinfo contains some routines that permit in place
27 -- alteration of existing tree nodes by changing the value in the Nkind
28 -- field. Since Nkind functions logically in a manner similar to a variant
29 -- record discriminant part, such alterations cannot be permitted in a
30 -- general manner, but in some specific cases, the fields of related nodes
31 -- have been deliberately layed out in a manner that permits such alteration.
33 with Atree; use Atree;
35 package body Sinfo.CN is
37 use Atree.Unchecked_Access;
38 -- This package is one of the few packages which is allowed to make direct
39 -- references to tree nodes (since it is in the business of providing a
40 -- higher level of tree access which other clients are expected to use and
41 -- which implements checks).
43 ------------------------------------------------------------
44 -- Change_Character_Literal_To_Defining_Character_Literal --
45 ------------------------------------------------------------
47 procedure Change_Character_Literal_To_Defining_Character_Literal
48 (N : in out Node_Id)
50 begin
51 Set_Nkind (N, N_Defining_Character_Literal);
52 N := Extend_Node (N);
53 end Change_Character_Literal_To_Defining_Character_Literal;
55 ------------------------------------
56 -- Change_Conversion_To_Unchecked --
57 ------------------------------------
59 procedure Change_Conversion_To_Unchecked (N : Node_Id) is
60 begin
61 Set_Do_Overflow_Check (N, False);
62 Set_Do_Tag_Check (N, False);
63 Set_Do_Length_Check (N, False);
64 Set_Nkind (N, N_Unchecked_Type_Conversion);
65 end Change_Conversion_To_Unchecked;
67 ----------------------------------------------
68 -- Change_Identifier_To_Defining_Identifier --
69 ----------------------------------------------
71 procedure Change_Identifier_To_Defining_Identifier (N : in out Node_Id) is
72 begin
73 Set_Nkind (N, N_Defining_Identifier);
74 N := Extend_Node (N);
75 end Change_Identifier_To_Defining_Identifier;
77 --------------------------------------------------------
78 -- Change_Operator_Symbol_To_Defining_Operator_Symbol --
79 --------------------------------------------------------
81 procedure Change_Operator_Symbol_To_Defining_Operator_Symbol
82 (N : in out Node_Id)
84 begin
85 Set_Nkind (N, N_Defining_Operator_Symbol);
86 Set_Node2 (N, Empty); -- Clear unused Str2 field
87 N := Extend_Node (N);
88 end Change_Operator_Symbol_To_Defining_Operator_Symbol;
90 ----------------------------------------------
91 -- Change_Operator_Symbol_To_String_Literal --
92 ----------------------------------------------
94 procedure Change_Operator_Symbol_To_String_Literal (N : Node_Id) is
95 begin
96 Set_Nkind (N, N_String_Literal);
97 Set_Node1 (N, Empty); -- clear Name1 field
98 end Change_Operator_Symbol_To_String_Literal;
100 ------------------------------------------------
101 -- Change_Selected_Component_To_Expanded_Name --
102 ------------------------------------------------
104 procedure Change_Selected_Component_To_Expanded_Name (N : Node_Id) is
105 begin
106 Set_Nkind (N, N_Expanded_Name);
107 Set_Chars (N, Chars (Selector_Name (N)));
108 end Change_Selected_Component_To_Expanded_Name;
110 end Sinfo.CN;