[all-commits] [llvm/llvm-project] 7b8c7e: [clang-doc] Move file layout to the generators.

Brett Wilson via All-commits all-commits at lists.llvm.org
Tue Nov 29 14:41:16 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7b8c7e02122a2ea392b371e3e39b405bc98146de
      https://github.com/llvm/llvm-project/commit/7b8c7e02122a2ea392b371e3e39b405bc98146de
  Author: Brett Wilson <brettw at gmail.com>
  Date:   2022-11-29 (Tue, 29 Nov 2022)

  Changed paths:
    M clang-tools-extra/clang-doc/Generators.h
    M clang-tools-extra/clang-doc/HTMLGenerator.cpp
    M clang-tools-extra/clang-doc/MDGenerator.cpp
    M clang-tools-extra/clang-doc/YAMLGenerator.cpp
    M clang-tools-extra/clang-doc/tool/ClangDocMain.cpp
    M clang-tools-extra/test/clang-doc/single-file-public.cpp
    M clang-tools-extra/test/clang-doc/single-file.cpp

  Log Message:
  -----------
  [clang-doc] Move file layout to the generators.

Previously file naming and directory layout was handled on a per Info
object basis by ClangDocMain and the generators blindly wrote to the
files given. This means all generators must use the same file layout and
caused problems where multiple objects mapped to the same file. The
object collision problem happens most easily with template
specializations because the template parameters are not part of the
"name".

This patch moves the responsibility for output file organization to the
generators. Currently HTML and MD use the same structure as before. But
they now collect all objects that map to a given file and combine them,
avoiding the corruption problems.

Converts the YAML generator to naming files based on USR in one
directory. This is easier for downstream tools to manage and avoids the
naming problems with template specializations. Since this change
requires backward-incompatible output changes to referenced files anyway
(since each one is now an array), this is a good time to introduce this
change.

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




More information about the All-commits mailing list