[libcxx-commits] [PATCH] D133127: [libc++] Adds include graph test.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 1 10:23:38 PDT 2022


Mordante created this revision.
Herald added subscribers: arichardson, mgorny.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

This test generates the include graph of the Standard headers of libc++ in
a graphviz dot file.

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.

The test is executed in the CI and the generated dot file is available as
an artifact.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133127

Files:
  libcxx/test/configs/cmake-bridge.cfg.in
  libcxx/test/libcxx/trace_includes.sanitize.py
  libcxx/test/libcxx/trace_includes.sh.cpp
  libcxx/utils/ci/buildkite-pipeline.yml
  libcxx/utils/generate_header_tests.py
  libcxx/utils/graph_header_dependencies.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133127.457316.patch
Type: text/x-patch
Size: 34720 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220901/c0409c10/attachment-0001.bin>


More information about the libcxx-commits mailing list