aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-05-11 13:01:35 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-06 14:46:57 +0000
commitddbe7338f1ea50db4d39a925c6c530052ed288a4 (patch)
tree67e67046e8608ff7214daf53b3e608e8835b5887
parentca290f108a62e041ea3ca7c981d8225f34cefdbd (diff)
downloadgcc-ddbe7338f1ea50db4d39a925c6c530052ed288a4.zip
gcc-ddbe7338f1ea50db4d39a925c6c530052ed288a4.tar.gz
gcc-ddbe7338f1ea50db4d39a925c6c530052ed288a4.tar.bz2
[Ada] Simplify returning from Enclosing_Comp_Unit_Node
gcc/ada/ * sem_util.adb (Enclosing_Comp_Unit_Node): When the loop exits the Current_Node is either an N_Compilation_Unit node or Empty, so simply return it without redundant checks.
-rw-r--r--gcc/ada/sem_util.adb6
1 files changed, 1 insertions, 5 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index cfb3293..9d54309 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -8037,11 +8037,7 @@ package body Sem_Util is
Current_Node := Parent (Current_Node);
end loop;
- if Nkind (Current_Node) /= N_Compilation_Unit then
- return Empty;
- else
- return Current_Node;
- end if;
+ return Current_Node;
end Enclosing_Comp_Unit_Node;
--------------------------