This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Rewrites graph_header_deps.py.
ClosedPublic

Authored by Mordante on Sep 19 2022, 8:40 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rGddb6c2b301f6: [libc++] Rewrites graph_header_deps.py.
Summary

The new version is a lot simpler and has less option which were not
used. This uses the CSV files as generated by D133127 as input data.

The current Python script has more features but uses a simple "grep"
making the output less accurate:

  • Conditionally included header are always included. This is an issue since part of our includes are unneeded transitive includes. Based on the language version they may be omitted. The script however always includes them.
  • Includes in comments are processed as-if they are includes. This is an issue when comments explain how certain data is generated; of course there are digraphs which the script omits.

This implementation uses Clang's --trace-includes to generate the includes
per header. This means the input of the generation script always has the
real list of includes.

Libc++ is moving from large monolithic Standard headers to more fine
grained headers. For example, algorithm includes every header in
__algorithm. Adding all these detail headers in the graph makes the
output unusable. Instead it only shows the Standard headers. The
transitive includes of the detail headers are parsed and "attributed" to
the Standard header including them. This gives an accurate include graph
without the unneeded clutter. Note that this graph is still big.

This changes fixes the cyclic dependency issue with the previous version
of the tool so the markers and its documentation is removed.

Since the input has no cycles the CI test is removed.

Diff Detail

Event Timeline

Mordante created this revision.Sep 19 2022, 8:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 8:40 AM
Herald added a subscriber: arichardson. · View Herald Transcript
Mordante requested review of this revision.Sep 19 2022, 8:40 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 8:40 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante edited the summary of this revision. (Show Details)Sep 19 2022, 8:47 AM
ldionne accepted this revision.Sep 20 2022, 9:49 AM
ldionne added a subscriber: ldionne.
ldionne added inline comments.
libcxx/utils/graph_header_deps.py
14

Let's provide a simple argparse instead.

This revision is now accepted and ready to land.Sep 20 2022, 9:49 AM
Mordante updated this revision to Diff 462716.Sep 25 2022, 4:23 AM

Rebased and addresses review comments.

This revision was automatically updated to reflect the committed changes.