aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2020-05-18 21:41:12 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-08 10:55:50 -0400
commit5fae483372b3e4da5b5e00b0ccf9557335e9e421 (patch)
tree836d6c2beceb09a674e211016aa36a4fc34c798f /gcc/ada/sem_util.adb
parentc0ffadd6eabef9a81d00c1f926aac929b0d94d92 (diff)
downloadgcc-5fae483372b3e4da5b5e00b0ccf9557335e9e421.zip
gcc-5fae483372b3e4da5b5e00b0ccf9557335e9e421.tar.gz
gcc-5fae483372b3e4da5b5e00b0ccf9557335e9e421.tar.bz2
[Ada] Remove excessive validity checks on in-parameters
gcc/ada/ * sem_util.ads, sem_util.adb (Safe_To_Capture_Value): Return True for in-parameters.
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 7751be7..96563cb 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -25718,23 +25718,25 @@ package body Sem_Util is
is
begin
-- The only entities for which we track constant values are variables
- -- which are not renamings, constants, out parameters, and in out
- -- parameters, so check if we have this case.
+ -- which are not renamings, constants and formal parameters, so check
+ -- if we have this case.
-- Note: it may seem odd to track constant values for constants, but in
-- fact this routine is used for other purposes than simply capturing
- -- the value. In particular, the setting of Known[_Non]_Null.
+ -- the value. In particular, the setting of Known[_Non]_Null and
+ -- Is_Known_Valid.
if (Ekind (Ent) = E_Variable and then No (Renamed_Object (Ent)))
- or else
- Ekind_In (Ent, E_Constant, E_Out_Parameter, E_In_Out_Parameter)
+ or else
+ Ekind (Ent) = E_Constant
+ or else
+ Is_Formal (Ent)
then
null;
- -- For conditionals, we also allow loop parameters and all formals,
- -- including in parameters.
+ -- For conditionals, we also allow loop parameters
- elsif Cond and then Ekind_In (Ent, E_Loop_Parameter, E_In_Parameter) then
+ elsif Cond and then Ekind (Ent) = E_Loop_Parameter then
null;
-- For all other cases, not just unsafe, but impossible to capture