[all-commits] [llvm/llvm-project] 0afc60: [clang-doc] Clean up *Info constructors.

Paul Kirth via All-commits all-commits at lists.llvm.org
Tue Sep 27 16:32:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0afc60858e1183344e0786eaa3b123f9faed185e
      https://github.com/llvm/llvm-project/commit/0afc60858e1183344e0786eaa3b123f9faed185e
  Author: Brett Wilson <brettw at google.com>
  Date:   2022-09-27 (Tue, 27 Sep 2022)

  Changed paths:
    M clang-tools-extra/clang-doc/BitcodeReader.cpp
    M clang-tools-extra/clang-doc/BitcodeWriter.cpp
    M clang-tools-extra/clang-doc/BitcodeWriter.h
    M clang-tools-extra/clang-doc/HTMLGenerator.cpp
    M clang-tools-extra/clang-doc/Representation.cpp
    M clang-tools-extra/clang-doc/Representation.h
    M clang-tools-extra/clang-doc/Serialize.cpp
    M clang-tools-extra/clang-doc/YAMLGenerator.cpp
    M clang-tools-extra/unittests/clang-doc/BitcodeTest.cpp
    M clang-tools-extra/unittests/clang-doc/GeneratorTest.cpp
    M clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp
    M clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp
    M clang-tools-extra/unittests/clang-doc/MergeTest.cpp
    M clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
    M clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp

  Log Message:
  -----------
  [clang-doc] Clean up *Info constructors.

The *Info object (for the copy of the AST") constructors had many duplicated variants. Many of the variants seemed to be in an attempt to avoid default arguments. But default arguments are not prohibited and using them allows most of the variants to be removed which improves readability.

Remove the IsInGlobalNamespace flag on a Reference. This is set when the path is empty, and only read once in the HTML generator with the identical condition. The constructor cleanup exposed a problem where this was set to false when the constructor with no path was used, but true when the path was set to empty.

There should be no observable change with the exception that IsInGlobalNamespace is no longer emitted in YAML.

Reviewed By: paulkirth, haowei

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




More information about the All-commits mailing list