exp_ch4.adb (Expand_N_Allocator): Generate meaningful names for a dynamic task if...
[platform/upstream/gcc.git] / gcc / ada / sem_res.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT COMPILER COMPONENTS                         --
4 --                                                                          --
5 --                              S E M _ R E S                               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                            $Revision: 1.19 $
10 --                                                                          --
11 --          Copyright (C) 1992-1999 Free Software Foundation, Inc.          --
12 --                                                                          --
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.                                                      --
23 --                                                                          --
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). --
26 --                                                                          --
27 ------------------------------------------------------------------------------
28
29 --  Resolution processing for all subexpression nodes. Note that the separate
30 --  package Sem_Aggr contains the actual resolution routines for aggregates,
31 --  which are separated off since aggregate processing is complex.
32
33 with Snames; use Snames;
34 with Types;  use Types;
35
36 package Sem_Res is
37
38    --  As described in Sem_Ch4, the type resolution proceeds in two phases.
39    --  The first phase is a bottom up pass that is achieved during the
40    --  recursive traversal performed by the Analyze procedures. This phase
41    --  determines unambiguous types, and collects sets of possible types
42    --  where the interpretation is potentially ambiguous.
43
44    --  On completing this bottom up pass, which corresponds to a call to
45    --  Analyze on a complete context, the Resolve routine is called which
46    --  performs a top down resolution with recursive calls to itself to
47    --  resolve operands.
48
49    --  Since in practice a lot of semantic analysis has to be postponed until
50    --  types are known (e.g. static folding, setting of suppress flags), the
51    --  Resolve routines also complete the semantic analyze, and also call the
52    --  expander for possibly expansion of the completely type resolved node.
53
54    procedure Resolve (N : Node_Id; Typ : Entity_Id);
55    procedure Resolve (N : Node_Id; Typ : Entity_Id; Suppress : Check_Id);
56    --  Top level type-checking procedure, called in a complete context. The
57    --  construct N, which is a subexpression, has already been analyzed, and
58    --  is required to be of type Typ given the analysis of the context (which
59    --  uses the information gathered on the bottom up phase in Analyze). The
60    --  resolve routines do various other processing, e.g. static evaluation.
61    --  If a Suppress argument is present, then the resolution is done with the
62    --  specified check suppressed (can be All_Checks to suppress all checks).
63
64    procedure Resolve_Discrete_Subtype_Indication
65      (N   : Node_Id;
66       Typ : Entity_Id);
67    --  Resolve subtype indications in choices (case statements and
68    --  aggregates) and in index constraints. Note that the resulting Etype
69    --  of the subtype indication node is set to the Etype of the contained
70    --  range (i.e. an Itype is not constructed for the actual subtype).
71
72    procedure Resolve_Entry (Entry_Name : Node_Id);
73    --  Find name of entry being called, and resolve prefix of name with its
74    --  own type. For now we assume that the prefix cannot be overloaded and
75    --  the name of the entry plays no role in the resolution.
76
77    procedure Analyze_And_Resolve (N : Node_Id);
78    procedure Analyze_And_Resolve (N : Node_Id; Typ : Entity_Id);
79    procedure Analyze_And_Resolve
80      (N        : Node_Id;
81       Typ      : Entity_Id;
82       Suppress : Check_Id);
83    procedure Analyze_And_Resolve
84      (N        : Node_Id;
85       Suppress : Check_Id);
86    --  These routines combine the effect of Analyze and Resolve. If a Suppress
87    --  argument is present, then the analysis is done with the specified check
88    --  suppressed (can be All_Checks to suppress all checks). These checks are
89    --  suppressed for both the analysis and resolution. If the type argument
90    --  is not present, then the Etype of the expression after the Analyze
91    --  call is used for the Resolve.
92
93    procedure Check_Parameterless_Call (N : Node_Id);
94    --  Several forms of names can denote calls to entities without para-
95    --  meters. The context determines whether the name denotes the entity
96    --  or a call to it. When it is a call, the node must be rebuilt
97    --  accordingly (deprocedured, in A68 terms) and renalyzed to obtain
98    --  possible interpretations.
99    --
100    --  The name may be that of an overloadable construct, or it can be an
101    --  explicit dereference of a prefix that denotes an access to subprogram.
102    --  In that case, we want to convert the name into a call only if the
103    --  context requires the return type of the subprogram.  Finally, a
104    --  parameterless protected subprogram appears as a selected component.
105    --
106    --  The parameter T is the Typ for the corresponding resolve call.
107
108    procedure Pre_Analyze_And_Resolve (N : Node_Id; T : Entity_Id);
109    --  Performs a pre-analysis of expression node N. During pre-analysis
110    --  N is analyzed and then resolved against type T, but no expansion
111    --  is carried out for N or its children. For more info on pre-analysis
112    --  read the spec of Sem.
113
114    procedure Pre_Analyze_And_Resolve (N : Node_Id);
115    --  Same, but use type of node because context does not impose a single
116    --  type.
117
118 end Sem_Res;