gcc/ada/: * projects.texi: Fix typos. * gnat_rm.texi: Likewise. * gnat_ugn.texi: Likewise. * sem_util.adb: Fix typo in variable, typos in comments. * a-btgbso.adb: Fix typos in comments. * a-cbdlli.adb, a-cbhase.ads, a-cdlili.adb, a-cobove.adb, a-coinve.adb, a-convec.adb, a-direct.ads, a-strunb-shared.adb, a-strunb-shared.ads, a-stuten.ads, a-stwiun-shared.adb, a-stwiun-shared.ads, a-stzunb-shared.adb, a-stzunb-shared.ads, a-suenco.adb, a-suenst.adb, a-suewst.adb, a-suezst.adb, ali.ads, aspects.ads, atree.ads, binde.adb, bindgen.adb, checks.adb, checks.ads, einfo.ads, err_vars.ads, errout.adb, errout.ads, exp_aggr.adb, exp_attr.adb, exp_cg.adb, exp_ch3.adb, exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_dbug.ads, exp_disp.adb, exp_fixd.ads, freeze.adb, g-altive.ads, g-comlin.ads, g-excact.ads, g-mbdira.adb, g-sechas.ads, g-sehash.ads, g-sha1.ads, g-sha224.ads, g-sha256.ads, g-sha384.ads, g-sha512.ads, g-shsh32.ads, g-shsh64.ads, g-socket.adb, g-socket.ads, g-sothco.ads, gcc-interface/decl.c, gcc-interface/trans.c, gcc-interface/utils2.c, gnat1drv.adb, init.c, inline.adb, link.c, locales.c, make.adb, mingw32.h, namet.ads, osint.adb, par-ch12.adb, par-ch13.adb, par-ch3.adb, par-ch4.adb, par-prag.adb, par.adb, par_sco.adb, prepcomp.adb, prj-conf.ads, prj-dect.adb, prj-env.adb, prj-env.ads, prj-nmsc.adb, prj-tree.ads, prj-util.ads, prj.adb, prj.ads, s-auxdec-vms-alpha.adb, s-auxdec-vms_64.ads, s-oscons-tmplt.c, s-osinte-vxworks.ads, s-osprim-mingw.adb, s-regexp.adb, s-stusta.adb, s-taprop-mingw.adb, s-taprop-solaris.adb, scn.adb, scos.ads, sem.adb, sem_aggr.adb, sem_attr.adb, sem_aux.adb, sem_aux.ads, sem_ch12.adb, sem_ch12.ads, sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch4.adb, sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_disp.adb, sem_disp.ads, sem_eval.adb, sem_intr.adb, sem_prag.adb, sem_res.adb, sem_scil.adb, sem_util.ads, sem_warn.adb, sem_warn.ads, sinfo.ads, socket.c, styleg.adb, switch.ads, sysdep.c, tb-alvxw.c, xoscons.adb: Likewise. From-SVN: r168082
224 lines
7.9 KiB
Ada
224 lines
7.9 KiB
Ada
------------------------------------------------------------------------------
|
|
-- --
|
|
-- GNAT COMPILER COMPONENTS --
|
|
-- --
|
|
-- S E M _ S C I L --
|
|
-- --
|
|
-- B o d y --
|
|
-- --
|
|
-- Copyright (C) 2009-2010, Free Software Foundation, Inc. --
|
|
-- --
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
|
-- for more details. You should have received a copy of the GNU General --
|
|
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
|
|
-- http://www.gnu.org/licenses for a complete copy of the license. --
|
|
-- --
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
-- --
|
|
------------------------------------------------------------------------------
|
|
|
|
with Einfo; use Einfo;
|
|
with Nlists; use Nlists;
|
|
with Rtsfind; use Rtsfind;
|
|
with Sem_Aux; use Sem_Aux;
|
|
with Sinfo; use Sinfo;
|
|
with Stand; use Stand;
|
|
with SCIL_LL; use SCIL_LL;
|
|
|
|
package body Sem_SCIL is
|
|
|
|
---------------------
|
|
-- Check_SCIL_Node --
|
|
---------------------
|
|
|
|
function Check_SCIL_Node (N : Node_Id) return Traverse_Result is
|
|
SCIL_Node : constant Node_Id := Get_SCIL_Node (N);
|
|
Ctrl_Tag : Node_Id;
|
|
Ctrl_Typ : Entity_Id;
|
|
|
|
begin
|
|
-- For nodes that do not have SCIL node continue traversing the tree
|
|
|
|
if No (SCIL_Node) then
|
|
return OK;
|
|
end if;
|
|
|
|
case Nkind (SCIL_Node) is
|
|
when N_SCIL_Dispatch_Table_Tag_Init =>
|
|
pragma Assert (Nkind (N) = N_Object_Declaration);
|
|
null;
|
|
|
|
when N_SCIL_Dispatching_Call =>
|
|
Ctrl_Tag := SCIL_Controlling_Tag (SCIL_Node);
|
|
|
|
-- Parent of SCIL dispatching call nodes MUST be a subprogram call
|
|
|
|
if not Nkind_In (N, N_Function_Call,
|
|
N_Procedure_Call_Statement)
|
|
then
|
|
pragma Assert (False);
|
|
raise Program_Error;
|
|
|
|
-- In simple cases the controlling tag is the tag of the
|
|
-- controlling argument (i.e. Obj.Tag).
|
|
|
|
elsif Nkind (Ctrl_Tag) = N_Selected_Component then
|
|
Ctrl_Typ := Etype (Ctrl_Tag);
|
|
|
|
-- Interface types are unsupported
|
|
|
|
if Is_Interface (Ctrl_Typ)
|
|
or else (RTE_Available (RE_Interface_Tag)
|
|
and then Ctrl_Typ = RTE (RE_Interface_Tag))
|
|
then
|
|
null;
|
|
|
|
else
|
|
pragma Assert (Ctrl_Typ = RTE (RE_Tag));
|
|
null;
|
|
end if;
|
|
|
|
-- When the controlling tag of a dispatching call is an identifier
|
|
-- the SCIL_Controlling_Tag attribute references the corresponding
|
|
-- object or parameter declaration. Interface types are still
|
|
-- unsupported.
|
|
|
|
elsif Nkind_In (Ctrl_Tag, N_Object_Declaration,
|
|
N_Parameter_Specification)
|
|
then
|
|
Ctrl_Typ := Etype (Defining_Identifier (Ctrl_Tag));
|
|
|
|
-- Interface types are unsupported.
|
|
|
|
if Is_Interface (Ctrl_Typ)
|
|
or else (RTE_Available (RE_Interface_Tag)
|
|
and then Ctrl_Typ = RTE (RE_Interface_Tag))
|
|
or else (Is_Access_Type (Ctrl_Typ)
|
|
and then
|
|
Is_Interface
|
|
(Available_View
|
|
(Base_Type (Designated_Type (Ctrl_Typ)))))
|
|
then
|
|
null;
|
|
|
|
else
|
|
pragma Assert
|
|
(Ctrl_Typ = RTE (RE_Tag)
|
|
or else
|
|
(Is_Access_Type (Ctrl_Typ)
|
|
and then Available_View
|
|
(Base_Type (Designated_Type (Ctrl_Typ)))
|
|
= RTE (RE_Tag)));
|
|
null;
|
|
end if;
|
|
|
|
-- Interface types are unsupported
|
|
|
|
elsif Is_Interface (Etype (Ctrl_Tag)) then
|
|
null;
|
|
|
|
else
|
|
pragma Assert (False);
|
|
raise Program_Error;
|
|
end if;
|
|
|
|
return Skip;
|
|
|
|
when N_SCIL_Membership_Test =>
|
|
|
|
-- Check contents of the boolean expression associated with the
|
|
-- membership test.
|
|
|
|
pragma Assert (Nkind_In (N, N_Identifier,
|
|
N_And_Then,
|
|
N_Or_Else,
|
|
N_Expression_With_Actions)
|
|
and then Etype (N) = Standard_Boolean);
|
|
|
|
-- Check the entity identifier of the associated tagged type (that
|
|
-- is, in testing for membership in T'Class, the entity id of the
|
|
-- specific type T).
|
|
|
|
-- Note: When the SCIL node is generated the private and full-view
|
|
-- of the tagged types may have been swapped and hence the node
|
|
-- referenced by attribute SCIL_Entity may be the private view.
|
|
-- Therefore, in order to uniformly locate the full-view we use
|
|
-- attribute Underlying_Type.
|
|
|
|
pragma Assert
|
|
(Is_Tagged_Type (Underlying_Type (SCIL_Entity (SCIL_Node))));
|
|
|
|
-- Interface types are unsupported
|
|
|
|
pragma Assert
|
|
(not Is_Interface (Underlying_Type (SCIL_Entity (SCIL_Node))));
|
|
|
|
-- Check the decoration of the expression that denotes the tag
|
|
-- value being tested
|
|
|
|
Ctrl_Tag := SCIL_Tag_Value (SCIL_Node);
|
|
|
|
case Nkind (Ctrl_Tag) is
|
|
|
|
-- For class-wide membership tests the SCIL tag value is the
|
|
-- tag of the tested object (i.e. Obj.Tag).
|
|
|
|
when N_Selected_Component =>
|
|
pragma Assert (Etype (Ctrl_Tag) = RTE (RE_Tag));
|
|
null;
|
|
|
|
when others =>
|
|
pragma Assert (False);
|
|
null;
|
|
end case;
|
|
|
|
return Skip;
|
|
|
|
when others =>
|
|
pragma Assert (False);
|
|
raise Program_Error;
|
|
end case;
|
|
|
|
return Skip;
|
|
end Check_SCIL_Node;
|
|
|
|
-------------------------
|
|
-- First_Non_SCIL_Node --
|
|
-------------------------
|
|
|
|
function First_Non_SCIL_Node (L : List_Id) return Node_Id is
|
|
N : Node_Id;
|
|
|
|
begin
|
|
N := First (L);
|
|
while Nkind (N) in N_SCIL_Node loop
|
|
Next (N);
|
|
end loop;
|
|
|
|
return N;
|
|
end First_Non_SCIL_Node;
|
|
|
|
------------------------
|
|
-- Next_Non_SCIL_Node --
|
|
------------------------
|
|
|
|
function Next_Non_SCIL_Node (N : Node_Id) return Node_Id is
|
|
Aux_N : Node_Id;
|
|
|
|
begin
|
|
Aux_N := Next (N);
|
|
while Nkind (Aux_N) in N_SCIL_Node loop
|
|
Next (Aux_N);
|
|
end loop;
|
|
|
|
return Aux_N;
|
|
end Next_Non_SCIL_Node;
|
|
|
|
end Sem_SCIL;
|