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.
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),