singleuse: make git grep faster, add Apple nm support
- avoid regexp in grep to make it run faster. - add support for parsing Apple `nm` output: - skip leading underscore from function names. - pick object name from output. Closes #15070
This commit is contained in:
parent
f0f9e2c61f
commit
fcc89619d9
@ -152,7 +152,7 @@ my %api = (
|
|||||||
|
|
||||||
sub doublecheck {
|
sub doublecheck {
|
||||||
my ($f, $used) = @_;
|
my ($f, $used) = @_;
|
||||||
open(F, "git grep -le '$f\\W' -- lib ${unittests}packages|");
|
open(F, "git grep -Fwle '$f' -- lib ${unittests}packages|");
|
||||||
my @also;
|
my @also;
|
||||||
while(<F>) {
|
while(<F>) {
|
||||||
my $e = $_;
|
my $e = $_;
|
||||||
@ -180,13 +180,17 @@ while (<N>) {
|
|||||||
if($l =~ /^([0-9a-z_-]+)\.o:/) {
|
if($l =~ /^([0-9a-z_-]+)\.o:/) {
|
||||||
$file = $1;
|
$file = $1;
|
||||||
}
|
}
|
||||||
if($l =~ /^([0-9a-f]+) T (.*)/) {
|
# libcurl.a(unity_0_c.c.o):
|
||||||
|
elsif($l =~ /\(([0-9a-z_.-]+)\.o\):/) { # Apple nm
|
||||||
|
$file = $1;
|
||||||
|
}
|
||||||
|
if($l =~ /^([0-9a-f]+) T _?(.*)/) {
|
||||||
my ($name)=($2);
|
my ($name)=($2);
|
||||||
#print "Define $name in $file\n";
|
#print "Define $name in $file\n";
|
||||||
$file =~ s/^libcurl_la-//;
|
$file =~ s/^libcurl_la-//;
|
||||||
$exist{$name} = $file;
|
$exist{$name} = $file;
|
||||||
}
|
}
|
||||||
elsif($l =~ /^ U (.*)/) {
|
elsif($l =~ /^ U _?(.*)/) {
|
||||||
my ($name)=($1);
|
my ($name)=($1);
|
||||||
#print "Uses $name in $file\n";
|
#print "Uses $name in $file\n";
|
||||||
$uses{$name} .= "$file, ";
|
$uses{$name} .= "$file, ";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user