| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- E X P _ C H 1 1 -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 1992-2025, 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 |
------------------------------------------------------------------------------ |
| 25 |
|
| 26 |
-- Expand routines for chapter 11 constructs |
| 27 |
|
| 28 |
with Types; use Types; |
| 29 |
|
| 30 |
package Exp_Ch11 is |
| 31 |
procedure Expand_N_Exception_Declaration (N : Node_Id); |
| 32 |
procedure Expand_N_Handled_Sequence_Of_Statements (N : Node_Id); |
| 33 |
procedure Expand_N_Raise_Constraint_Error (N : Node_Id); |
| 34 |
procedure Expand_N_Raise_Expression (N : Node_Id); |
| 35 |
procedure Expand_N_Raise_Program_Error (N : Node_Id); |
| 36 |
procedure Expand_N_Raise_Statement (N : Node_Id); |
| 37 |
procedure Expand_N_Raise_When_Statement (N : Node_Id); |
| 38 |
procedure Expand_N_Raise_Storage_Error (N : Node_Id); |
| 39 |
|
| 40 |
-- Data structures for gathering information to build exception tables |
| 41 |
-- See runtime routine Ada.Exceptions for full details on the format and |
| 42 |
-- content of these tables. |
| 43 |
|
| 44 |
procedure Expand_At_End_Handler (HSS : Node_Id; Blk_Id : Entity_Id); |
| 45 |
-- Given handled statement sequence HSS for which the At_End_Proc field |
| 46 |
-- is set, and which currently has no exception handlers, this procedure |
| 47 |
-- expands the special exception handler required. This procedure also |
| 48 |
-- create a new scope for the given block, if Blk_Id is not Empty. |
| 49 |
|
| 50 |
procedure Expand_Exception_Handlers (HSS : Node_Id); |
| 51 |
-- This procedure expands exception handlers, and is called as part |
| 52 |
-- of the processing for Expand_N_Handled_Sequence_Of_Statements and |
| 53 |
-- is also called from Expand_At_End_Handler. N is the handled sequence |
| 54 |
-- of statements that has the exception handler(s) to be expanded. This |
| 55 |
-- is also called to expand the special exception handler built for |
| 56 |
-- accept bodies (see Exp_Ch9.Build_Accept_Body). |
| 57 |
|
| 58 |
function Find_Local_Handler |
| 59 |
(Ename : Entity_Id; |
| 60 |
Nod : Node_Id) return Node_Id; |
| 61 |
-- This function searches for a local exception handler that will handle |
| 62 |
-- the exception named by Ename. If such a local handler exists, then the |
| 63 |
-- corresponding N_Exception_Handler is returned. If no such handler is |
| 64 |
-- found then Empty is returned. In order to match and return True, the |
| 65 |
-- handler may not have a choice parameter specification. Nod is the raise |
| 66 |
-- node that references the handler. |
| 67 |
|
| 68 |
function Get_Local_Raise_Call_Entity return Entity_Id; |
| 69 |
-- This function is provided for use by the back end in conjunction with |
| 70 |
-- generation of Local_Raise calls when an exception raise is converted to |
| 71 |
-- a goto statement. If Local_Raise is defined, its entity is returned, |
| 72 |
-- if not, Empty is returned (in which case the call is silently skipped). |
| 73 |
|
| 74 |
-- WARNING: There is a matching C declaration of this subprogram in fe.h |
| 75 |
|
| 76 |
function Get_RT_Exception_Entity (R : RT_Exception_Code) return Entity_Id; |
| 77 |
-- This function is provided for use by the back end in conjunction with |
| 78 |
-- generation of Local_Raise calls when an exception raise is converted to |
| 79 |
-- a goto statement. The argument is the reason code which would be used |
| 80 |
-- to determine which Rcheck_nn procedure to call. The returned result is |
| 81 |
-- the exception entity to be passed to Local_Raise. |
| 82 |
|
| 83 |
-- WARNING: There is a matching C declaration of this subprogram in fe.h |
| 84 |
|
| 85 |
procedure Get_RT_Exception_Name (Code : RT_Exception_Code); |
| 86 |
-- This procedure is provided for use by the back end to obtain the name of |
| 87 |
-- the Rcheck procedure for Code. The name is appended to Namet.Name_Buffer |
| 88 |
-- without the __gnat_rcheck_ prefix. |
| 89 |
|
| 90 |
-- WARNING: There is a matching C declaration of this subprogram in fe.h |
| 91 |
|
| 92 |
procedure Possible_Local_Raise (N : Node_Id; E : Entity_Id); |
| 93 |
-- This procedure is called whenever node N might cause the back end |
| 94 |
-- to generate a local raise for a local Constraint/Program/Storage_Error |
| 95 |
-- exception. It deals with generating a warning if there is no local |
| 96 |
-- handler (and restriction No_Exception_Propagation is set), or if there |
| 97 |
-- is a local handler marking that it has a local raise. E is the entity |
| 98 |
-- of the corresponding exception. |
| 99 |
|
| 100 |
procedure Warn_If_No_Local_Raise (N : Node_Id); |
| 101 |
-- Called for an exception handler that is not the target of a local raise. |
| 102 |
-- Issues warning if No_Exception_Propagation restriction is set. N is the |
| 103 |
-- node for the handler. |
| 104 |
|
| 105 |
-- WARNING: There is a matching C declaration of this subprogram in fe.h |
| 106 |
|
| 107 |
end Exp_Ch11; |