[libcxx-commits] [libcxx] 11e0882 - [libc++] graph_header_deps.py: Update the computing of "root" (public) headers.
Arthur O'Dwyer via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jun 5 09:51:51 PDT 2021
Author: Arthur O'Dwyer
Date: 2021-06-05T12:47:30-04:00
New Revision: 11e0882e8dde1ab7eeda0ccef620d81b12f30086
URL: https://github.com/llvm/llvm-project/commit/11e0882e8dde1ab7eeda0ccef620d81b12f30086
DIFF: https://github.com/llvm/llvm-project/commit/11e0882e8dde1ab7eeda0ccef620d81b12f30086.diff
LOG: [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. <vector> and
<experimental/coroutine> and <stdlib.h>, 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.
Added:
Modified:
libcxx/utils/graph_header_deps.py
Removed:
################################################################################
diff --git a/libcxx/utils/graph_header_deps.py b/libcxx/utils/graph_header_deps.py
index 1cf001564bc1b..bccd22c61d801 100755
--- a/libcxx/utils/graph_header_deps.py
+++ b/libcxx/utils/graph_header_deps.py
@@ -14,7 +14,7 @@
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_decorators(fname, entry):
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')
More information about the libcxx-commits
mailing list