* [Ada] Add Return_Statement field
@ 2021-06-21 11:05 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-06-21 11:05 UTC (permalink / raw)
To: gcc-patches; +Cc: Richard Kenner
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
Used by GNAT LLVM to handle E_Constant and E_Variable with
Is_Return_Object.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* einfo.ads (Return_Statement): Add documentation.
* exp_ch6.adb (Expand_N_Extended_Return_Statement): Set it.
* gen_il-fields.ads: Add it.
* gen_il-gen-gen_entities.adb: Add it.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 2200 bytes --]
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -4206,6 +4206,11 @@ package Einfo is
-- entities (for convenience in setting it), but is only tested
-- for the function case.
+-- Return_Statement
+-- Defined in E_Variable. Set when Is_Return_Object is set, in which
+-- case it points to the N_Simple_Return_Statement made from the
+-- extended return statement.
+
-- Returns_By_Ref
-- Defined in subprogram type entities and functions. Set if a function
-- (or an access-to-function type) returns a result by reference, either
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -6033,6 +6033,7 @@ package body Exp_Ch6 is
-- Set the flag to prevent infinite recursion
Set_Comes_From_Extended_Return_Statement (Return_Stmt);
+ Set_Return_Statement (Ret_Obj_Id, Return_Stmt);
Rewrite (N, Result);
diff --git a/gcc/ada/gen_il-fields.ads b/gcc/ada/gen_il-fields.ads
--- a/gcc/ada/gen_il-fields.ads
+++ b/gcc/ada/gen_il-fields.ads
@@ -874,6 +874,7 @@ package Gen_IL.Fields is
Requires_Overriding,
Return_Applies_To,
Return_Present,
+ Return_Statement,
Returns_By_Ref,
Reverse_Bit_Order,
Reverse_Storage_Order,
diff --git a/gcc/ada/gen_il-gen-gen_entities.adb b/gcc/ada/gen_il-gen-gen_entities.adb
--- a/gcc/ada/gen_il-gen-gen_entities.adb
+++ b/gcc/ada/gen_il-gen-gen_entities.adb
@@ -350,6 +350,7 @@ begin -- Gen_IL.Gen.Gen_Entities
Sm (Prival_Link, Node_Id),
Sm (Related_Expression, Node_Id),
Sm (Related_Type, Node_Id),
+ Sm (Return_Statement, Node_Id),
Sm (Size_Check_Code, Node_Id),
Sm (SPARK_Pragma, Node_Id),
Sm (SPARK_Pragma_Inherited, Flag),
@@ -421,6 +422,7 @@ begin -- Gen_IL.Gen.Gen_Entities
Sm (Prival_Link, Node_Id),
Sm (Related_Expression, Node_Id),
Sm (Related_Type, Node_Id),
+ Sm (Return_Statement, Node_Id),
Sm (Shared_Var_Procs_Instance, Node_Id),
Sm (Size_Check_Code, Node_Id),
Sm (SPARK_Pragma, Node_Id),
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-21 11:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-21 11:05 [Ada] Add Return_Statement field Pierre-Marie de Rodat
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).