@@ -666,9 +666,7 @@ sub get
666
666
if !defined ($type );
667
667
668
668
my $hash = $self -> [$type ]-> [DATA ];
669
- if ($key eq " total" ) {
670
- return $hash -> {found };
671
- } elsif ($key eq " missed" ) {
669
+ if ($key eq " missed" ) {
672
670
my $missed = 0;
673
671
foreach my $k (' UBC' , ' UNC' , ' UIC' , ' LBC' ) {
674
672
$missed += $hash -> {$k }
@@ -766,8 +764,7 @@ sub owner_tlaCount
766
764
return $hash -> {$tla }
767
765
if (exists ($hash -> {$tla }));
768
766
769
- if ($tla eq " total" ||
770
- $tla eq " found" ) {
767
+ if ($tla eq " found" ) {
771
768
my $total = 0;
772
769
foreach my $k (keys (%$hash )) {
773
770
# count only code that can be hit (ie., not excluded)
@@ -943,15 +940,12 @@ sub lineCovCount
943
940
944
941
$delta = 0 unless defined ($delta );
945
942
946
- if ($key eq ' total' ) {
947
- $key = ' found' ;
948
- } elsif ($key eq ' missed' ) {
943
+ if ($key eq ' missed' ) {
949
944
my $found = $self -> lineCovCount(' found' , $group , $age );
950
945
my $hit = $self -> lineCovCount(' hit' , $group , $age );
951
946
return $found - $hit ;
952
947
}
953
948
954
- $key = ' found' if $key eq ' total' ;
955
949
if ($group eq " age" ) {
956
950
my $a = $self -> [LINE_DATA]-> [AGE];
957
951
my $bin = SummaryInfo::findAgeBin($age );
@@ -977,9 +971,7 @@ sub branchCovCount
977
971
978
972
$delta = 0 unless defined ($delta );
979
973
980
- if ($key eq ' total' ) {
981
- $key = ' found' ;
982
- } elsif ($key eq ' missed' ) {
974
+ if ($key eq ' missed' ) {
983
975
my $found = $self -> branchCovCount(' found' , $group , $age );
984
976
my $hit = $self -> branchCovCount(' hit' , $group , $age );
985
977
return $found - $hit ;
@@ -1013,9 +1005,7 @@ sub functionCovCount
1013
1005
1014
1006
$delta = 0 unless defined ($delta );
1015
1007
1016
- if ($key eq ' total' ) {
1017
- $key = ' found' ;
1018
- } elsif ($key eq ' missed' ) {
1008
+ if ($key eq ' missed' ) {
1019
1009
my $found = $self -> functionCovCount(' found' , $group , $age );
1020
1010
my $hit = $self -> functionCovCount(' hit' , $group , $age );
1021
1011
return $found - $hit ;
@@ -1135,6 +1125,18 @@ sub b_hit
1135
1125
return $b -> {hit };
1136
1126
}
1137
1127
1128
+ sub selected
1129
+ {
1130
+ my $rtn ;
1131
+ eval { $rtn = $selectCallback -> select(@_ ); };
1132
+ if ($@ ) {
1133
+ $rtn = 1; # return everything
1134
+ lcovutil::ignorable_error($lcovutil::ERROR_CALLBACK ,
1135
+ " select(..) failed: $@ " );
1136
+ }
1137
+ return $rtn ;
1138
+ }
1139
+
1138
1140
sub checkCoverageCriteria
1139
1141
{
1140
1142
my $self = shift ;
@@ -2076,7 +2078,7 @@ use constant {
2076
2078
LINE_BASELINE => 1,
2077
2079
LINE_CURRENT => 2,
2078
2080
2079
- # data elements for branchfunction data
2081
+ # data elements for branch/function data
2080
2082
DATA_BASELINE => 0,
2081
2083
DATA_CURRENT => 1,
2082
2084
DATA_DIFFERENTIAL => 2,
@@ -2099,6 +2101,46 @@ sub new
2099
2101
return $self ;
2100
2102
}
2101
2103
2104
+ sub to_list
2105
+ {
2106
+ # used by script-leve 'select' callback
2107
+ my $self = shift ;
2108
+
2109
+ my @rtn = ($self -> [TYPE],
2110
+ [$self -> tla(),
2111
+ $self -> in_curr() ? $self -> curr_count() : undef ,
2112
+ $self -> in_base() ? $self -> base_count() : undef
2113
+ ]);
2114
+ my $branch = $self -> differential_branch();
2115
+ if (defined ($branch )) {
2116
+ my @data ;
2117
+ push (@rtn , \@data );
2118
+ foreach my $block ($branch -> blocks()) {
2119
+ my $br = $branch -> getBlock($block );
2120
+ my @b ;
2121
+ push (@data , \@b );
2122
+ foreach my $b (@$br ) {
2123
+ my ($br , $tla , $d ) = @$b ;
2124
+ my ($base_count , $curr_count ) = @$d ;
2125
+ push (@b , [$tla , $curr_count , $base_count ]);
2126
+ }
2127
+ }
2128
+ } else {
2129
+ $branch = $self -> current_branch();
2130
+ if (defined ($branch )) {
2131
+ my @data ;
2132
+ push (@rtn , \@data );
2133
+ foreach my $block ($branch -> blocks()) {
2134
+ my $br = $branch -> getBlock($block );
2135
+ push (@data , $br -> count());
2136
+ }
2137
+ } else {
2138
+ push (@rtn , undef );
2139
+ }
2140
+ }
2141
+ return \@rtn ;
2142
+ }
2143
+
2102
2144
sub tla
2103
2145
{
2104
2146
my ($self , $tla ) = @_ ;
@@ -3648,8 +3690,8 @@ sub _computeContextBefore
3648
3690
my $lineData = $data -> {$l } if exists ($data -> {$l });
3649
3691
my $annotateData = $annotate -> line($l );
3650
3692
last
3651
- unless $selectCallback -> select ($lineData , $annotateData ,
3652
- $self -> [ANNOTATE_OBJ]-> path(), $l );
3693
+ unless SummaryInfo::selected ($lineData , $annotateData ,
3694
+ $self -> [ANNOTATE_OBJ]-> path(), $l );
3653
3695
++$count ;
3654
3696
}
3655
3697
# region of interest is the (possibly empty) contigous region we found
@@ -3676,7 +3718,7 @@ sub interesting
3676
3718
my $lineData = $data -> {$l } if exists ($data -> {$l });
3677
3719
my $annotateData = $annotate -> line($l );
3678
3720
last
3679
- if !$selectCallback -> select ($lineData , $annotateData ,
3721
+ if !SummaryInfo::selected ($lineData , $annotateData ,
3680
3722
$self -> [ANNOTATE_OBJ]-> path(), $l );
3681
3723
++$count ;
3682
3724
}
@@ -3728,6 +3770,17 @@ sub new
3728
3770
return $self ;
3729
3771
}
3730
3772
3773
+ sub to_list
3774
+ {
3775
+ # used by 'select' callback - if not a package
3776
+ my $self = shift ;
3777
+ if ($# $self >= OWNER) {
3778
+ my @rtn = @{$self }[OWNER, FUNCTION_TLA];
3779
+ return \@rtn ;
3780
+ }
3781
+ return undef ;
3782
+ }
3783
+
3731
3784
sub owner
3732
3785
{
3733
3786
my $self = shift ;
@@ -3886,8 +3939,8 @@ sub new
3886
3939
my $annotateData = $self -> line($line )
3887
3940
unless grep (/ $tla / , (' DUB' , ' DCB' ));
3888
3941
# callback arguments are (LineData, SourceLine)
3889
- if ($selectCallback -> select ($lne , $annotateData ,
3890
- $self -> path(), $line )) {
3942
+ if (SummaryInfo::selected ($lne , $annotateData ,
3943
+ $self -> path(), $line )) {
3891
3944
push (@lineArray , $line );
3892
3945
}
3893
3946
}
@@ -3949,7 +4002,7 @@ sub _countBranchTlaData
3949
4002
my ($src_age , $developer , $srcLine );
3950
4003
my $lineTla = $lineData -> tla();
3951
4004
if (@SourceFile::annotateScript &&
3952
- ' D ' ne substr ( $lineTla , 0, 1 )) {
4005
+ ! grep ( / ^ $lineTla $ / , ( ' DUB ' , ' DCB ' ) )) {
3953
4006
# deleted lines don't have owner data...
3954
4007
$srcLine = $self -> line($line );
3955
4008
if (!defined ($srcLine )) {
@@ -4190,7 +4243,7 @@ sub _countFunctionTlaData
4190
4243
# return;
4191
4244
}
4192
4245
4193
- if (' D ' ne substr ( $mergedTla , 0, 1 )) {
4246
+ if (! grep ( / ^ $mergedTla $ / , ( ' DUB ' , ' DCB ' ) )) {
4194
4247
# deleted lines don't have owner data...
4195
4248
$srcLine = $self -> line($line );
4196
4249
# info might not be available, if no annotations
@@ -5949,7 +6002,7 @@ if ($no_sourceview && defined($frames)) {
5949
6002
if ($no_prefix && @dir_prefix ) {
5950
6003
lcovutil::ignorable_warning($lcovutil::ERROR_USAGE ,
5951
6004
" option --prefix disabled because --no-prefix was ignored" );
5952
- @dir_prefix = undef ;
6005
+ @dir_prefix = () ;
5953
6006
}
5954
6007
5955
6008
@fileview_sortlist = ($SORT_FILE );
@@ -8606,12 +8659,11 @@ END_OF_HTML
8606
8659
if (!$main::use_legacyLabels &&
8607
8660
grep (/ ^$key $ / , (" UNC" , " LBC" , " UIC" )));
8608
8661
8609
- # want to look in file details to build link to first
8610
- # line...
8662
+ # look in file details to build link to first line
8611
8663
if (!$main::no_sourceview &&
8612
- defined ($tableHref ) &&
8613
- defined ($fileDetails ) &&
8614
- ' D ' ne substr ( $key , 0, 1 ) &&
8664
+ defined ($tableHref ) &&
8665
+ defined ($fileDetails ) &&
8666
+ ! grep ( / ^ $key $ / , ( ' DUB ' , ' DCB ' ) ) &&
8615
8667
grep (/ ^$key $ / , @SummaryInfo::tlaPriorityOrder )) {
8616
8668
my $line ;
8617
8669
my $label =
@@ -9786,8 +9838,7 @@ sub buildDateSummaryTable($$$$$$$$$)
9786
9838
} elsif (!$main::no_sourceview &&
9787
9839
defined ($fileDetail ) &&
9788
9840
defined ($nextLocationCallback ) &&
9789
- $tla ne ' DCB' &&
9790
- $tla ne ' DUB' ) {
9841
+ !grep (/ ^$tla $ / , (' DUB' , ' DCB' ))) {
9791
9842
# no link for deleted lines (DUB, DCB) because there
9792
9843
# is no TLA for those categories at the location in
9793
9844
# the 'current' sourceview. That location is just a
@@ -11481,7 +11532,8 @@ END_OF_HTML
11481
11532
11482
11533
my $funcEntry = $differentialMap -> {$func };
11483
11534
my ($count , $tla ) = @{$funcEntry -> hit()};
11484
- next if ' D' eq substr ($tla , 0, 1); # don't display deleted functions
11535
+ next
11536
+ if grep (/ ^$tla $ / , (' DUB' , ' DCB' )); # don't display deleted functions
11485
11537
my $startline = $funcEntry -> line() - $func_offset ;
11486
11538
my $name = $func ;
11487
11539
my $countstyle ;
@@ -11570,8 +11622,7 @@ END_OF_HTML
11570
11622
foreach my $alias (@aliasList ) {
11571
11623
my ($hit , $tla ) = @{$aliases -> {$alias }};
11572
11624
# don't display deleted functions
11573
- next
11574
- if ' D' eq substr ($tla , 0, 1);
11625
+ next if grep (/ ^$tla $ / , (' DUB' , ' DCB' )); #
11575
11626
my $style = " coverFnAlias" . ($hit == 0 ? " Lo" : " Hi" );
11576
11627
$tlaRow = " " ;
11577
11628
if ($showTlas ) {
0 commit comments