[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / llvm / utils / findsym.pl
blobf03e1231c25647f36db4e8aa858a71c85b3236b9
1 #!/usr/bin/env perl
3 # Program: findsym.pl
5 # Synopsis: Generate a list of the libraries in which a symbol is defined or
6 # referenced.
8 # Syntax: findsym.pl <directory_with_libraries_in_it> <symbol>
11 use warnings;
13 # Give first option a name.
14 my $Directory = $ARGV[0];
15 my $Symbol = $ARGV[1];
17 # Open the directory and read its contents, sorting by name and differentiating
18 # by whether its a library (.a) or an object file (.o)
19 opendir DIR,$Directory;
20 my @files = readdir DIR;
21 closedir DIR;
22 @objects = grep(/l?i?b?LLVM.*\.[oa]$/,sort(@files));
24 # Gather definitions from the libraries
25 foreach $lib (@objects) {
26 my $head = 0;
27 open SYMS,
28 "nm $Directory/$lib | grep '$Symbol' | sort --key=3 | uniq |";
29 while (<SYMS>) {
30 if (!$head) { print "$lib:\n"; $head = 1; }
31 chomp($_);
32 print " $_\n";
34 close SYMS;