Skip to content

Commit 6897c90

Browse files
committed
Pass down the value of Do_Not_Instrument to recursive calls
To avoid picking the default value for Do_Not_Instrument, we should pass down its actual value to recursive calls. We have very little testing for not instrumented source code constructs, so this does not originate from a regression / unvalid instrumented code but it is safer.
1 parent 2ff0f8f commit 6897c90

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

tools/gnatcov/instrument-ada_unit.adb

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5932,7 +5932,7 @@ package body Instrument.Ada_Unit is
59325932
end if;
59335933

59345934
else
5935-
Process_Decisions (UIC, N, 'X');
5935+
Process_Decisions (UIC, N, 'X', Do_Not_Instrument);
59365936
end if;
59375937
end Find_Nested_Decisions;
59385938

@@ -6027,33 +6027,48 @@ package body Instrument.Ada_Unit is
60276027
Alt : constant Elsif_Expr_Part_List := IEN.F_Alternatives;
60286028

60296029
begin
6030-
Process_Decisions (UIC, IEN.F_Cond_Expr, 'I');
6031-
Process_Decisions (UIC, IEN.F_Then_Expr, 'X');
6030+
Process_Decisions
6031+
(UIC, IEN.F_Cond_Expr, 'I', Do_Not_Instrument);
6032+
Process_Decisions
6033+
(UIC, IEN.F_Then_Expr, 'X', Do_Not_Instrument);
60326034

60336035
for J in 1 .. Alt.Children_Count loop
60346036
declare
60356037
EIN : constant Elsif_Expr_Part :=
60366038
Alt.Child (J).As_Elsif_Expr_Part;
60376039
begin
6038-
Process_Decisions (UIC, EIN.F_Cond_Expr, 'I');
6039-
Process_Decisions (UIC, EIN.F_Then_Expr, 'X');
6040+
Process_Decisions
6041+
(UIC, EIN.F_Cond_Expr, 'I', Do_Not_Instrument);
6042+
Process_Decisions
6043+
(UIC, EIN.F_Then_Expr, 'X', Do_Not_Instrument);
60406044
end;
60416045
end loop;
60426046

6043-
Process_Decisions (UIC, IEN.F_Else_Expr, 'X');
6047+
Process_Decisions
6048+
(UIC, IEN.F_Else_Expr, 'X', Do_Not_Instrument);
60446049
return Over;
60456050
end;
60466051

60476052
when Ada_Quantified_Expr =>
60486053
Process_Decisions
6049-
(UIC, N.As_Quantified_Expr.F_Loop_Spec, 'X');
6050-
Process_Decisions (UIC, N.As_Quantified_Expr.F_Expr, 'W');
6054+
(UIC,
6055+
N.As_Quantified_Expr.F_Loop_Spec,
6056+
'X',
6057+
Do_Not_Instrument);
6058+
Process_Decisions
6059+
(UIC, N.As_Quantified_Expr.F_Expr, 'W', Do_Not_Instrument);
60516060
return Over;
60526061

60536062
when Ada_For_Loop_Spec =>
6054-
Process_Decisions (UIC, N.As_For_Loop_Spec.F_Var_Decl, 'X');
6055-
Process_Decisions (UIC, N.As_For_Loop_Spec.F_Iter_Expr, 'X');
6056-
Process_Decisions (UIC, N.As_For_Loop_Spec.F_Iter_Filter, 'W');
6063+
Process_Decisions
6064+
(UIC, N.As_For_Loop_Spec.F_Var_Decl, 'X', Do_Not_Instrument);
6065+
Process_Decisions
6066+
(UIC, N.As_For_Loop_Spec.F_Iter_Expr, 'X', Do_Not_Instrument);
6067+
Process_Decisions
6068+
(UIC,
6069+
N.As_For_Loop_Spec.F_Iter_Filter,
6070+
'W',
6071+
Do_Not_Instrument);
60576072
return Over;
60586073

60596074
-- Aspects for which we don't want to instrument the decision
@@ -6082,7 +6097,8 @@ package body Instrument.Ada_Unit is
60826097
-- them, but do process the final expression.
60836098

60846099
when Ada_Decl_Expr =>
6085-
Process_Decisions (UIC, N.As_Decl_Expr.F_Expr, 'X');
6100+
Process_Decisions
6101+
(UIC, N.As_Decl_Expr.F_Expr, 'X', Do_Not_Instrument);
60866102
return Over;
60876103

60886104
-- All other cases, continue scan

0 commit comments

Comments
 (0)