aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/inline.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r--gcc/ada/inline.adb73
1 files changed, 4 insertions, 69 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 9e60fa8..0cb879a 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -34,7 +34,6 @@ with Elists; use Elists;
with Errout; use Errout;
with Exp_Ch6; use Exp_Ch6;
with Exp_Ch7; use Exp_Ch7;
-with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Fname; use Fname;
with Fname.UF; use Fname.UF;
@@ -287,10 +286,6 @@ package body Inline is
-- Return the entity node for the unit containing E. Always return the spec
-- for a package.
- function Has_Initialized_Type (E : Entity_Id) return Boolean;
- -- If a candidate for inlining contains type declarations for types with
- -- nontrivial initialization procedures, they are not worth inlining.
-
function Has_Single_Return (N : Node_Id) return Boolean;
-- In general we cannot inline functions that return unconstrained type.
-- However, we can handle such functions if all return statements return
@@ -758,14 +753,15 @@ package body Inline is
-- an instance whose body will be analyzed anyway or the subprogram was
-- generated as a body by the compiler (for example an initialization
-- procedure) or its declaration was provided along with the body (for
- -- example an expression function) and it does not declare types with
- -- nontrivial initialization procedures.
+ -- example an expression function). Note that we need to test again the
+ -- Is_Inlined flag because Analyze_Subprogram_Body_Helper may have reset
+ -- it if the body contains excluded declarations or statements.
if (Is_Inlined (Pack)
or else Is_Generic_Instance (Pack)
or else Nkind (Decl) = N_Subprogram_Body
or else Present (Corresponding_Body (Decl)))
- and then not Has_Initialized_Type (E)
+ and then Is_Inlined (E)
then
Register_Backend_Inlined_Subprogram (E);
@@ -3380,15 +3376,6 @@ package body Inline is
-- be performed in a separate pass, using an instantiation of the
-- previous subprogram over aspect specifications reachable from N.
- function Process_Sloc (Nod : Node_Id) return Traverse_Result;
- -- If the call being expanded is that of an internal subprogram, set the
- -- sloc of the generated block to that of the call itself, so that the
- -- expansion is skipped by the "next" command in gdb. Same processing
- -- for a subprogram in a predefined file, e.g. Ada.Tags. If
- -- Debug_Generated_Code is true, suppress this change to simplify our
- -- own development. Same in GNATprove mode, to ensure that warnings and
- -- diagnostics point to the proper location.
-
procedure Reset_Dispatching_Calls (N : Node_Id);
-- In subtree N search for occurrences of dispatching calls that use the
-- Ada 2005 Object.Operation notation and the object is a formal of the
@@ -3647,22 +3634,6 @@ package body Inline is
procedure Replace_Formals_In_Aspects is
new Traverse_Proc (Process_Formals_In_Aspects);
- ------------------
- -- Process_Sloc --
- ------------------
-
- function Process_Sloc (Nod : Node_Id) return Traverse_Result is
- begin
- if not Debug_Generated_Code then
- Set_Sloc (Nod, Sloc (N));
- Set_Comes_From_Source (Nod, False);
- end if;
-
- return OK;
- end Process_Sloc;
-
- procedure Reset_Slocs is new Traverse_Proc (Process_Sloc);
-
------------------------------
-- Reset_Dispatching_Calls --
------------------------------
@@ -4176,13 +4147,6 @@ package body Inline is
Replace_Formals_In_Aspects (Blk);
Set_Parent (Blk, N);
- if GNATprove_Mode then
- null;
-
- elsif not Comes_From_Source (Subp) or else Is_Predef then
- Reset_Slocs (Blk);
- end if;
-
if Is_Unc_Decl then
-- No action needed since return statement has been already removed
@@ -4560,35 +4524,6 @@ package body Inline is
return False;
end Has_Excluded_Statement;
- --------------------------
- -- Has_Initialized_Type --
- --------------------------
-
- function Has_Initialized_Type (E : Entity_Id) return Boolean is
- E_Body : constant Node_Id := Subprogram_Body (E);
- Decl : Node_Id;
-
- begin
- if No (E_Body) then -- imported subprogram
- return False;
-
- else
- Decl := First (Declarations (E_Body));
- while Present (Decl) loop
- if Nkind (Decl) = N_Full_Type_Declaration
- and then Comes_From_Source (Decl)
- and then Present (Init_Proc (Defining_Identifier (Decl)))
- then
- return True;
- end if;
-
- Next (Decl);
- end loop;
- end if;
-
- return False;
- end Has_Initialized_Type;
-
-----------------------
-- Has_Single_Return --
-----------------------