Add symbol checking script to libc++ to help manage exported symbols.
Summary: Add symbol checking scripts for extracting a list of symbols from shared libraries and for comparing symbol lists for differences. Reviewers: mclow.lists, danalbert, EricWF Reviewed By: EricWF Subscribers: majnemer, emaste, cfe-commits Differential Revision: http://reviews.llvm.org/D4946 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@232855 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
32
utils/sym_check/sym_check/match.py
Normal file
32
utils/sym_check/sym_check/match.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- Python -*- vim: set syntax=python tabstop=4 expandtab cc=80:
|
||||
"""
|
||||
match - A set of functions for matching symbols in a list to a list of regexs
|
||||
"""
|
||||
|
||||
import re
|
||||
|
||||
|
||||
def find_and_report_matching(symbol_list, regex_list):
|
||||
report = ''
|
||||
found_count = 0
|
||||
for regex_str in regex_list:
|
||||
report += 'Matching regex "%s":\n' % regex_str
|
||||
matching_list = find_matching_symbols(symbol_list, regex_str)
|
||||
if not matching_list:
|
||||
report += ' No matches found\n\n'
|
||||
continue
|
||||
# else
|
||||
found_count += len(matching_list)
|
||||
for m in matching_list:
|
||||
report += ' MATCHES: %s\n' % m['name']
|
||||
report += '\n'
|
||||
return found_count, report
|
||||
|
||||
|
||||
def find_matching_symbols(symbol_list, regex_str):
|
||||
regex = re.compile(regex_str)
|
||||
matching_list = []
|
||||
for s in symbol_list:
|
||||
if regex.match(s['name']):
|
||||
matching_list += [s]
|
||||
return matching_list
|
||||
Reference in New Issue
Block a user