| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT COMPILER COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- E X P _ S E L -- |
| 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 |
-- Routines used in Chapter 9 for the expansion of dispatching triggers in |
| 27 |
-- select statements (Ada 2005: AI-345) |
| 28 |
|
| 29 |
with Types; use Types; |
| 30 |
|
| 31 |
package Exp_Sel is |
| 32 |
|
| 33 |
function Build_Abort_Block |
| 34 |
(Loc : Source_Ptr; |
| 35 |
Blk_Ent : Entity_Id; |
| 36 |
Blk : Node_Id) return Node_Id; |
| 37 |
-- Generate: |
| 38 |
-- begin |
| 39 |
-- Blk |
| 40 |
-- exception |
| 41 |
-- when Abort_Signal => null; |
| 42 |
-- end; |
| 43 |
-- Blk_Ent is the identifier of Blk. |
| 44 |
-- The exception handler code is built by Build_Abort_Block_Handler. |
| 45 |
|
| 46 |
function Build_Abort_Block_Handler (Loc : Source_Ptr) return Node_Id; |
| 47 |
-- Generate: |
| 48 |
-- when Abort_Signal => null; |
| 49 |
-- This is an exception handler to stop propagation of aborts, without |
| 50 |
-- modifying the deferral level. |
| 51 |
|
| 52 |
function Build_B |
| 53 |
(Loc : Source_Ptr; |
| 54 |
Decls : List_Id) return Entity_Id; |
| 55 |
-- Generate: |
| 56 |
-- B : Boolean := False; |
| 57 |
-- Append the object declaration to the list and return its defining |
| 58 |
-- identifier. |
| 59 |
|
| 60 |
function Build_C |
| 61 |
(Loc : Source_Ptr; |
| 62 |
Decls : List_Id) return Entity_Id; |
| 63 |
-- Generate: |
| 64 |
-- C : Ada.Tags.Prim_Op_Kind; |
| 65 |
-- Append the object declaration to the list and return its defining |
| 66 |
-- identifier. |
| 67 |
|
| 68 |
function Build_Cleanup_Block |
| 69 |
(Loc : Source_Ptr; |
| 70 |
Blk_Ent : Entity_Id; |
| 71 |
Stmts : List_Id; |
| 72 |
Clean_Ent : Entity_Id) return Node_Id; |
| 73 |
-- Generate: |
| 74 |
-- declare |
| 75 |
-- procedure _clean is |
| 76 |
-- begin |
| 77 |
-- ... |
| 78 |
-- end _clean; |
| 79 |
-- begin |
| 80 |
-- Stmts |
| 81 |
-- at end |
| 82 |
-- _clean; |
| 83 |
-- end; |
| 84 |
-- Blk_Ent is the name of the generated block, Stmts is the list of |
| 85 |
-- encapsulated statements and Clean_Ent is the parameter to the |
| 86 |
-- _clean procedure. |
| 87 |
|
| 88 |
function Build_K |
| 89 |
(Loc : Source_Ptr; |
| 90 |
Decls : List_Id; |
| 91 |
Obj : Entity_Id) return Entity_Id; |
| 92 |
-- Generate |
| 93 |
-- K : Ada.Tags.Tagged_Kind := |
| 94 |
-- Ada.Tags.Get_Tagged_Kind (Ada.Tags.Tag (Obj)); |
| 95 |
-- where Obj is the pointer to a secondary table. Append the object |
| 96 |
-- declaration to the list and return its defining identifier. |
| 97 |
|
| 98 |
function Build_S |
| 99 |
(Loc : Source_Ptr; |
| 100 |
Decls : List_Id) return Entity_Id; |
| 101 |
-- Generate: |
| 102 |
-- S : Integer; |
| 103 |
-- Append the object declaration to the list and return its defining |
| 104 |
-- identifier. |
| 105 |
|
| 106 |
function Build_S_Assignment |
| 107 |
(Loc : Source_Ptr; |
| 108 |
S : Entity_Id; |
| 109 |
Obj : Entity_Id; |
| 110 |
Call_Ent : Entity_Id) return Node_Id; |
| 111 |
-- Generate: |
| 112 |
-- S := Ada.Tags.Get_Offset_Index ( |
| 113 |
-- Ada.Tags.Tag (Obj), DT_Position (Call_Ent)); |
| 114 |
-- where Obj is the pointer to a secondary table, Call_Ent is the entity |
| 115 |
-- of the dispatching call name. Return the generated assignment. |
| 116 |
|
| 117 |
end Exp_Sel; |