public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/guojiufu-branch)] [Ada] Move routine for detecting special Text_IO packages from GNATprove
@ 2020-06-10 3:38 Jiu Fu Guo
0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-06-10 3:38 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d1987ffdc27f0302dba0958083d69b7241194c1c
commit d1987ffdc27f0302dba0958083d69b7241194c1c
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Mon Feb 3 17:44:41 2020 +0100
[Ada] Move routine for detecting special Text_IO packages from GNATprove
2020-06-05 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* rtsfind.ads, rtsfind.adb (Is_Text_IO_Special_Package): Moved
from the GNATprove backend to the frontend.
Diff:
---
gcc/ada/rtsfind.adb | 31 +++++++++++++++++++++++++++++++
gcc/ada/rtsfind.ads | 6 ++++++
2 files changed, 37 insertions(+)
diff --git a/gcc/ada/rtsfind.adb b/gcc/ada/rtsfind.adb
index 5983ba95ff2..c43561c884d 100644
--- a/gcc/ada/rtsfind.adb
+++ b/gcc/ada/rtsfind.adb
@@ -759,6 +759,37 @@ package body Rtsfind is
return Present (E) and then E = Ent;
end Is_RTU;
+ --------------------------------
+ -- Is_Text_IO_Special_Package --
+ --------------------------------
+
+ function Is_Text_IO_Special_Package (E : Entity_Id) return Boolean is
+ begin
+ pragma Assert (Is_Package_Or_Generic_Package (E));
+
+ -- ??? detection with a scope climbing might be more efficient
+
+ for U in Ada_Text_IO_Child loop
+ if Is_RTU (E, U) then
+ return True;
+ end if;
+ end loop;
+
+ for U in Ada_Wide_Text_IO_Child loop
+ if Is_RTU (E, U) then
+ return True;
+ end if;
+ end loop;
+
+ for U in Ada_Wide_Wide_Text_IO_Child loop
+ if Is_RTU (E, U) then
+ return True;
+ end if;
+ end loop;
+
+ return False;
+ end Is_Text_IO_Special_Package;
+
-----------------------------
-- Is_Text_IO_Special_Unit --
-----------------------------
diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads
index a86b98ef364..13d22535a3d 100644
--- a/gcc/ada/rtsfind.ads
+++ b/gcc/ada/rtsfind.ads
@@ -3188,6 +3188,12 @@ package Rtsfind is
-- Wide_Wide_Text_IO.xxx, where xxx is one of the subpackages of Text_IO
-- that is specially handled as described for Check_Text_IO_Special_Unit.
+ function Is_Text_IO_Special_Package (E : Entity_Id) return Boolean;
+ -- Return True iff E is one of the special generic Text_IO packages, which
+ -- Ada RM defines to be nested in Ada.Text_IO, but GNAT defines as its
+ -- private children. This is similar to Is_Text_IO_Special_Unit, but is
+ -- meant to be used on a fully resolved AST, especially in the backends.
+
function RTE (E : RE_Id) return Entity_Id;
-- Given the entity defined in the above tables, as identified by the
-- corresponding value in the RE_Id enumeration type, returns the Id of the
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-10 3:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 3:38 [gcc(refs/users/guojiufu/heads/guojiufu-branch)] [Ada] Move routine for detecting special Text_IO packages from GNATprove Jiu Fu Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).