[PATCH] D119823: [Modules] Add module structure output to -module-file-info.

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 15 02:30:33 PST 2022


iains created this revision.
iains added reviewers: dblaikie, aprantl, urnathan, ChuanqiXu.
iains published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

It is useful to be able to visualise the C++20 modules content of a PCM file
both for inspection and for testing.  In particular, when adding more module
types to support C++20 Partitions and Header Units, we would like to be able
to confirm that the output PCM has the intended structure.

The existing scheme for dumping data is restricted to the content of the AST
file control block, which does not include structural data beyond imports.

The change here makes use of the AST unit that is set up by BeginSourceFile
to query for the information on the primary and sub-modules.  We can then
inspect each of these in turn, accounting for Global, Private, Imported and
Exported modules/fragments and then showing the sub-stucture of the main
module(s).

The disadvantage of this mechanism is that it has no easy method to control
the granularity of the output.  Perhaps more detailed inspection would be
better handled by a stand-alone module inspection tool.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119823

Files:
  clang/lib/Frontend/FrontendActions.cpp
  clang/test/Modules/module-file-info-cxx20.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119823.408781.patch
Type: text/x-patch
Size: 7073 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220215/470e8b6c/attachment.bin>


More information about the cfe-commits mailing list