aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-03-30 12:59:23 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-18 08:40:58 +0000
commit700cd7d6733e62e5ad8212cb6c51866679173b41 (patch)
treed07cc253bdcf1ab03a7da81b5ba0afa22131aa32 /gcc
parent1ef3f0911cf08f1b80c845ee7eee07ecf43b9c8a (diff)
downloadgcc-700cd7d6733e62e5ad8212cb6c51866679173b41.zip
gcc-700cd7d6733e62e5ad8212cb6c51866679173b41.tar.gz
gcc-700cd7d6733e62e5ad8212cb6c51866679173b41.tar.bz2
[Ada] Small performance tweak in recent change
This avoids a useless walk of the prefix chain in instances. gcc/ada/ * sem_ch8.adb (Analyze_Subprogram_Renaming): Move final test on In_Instance to outer condition.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch8.adb3
1 files changed, 1 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 1cf3411..5945bfd 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -3975,7 +3975,7 @@ package body Sem_Ch8 is
-- normally illegal renamings can be constructed when expanding
-- instantiations.
- elsif Nkind (Nam) = N_Expanded_Name then
+ elsif Nkind (Nam) = N_Expanded_Name and then not In_Instance then
declare
function Ult_Expanded_Prefix (N : Node_Id) return Node_Id is
(if Nkind (N) /= N_Expanded_Name
@@ -3985,7 +3985,6 @@ package body Sem_Ch8 is
begin
if Chars (Entity (Ult_Expanded_Prefix (Nam))) = Chars (New_S)
- and then not In_Instance
then
Error_Msg_Sloc := Sloc (N);
Error_Msg_NE