[all-commits] [llvm/llvm-project] 5a74e6: [Modules] Add module structure output to -module-f...

iains via All-commits all-commits at lists.llvm.org
Wed Feb 23 02:27:04 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5a74e6a21c9520e0619c98a66815fc8b5117e321
      https://github.com/llvm/llvm-project/commit/5a74e6a21c9520e0619c98a66815fc8b5117e321
  Author: Iain Sandoe <iain at sandoe.co.uk>
  Date:   2022-02-23 (Wed, 23 Feb 2022)

  Changed paths:
    M clang/lib/Frontend/FrontendActions.cpp
    A clang/test/Modules/cxx20-module-file-info.cpp

  Log Message:
  -----------
  [Modules] Add module structure output to -module-file-info.

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.

Differential Revision: https://reviews.llvm.org/D119823




More information about the All-commits mailing list