2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / ada / sem_disp.ads
blob129047b7f8a05faffe7a69ff9ba56dedbc7a7639
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S E M _ D I S P --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2002 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 2, 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 COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- This package contains routines involved in tagged types and dynamic
28 -- dispatching.
30 with Types; use Types;
31 package Sem_Disp is
33 procedure Check_Controlling_Formals (Typ : Entity_Id; Subp : Entity_Id);
34 -- Check that all controlling parameters of Subp are of type Typ,
35 -- that defaults for controlling parameters are tag-indeterminate,
36 -- and that the nominal subtype of the parameters and result
37 -- statically match the first subtype of the controlling type.
39 procedure Check_Dispatching_Call (N : Node_Id);
40 -- Check if a call is a dispatching call. The subprogram is known to
41 -- be a dispatching operation. The call is dispatching if all the
42 -- controlling actuals are dynamically tagged. This procedure is called
43 -- after overload resolution, so the call is known to be unambiguous.
45 procedure Check_Dispatching_Operation (Subp, Old_Subp : Entity_Id);
46 -- Add "Subp" to the list of primitive operations of the corresponding type
47 -- if it has a parameter of this type and is defined at a proper place for
48 -- primitive operations (new primitives are only defined in package spec,
49 -- overridden operation can be defined in any scope). If Old_Subp is not
50 -- Empty we are in the overriding case.
52 procedure Check_Operation_From_Incomplete_Type
53 (Subp : Entity_Id;
54 Typ : Entity_Id);
55 -- If a primitive operation was defined for the incomplete view of the
56 -- type, and the full type declaration is a derived type definition,
57 -- the operation may override an inherited one.
59 procedure Check_Operation_From_Private_View (Subp, Old_Subp : Entity_Id);
60 -- Add "Old_Subp" to the list of primitive operations of the corresponding
61 -- tagged type if it is the full view of a private tagged type. The Alias
62 -- of "OldSubp" is adjusted to point to the inherited procedure of the
63 -- full view because it is always this one which has to be called.
65 function Find_Controlling_Arg (N : Node_Id) return Node_Id;
66 -- Returns the actual controlling argument if N is dynamically tagged,
67 -- and Empty if it is not dynamically tagged.
69 function Find_Dispatching_Type (Subp : Entity_Id) return Entity_Id;
70 -- Check whether a subprogram is dispatching, and find the tagged
71 -- type of the controlling argument or arguments.
73 function Is_Dynamically_Tagged (N : Node_Id) return Boolean;
74 -- Used to determine whether a call is dispatching, i.e. if is an
75 -- an expression of a class_Wide type, or a call to a function with
76 -- controlling result where at least one operand is dynamically tagged.
78 function Is_Tag_Indeterminate (N : Node_Id) return Boolean;
79 -- An expression is tag-indeterminate if it is a call that dispatches
80 -- on result, and all controlling operands are also indeterminate.
81 -- Such a function call may inherit a tag from an enclosing call.
83 procedure Propagate_Tag (Control : Node_Id; Actual : Node_Id);
84 -- If a function call is tag-indeterminate, its controlling argument is
85 -- found in the context; either an enclosing call, or the left-hand side
86 -- of the enclosing assignment statement. The tag must be propagated
87 -- recursively to the tag-indeterminate actuals of the call.
89 end Sem_Disp;