aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2024-09-27 16:56:52 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-11-04 16:57:55 +0100
commit625c4ec2b3d3a59138a0a00178307ecba916aeea (patch)
tree2111105ddbecae595c51579846a267ff3c683272 /gcc
parent39e9ebac2f2500652c14597fe6a113d5002abf2f (diff)
downloadgcc-625c4ec2b3d3a59138a0a00178307ecba916aeea.zip
gcc-625c4ec2b3d3a59138a0a00178307ecba916aeea.tar.gz
gcc-625c4ec2b3d3a59138a0a00178307ecba916aeea.tar.bz2
ada: Assignment local variable only when it is used
Code cleanup; semantics is unaffected. gcc/ada/ChangeLog: * sem_res.adb (In_Decl): Rename and move local variable where it is used.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_res.adb16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 4c92b56..d28e724 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -1637,11 +1637,9 @@ package body Sem_Res is
function In_Decl return Boolean is
Decl_Node : constant Node_Id := Parent (E);
- N2 : Node_Id;
+ Context : Node_Id;
begin
- N2 := N;
-
if Etype (E) = Any_Type then
return True;
@@ -1649,13 +1647,15 @@ package body Sem_Res is
return False;
else
- while Present (N2)
- and then Nkind (N2) /= N_Compilation_Unit
+ Context := N;
+
+ while Present (Context)
+ and then Nkind (Context) /= N_Compilation_Unit
loop
- if N2 = Decl_Node then
+ if Context = Decl_Node then
return True;
else
- N2 := Parent (N2);
+ Context := Parent (Context);
end if;
end loop;
@@ -1912,7 +1912,7 @@ package body Sem_Res is
end if;
end if;
- Set_Chars (Op_Node, Op_Name);
+ Set_Chars (Op_Node, Op_Name);
if not Is_Private_Type (Etype (N)) then
Set_Etype (Op_Node, Base_Type (Etype (N)));