From: Arthur O'Dwyer Date: Sat, 5 Jun 2021 16:47:30 +0000 (-0400) Subject: [libc++] graph_header_deps.py: Update the computing of "root" (public) headers. X-Git-Tag: llvmorg-14-init~4771 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11e0882e8dde1ab7eeda0ccef620d81b12f30086;p=platform%2Fupstream%2Fllvm.git [libc++] graph_header_deps.py: Update the computing of "root" (public) headers. The "root nodes" of the graph are displayed in bold. My intent here was to bold just the public-API headers, e.g. and and , but not helper headers such as <__functional_base> and <__iterator/next.h>. However, the recent mass helper-header-ification has exposed defects in this logic: all the new helpers were ending up bolded! Fix this. Also, add <__undef_macros> to the list of headers we don't display by default (like <__config>); it's not interesting to see those edges. Also, add a sample `dot` command line to the `--help` text. --- diff --git a/libcxx/utils/graph_header_deps.py b/libcxx/utils/graph_header_deps.py index 1cf0015..bccd22c 100755 --- a/libcxx/utils/graph_header_deps.py +++ b/libcxx/utils/graph_header_deps.py @@ -14,7 +14,7 @@ import sys def is_config_header(h): - return os.path.basename(h) in ['__config', '__libcpp_version'] + return os.path.basename(h) in ['__config', '__libcpp_version', '__undef_macros'] def is_experimental_header(h): @@ -37,7 +37,7 @@ def list_all_roots_under(root): result = [] for root, _, files in os.walk(root): for fname in files: - if '__support' in root: + if os.path.basename(root).startswith('__') or fname.startswith('__'): pass elif ('.' in fname and not fname.endswith('.h')): pass @@ -155,11 +155,15 @@ def get_graphviz(graph, options): if __name__ == '__main__': - parser = argparse.ArgumentParser(description='Produce a dependency graph of libc++ headers, in GraphViz dot format.') + parser = argparse.ArgumentParser( + description='Produce a dependency graph of libc++ headers, in GraphViz dot format.\n' + + 'For example, ./graph_header_deps.py | dot -Tpng > graph.png', + formatter_class=argparse.RawDescriptionHelpFormatter, + ) parser.add_argument('--root', default=None, metavar='FILE', help='File or directory to be the root of the dependency graph') parser.add_argument('-I', dest='search_dirs', default=[], action='append', metavar='DIR', help='Path(s) to search for local includes') parser.add_argument('--show-transitive-edges', action='store_true', help='Show edges to headers that are transitively included anyway') - parser.add_argument('--show-config-headers', action='store_true', help='Show headers named __config') + parser.add_argument('--show-config-headers', action='store_true', help='Show universally included headers, such as __config') parser.add_argument('--show-experimental-headers', action='store_true', help='Show headers in the experimental/ and ext/ directories') parser.add_argument('--show-support-headers', action='store_true', help='Show headers in the __support/ directory') parser.add_argument('--show-individual-line-counts', action='store_true', help='Include an individual line count in each node')