[clang-doc] Add support for explicitly typed enums
authorBrett Wilson <brettw@google.com>
Mon, 19 Sep 2022 21:52:24 +0000 (21:52 +0000)
committerPaul Kirth <paulkirth@google.com>
Mon, 19 Sep 2022 21:54:41 +0000 (21:54 +0000)
commiteaa7b324d5a272dc640cfc4162b746ac5341ccbd
tree735794e5a4797eafbd136e92de5c93315c8ab720
parentd518fc28b6dce9c2ab5db8575d401e7eaa203612
[clang-doc] Add support for explicitly typed enums

Add support for explicitly typed enums:
  enum Foo : unsigned { ... };
to the internal representation and to the YAML output.

Add support for getting the value of an enum constant, as well as accessing the original expression that produced it. This changes the YAML output of enums from an array of strings for the enum members to an array of dictionaries. These dictionaries now report the name, value, and original expression.

The markdown and HTML outputs are unchanged, they still output the name from the new enhanced internal schema.

Reviewed By: paulkirth

Differential Revision: https://reviews.llvm.org/D134055
clang-tools-extra/clang-doc/BitcodeReader.cpp
clang-tools-extra/clang-doc/BitcodeWriter.cpp
clang-tools-extra/clang-doc/BitcodeWriter.h
clang-tools-extra/clang-doc/HTMLGenerator.cpp
clang-tools-extra/clang-doc/MDGenerator.cpp
clang-tools-extra/clang-doc/Representation.h
clang-tools-extra/clang-doc/Serialize.cpp
clang-tools-extra/clang-doc/YAMLGenerator.cpp
clang-tools-extra/unittests/clang-doc/SerializeTest.cpp
clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp