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.
belongs in a later patch?