aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch6.ads
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2006-10-31 18:55:05 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2006-10-31 18:55:05 +0100
commit02822a92a4880fe678967713c9d4988fe7ca9e55 (patch)
treee84a5d28ef7976d5b926e2e9576778e74f334291 /gcc/ada/exp_ch6.ads
parentefd6ef80ca7d6de864faeb5835712729da984b62 (diff)
downloadgcc-02822a92a4880fe678967713c9d4988fe7ca9e55.zip
gcc-02822a92a4880fe678967713c9d4988fe7ca9e55.tar.gz
gcc-02822a92a4880fe678967713c9d4988fe7ca9e55.tar.bz2
exp_ch6.ads, [...]: Use new Validity_Check suppression capability.
2006-10-31 Robert Dewar <dewar@adacore.com> Ed Schonberg <schonberg@adacore.com> Bob Duff <duff@adacore.com> Gary Dismukes <dismukes@adacore.com> * exp_ch6.ads, exp_ch6.adb: Use new Validity_Check suppression capability. (Expand_Inlined_Call): Tagged types are by-reference types, and therefore should be replaced by a renaming declaration in the expanded body, as is done for limited types. (Expand_Call): If this is a call to a function with dispatching access result, propagate tag from context. (Freeze_Subprogram): Enable full ABI compatibility for interfacing with CPP by default. (Make_Build_In_Place_Call_In_Assignment): New procedure to do build-in-place when the right-hand side of an assignment is a build-in-place function call. (Make_Build_In_Place_Call_In_Allocator): Apply an unchecked conversion of the explicit dereference of the allocator to the result subtype of the build-in-place function. This is needed to satisfy type checking in cases where the caller's return object is created by an allocator for a class-wide access type and the type named in the allocator is a specific type. (Make_Build_In_Place_Call_In_Object_Declaration): Apply an unchecked conversion of the reference to the declared object to the result subtype of the build-in-place function. This is needed to satisfy type checking in cases where the declared object has a class-wide type. Also, in the class-wide case, change the type of the object entity to the specific result subtype of the function, to avoid passing a class-wide object without explicit initialization to the back end. (Register_Interface_DT_Entry): Moved outside the body of Freeze_Subprogram because this routine is now public; it is called from Check_Dispatching_Overriding to handle late overriding of abstract interface primitives. (Add_Access_Actual_To_Build_In_Place_Call): New utility procedure for adding an implicit access actual on a call to a build-in-place function. (Expand_Actuals): Test for an actual parameter that is a call to a build-in-place function and apply Make_Build_In_Place_Call_In_Anonymous_Context to the call. (Is_Build_In_Place_Function): New function to determine whether an entity is a function whose calls should be handled as build-in-place. (Is_Build_In_Place_Function_Call): New function to determine whether an expression is a function call that should handled as build-in-place. (Make_Build_In_Place_Call_In_Allocator): New procedure for handling calls to build-in-place functions as the initialization of an allocator. (Make_Build_In_Place_Call_In_Anonymous_Context): New procedure for handling calls to build-in-place functions in contexts that do not involve init of a separate object (for example, actuals of subprogram calls). (Make_Build_In_Place_Call_In_Object_Declaration): New procedure for handling calls to build-in-place functions as the initialization of an object declaration. (Detect_Infinite_Recursion): Add explicit parameter Process to instantiation of Traverse_Body to avoid unreferenced warning. (Check_Overriding_Inherited_Interfaces): Removed. (Register_Interface_DT_Entry): Code cleanup. (Register_Predefined_DT_Entry): Code cleanup. (Expand_Inlined_Call.Rewrite_Procedure_Call): Do not omit block around inlined statements if within a transient scope. (Expand_Inlined_Call.Process_Formals): When replacing occurrences of formal parameters with occurrences of actuals in inlined body, establish visibility on the proper view of the actual's subtype for the body's context. (Freeze_Subprogram): Do nothing if we are compiling under full ABI compatibility mode and we have an imported CPP subprogram because for now we assume that imported CPP primitives correspond with objects whose constructor is in the CPP side (and therefore we don't need to generate code to register them in the dispatch table). (Expand_Actuals): Introduce copy of actual, only if it might be a bit- aligned selected component. (Add_Call_By_Copy_Node): Add missing code to handle the case in which the actual of an in-mode parameter is a type conversion. (Expand_Actuals): If the call does not come from source and the actual is potentially misaligned, let gigi handle it rather than rejecting the (Expand_N_Subprogram_Body, Freeze_Subprogram): set subprograms returning Class Wide types as returning by reference independantly of their controlled status since with HIE runtimes class wide types are not potentially controlled anymore. From-SVN: r118260
Diffstat (limited to 'gcc/ada/exp_ch6.ads')
-rw-r--r--gcc/ada/exp_ch6.ads63
1 files changed, 62 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch6.ads b/gcc/ada/exp_ch6.ads
index e36a4c2..219ce70 100644
--- a/gcc/ada/exp_ch6.ads
+++ b/gcc/ada/exp_ch6.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- Copyright (C) 1992,1993,1994,1995 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2006, 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- --
@@ -40,9 +40,70 @@ package Exp_Ch6 is
-- This procedure contains common processing for Expand_N_Function_Call,
-- Expand_N_Procedure_Statement, and Expand_N_Entry_Call.
+ function Is_Build_In_Place_Function (E : Entity_Id) return Boolean;
+ -- Ada 2005 (AI-318-02): Returns True if E denotes a function or an
+ -- access-to-function type whose result must be built in place; otherwise
+ -- returns False. Currently this is restricted to the subset of functions
+ -- whose result subtype is a constrained inherently limited type.
+
+ function Is_Build_In_Place_Function_Call (N : Node_Id) return Boolean;
+ -- Ada 2005 (AI-318-02): Returns True if N denotes a call to a function
+ -- that requires handling as a build-in-place call or is a qualified
+ -- expression applied to such a call; otherwise returns False.
+
procedure Freeze_Subprogram (N : Node_Id);
-- generate the appropriate expansions related to Subprogram freeze
-- nodes (e. g. the filling of the corresponding Dispatch Table for
-- Primitive Operations)
+ procedure Make_Build_In_Place_Call_In_Allocator
+ (Allocator : Node_Id;
+ Function_Call : Node_Id);
+ -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
+ -- occurs as the expression initializing an allocator, by passing access
+ -- to the allocated object as an additional parameter of the function call.
+ -- A new access object is declared that is initialized to the result of the
+ -- allocator, passed to the function, and the allocator is rewritten to
+ -- refer to that access object. Function_Call must denote either an
+ -- N_Function_Call node for which Is_Build_In_Place_Call is True, or else
+ -- an N_Qualified_Expression node applied to such a function call.
+
+ procedure Make_Build_In_Place_Call_In_Anonymous_Context
+ (Function_Call : Node_Id);
+ -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
+ -- occurs in a context that does not provide a separate object. A temporary
+ -- object is created to act as the return object and an access to the
+ -- temporary is passed as an additional parameter of the call. This occurs
+ -- in contexts such as subprogram call actuals and object renamings.
+ -- Function_Call must denote either an N_Function_Call node for which
+ -- Is_Build_In_Place_Call is True, or else an N_Qualified_Expression node
+ -- applied to such a function call.
+
+ procedure Make_Build_In_Place_Call_In_Assignment
+ (Assign : Node_Id;
+ Function_Call : Node_Id);
+ -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
+ -- occurs as the right-hand side of an assignment statement by passing
+ -- access to the left-hand sid as an additional parameter of the function
+ -- call. Assign must denote a N_Assignment_Statement. Function_Call must
+ -- denote either an N_Function_Call node for which Is_Build_In_Place_Call
+ -- is True, or an N_Qualified_Expression node applied to such a function
+ -- call.
+
+ procedure Make_Build_In_Place_Call_In_Object_Declaration
+ (Object_Decl : Node_Id;
+ Function_Call : Node_Id);
+ -- Ada 2005 (AI-318-02): Handle a call to a build-in-place function that
+ -- occurs as the expression initializing an object declaration by
+ -- passing access to the declared object as an additional parameter of the
+ -- function call. Function_Call must denote either an N_Function_Call node
+ -- for which Is_Build_In_Place_Call is True, or an N_Qualified_Expression
+ -- node applied to such a function call.
+
+ procedure Register_Interface_DT_Entry
+ (Related_Nod : Node_Id;
+ Prim : Entity_Id);
+ -- Ada 2005 (AI-251): Register a primitive in a secondary dispatch table.
+ -- Related_Nod is the node after which the expanded code will be inserted.
+
end Exp_Ch6;