From df0148024e67c34820ee77d6cbbd4370e9ebc977 Mon Sep 17 00:00:00 2001 From: charlet Date: Thu, 20 Nov 2014 10:56:01 +0000 Subject: [PATCH] 2014-11-20 Eric Botcazou * sem_ch3.adb (Analyze_Object_Declaration): Swap a couple of tests in a condition so Following_Address_Clause is invoked only if need be. * exp_util.ads (Following_Address_Clause): Add small note. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217834 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/exp_util.ads | 4 ++++ gcc/ada/sem_ch3.adb | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e12e368833f..d2746e1511d 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2014-11-20 Eric Botcazou + + * sem_ch3.adb (Analyze_Object_Declaration): Swap a couple of + tests in a condition so Following_Address_Clause is invoked + only if need be. + * exp_util.ads (Following_Address_Clause): Add small note. + 2014-11-20 Pascal Obry * adaint.c (remove_handle): New local routine without a lock. diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index c0edb4b8e60..671b13a19b8 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -507,6 +507,10 @@ package Exp_Util is -- current declarative part to look for an address clause for the object -- being declared, and returns the clause if one is found, returns -- Empty otherwise. + -- + -- Note: this function can be costly and must be invoked with special care. + -- Possibly we could introduce a flag at parse time indicating the presence + -- of an address clause to speed this up??? procedure Force_Evaluation (Exp : Node_Id; diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index db348d7a617..28b44718406 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3648,8 +3648,13 @@ package body Sem_Ch3 is if Comes_From_Source (N) and then Expander_Active - and then Present (Following_Address_Clause (N)) and then Nkind (E) = N_Aggregate + + -- Note the importance of doing this the following test after the + -- N_Aggregate test to avoid inefficiencies from too many calls to + -- the function Following_Address_Clause which can be expensive. + + and then Present (Following_Address_Clause (N)) then Set_Etype (E, T); -- 2.11.4.GIT