diff options
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 2e64e82..f003ef5 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -7929,13 +7929,21 @@ package body Sem_Util is -- Special cases - -- Blocks, loops, and return statements have artificial scopes + -- Blocks carry either a source or an internally-generated scope, + -- unless the block is a byproduct of exception handling. - when N_Block_Statement - | N_Loop_Statement - => + when N_Block_Statement => + if not Exception_Junk (Par) then + return Entity (Identifier (Par)); + end if; + + -- Loops carry an internally-generated scope + + when N_Loop_Statement => return Entity (Identifier (Par)); + -- Extended return statements carry an internally-generated scope + when N_Extended_Return_Statement => return Return_Statement_Entity (Par); @@ -19511,13 +19519,13 @@ package body Sem_Util is N := Next (Actual_Id); if Nkind (N) = N_Parameter_Association then + -- In case of a build-in-place call, the call will no longer be a -- call; it will have been rewritten. - if Nkind_In (Parent (Actual_Id), - N_Entry_Call_Statement, - N_Function_Call, - N_Procedure_Call_Statement) + if Nkind_In (Parent (Actual_Id), N_Entry_Call_Statement, + N_Function_Call, + N_Procedure_Call_Statement) then return First_Named_Actual (Parent (Actual_Id)); else @@ -23257,16 +23265,15 @@ package body Sem_Util is return "unknown subprogram"; end if; - if Nkind (Ent) = N_Defining_Program_Unit_Name then - - -- If the subprogram is a child unit, use its simple name to - -- start the construction of the fully qualified name. + -- If the subprogram is a child unit, use its simple name to start the + -- construction of the fully qualified name. + if Nkind (Ent) = N_Defining_Program_Unit_Name then Append_Entity_Name (Buf, Defining_Identifier (Ent)); - else Append_Entity_Name (Buf, Ent); end if; + return +Buf; end Subprogram_Name; |