summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-27 11:46:38 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-27 11:46:38 +0000
commit856311a7d14668cb10706e3e6222a49780b2530a (patch)
treede083c5e99a31d445fae58ac36235a1c5b4b2f48 /gcc/ada/sem_util.adb
parentdc02550c3889961085e5ffcff47f339230075d75 (diff)
downloadgcc-856311a7d14668cb10706e3e6222a49780b2530a.tar.gz
2015-10-27 Hristian Kirtchev <kirtchev@adacore.com>
* inline.adb (Is_Expression_Function): Removed. * sem_ch6.adb (Analyze_Subprogram_Body_Helper): An internally generated subprogram body that completes an expression function inherits the SPARK_Mode from the spec. * sem_res.adb (Resolve_Call): Update all calls to Is_Expression_Function. * sem_util.ads, sem_util.adb (Is_Expression_Function): Reimplemented. (Is_Expression_Function_Or_Completion): New routine. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229420 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb51
1 files changed, 35 insertions, 16 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index d8567c59e7f..a576862dcec 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -5081,7 +5081,6 @@ package body Sem_Util is
(Is_Concurrent_Type (Scope (Discriminal_Link (E)))
or else
Is_Concurrent_Record_Type (Scope (Discriminal_Link (E)))));
-
end Denotes_Discriminant;
-------------------------
@@ -11677,26 +11676,46 @@ package body Sem_Util is
----------------------------
function Is_Expression_Function (Subp : Entity_Id) return Boolean is
- Decl : Node_Id;
-
begin
- if Ekind (Subp) /= E_Function then
+ if Ekind_In (Subp, E_Function, E_Subprogram_Body) then
+ return
+ Nkind (Original_Node (Unit_Declaration_Node (Subp))) =
+ N_Expression_Function;
+ else
return False;
+ end if;
+ end Is_Expression_Function;
+
+ ------------------------------------------
+ -- Is_Expression_Function_Or_Completion --
+ ------------------------------------------
+
+ function Is_Expression_Function_Or_Completion
+ (Subp : Entity_Id) return Boolean
+ is
+ Subp_Decl : Node_Id;
+
+ begin
+ if Ekind (Subp) = E_Function then
+ Subp_Decl := Unit_Declaration_Node (Subp);
+
+ -- The function declaration is either an expression function or is
+ -- completed by an expression function body.
+
+ return
+ Is_Expression_Function (Subp)
+ or else (Nkind (Subp_Decl) = N_Subprogram_Declaration
+ and then Present (Corresponding_Body (Subp_Decl))
+ and then Is_Expression_Function
+ (Corresponding_Body (Subp_Decl)));
+
+ elsif Ekind (Subp) = E_Subprogram_Body then
+ return Is_Expression_Function (Subp);
else
- Decl := Unit_Declaration_Node (Subp);
- return Nkind (Decl) = N_Subprogram_Declaration
- and then
- (Nkind (Original_Node (Decl)) = N_Expression_Function
- or else
- (Present (Corresponding_Body (Decl))
- and then
- Nkind (Original_Node
- (Unit_Declaration_Node
- (Corresponding_Body (Decl)))) =
- N_Expression_Function));
+ return False;
end if;
- end Is_Expression_Function;
+ end Is_Expression_Function_Or_Completion;
-----------------------
-- Is_EVF_Expression --