12 Commits

Author SHA1 Message Date
Erick Velez
a68e4470c1
[clang-doc] serialize friends (#146165)
Parse friends into a new FriendInfo and serialize them in JSON. We keep track of the friend declaration's template and function information if applicable.
2025-06-30 12:43:52 -07:00
Erick Velez
b8ea65025d
[clang-doc] document global variables (#145070)
Visit and map VarDecls to document variables declared in namespace scope.
2025-06-24 11:36:31 -07:00
Erick Velez
8050a6e073
[clang-doc] add support for concepts (#144430)
Add support for documenting concepts. This handles concepts and constraints on function and class templates.

Atomic constraints are not considered yet. We don't order constraints based on their conjunctive or disjunctive properties.
2025-06-20 17:39:31 -07:00
Kazu Hirata
6edfc6ce6c
[clang-tools-extra] Use llvm::any_of (NFC) (#143281) 2025-06-08 01:34:24 -07:00
Samarth Narang
d5704097fc
Refactor clang doc comment structure (#142273)
This patch refactors CommentKind handling in clang-doc by introducing a
strongly typed enum class for better type safety and clarity. It updates
all relevant places, including YAML traits and serialization, to work
with the new enum. Additionally, it enhances the Mustache-based HTML
generation by fully supporting all comment kinds, ensuring accurate
structured rendering of comment blocks. The changes simplify future
maintenance, improve robustness by eliminating unchecked defaults, and
ensure consistency between generators.

Fixes https://github.com/llvm/llvm-project/issues/142083
2025-06-07 08:04:56 -07:00
Paul Kirth
a56861777a
[clang-doc] Reenable time trace support (#141139)
This patch re-enables -ftime-trace support in clang-doc. Initial support
in #97644 was reverted, and never relanded. This patch adds back the
command line option, and leverages the RAII tracing infrastructure more
thoroughly.
2025-06-03 09:56:25 -07:00
Paul Kirth
26fe803b9f
[clang-doc] Implement setupTemplateValue for HTMLMustacheGenerator (#138064)
This patch implements the business logic for setupTemplateValue, which
was split from #133161. The implementation configures the relative path
relationships between the various HTML components, and prepares them
prior to their use in the generator.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-23 15:59:42 -07:00
Paul Kirth
a8be7a7489
[clang-doc] Extract Info into JSON values (#138063)
Split from #133161. This patch provides the implementation of a number
of extractValue overloads used with the different types of Info.

The new helper functions extract the relevant information from the
different *Infos and inserts them into the correct fields of the JSON
values that will be used with the specific Mustache templates, which
will land separately.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-23 15:56:44 -07:00
Jie Fu
34e63be925 [clang-doc] Prevent copying loop variables (NFC)
/llvm-project/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp:86:19:
error: loop variable '[Name, FileName]' creates a copy from type 'std::pair<llvm::StringRef, llvm::StringRef> const' [-Werror,-Wrange-loop-construct]
  for (const auto [Name, FileName] : Partials)
                  ^
/llvm-project/clang-tools-extra/clang-doc/HTMLMustacheGenerator.cpp:86:8:
note: use reference type 'std::pair<llvm::StringRef, llvm::StringRef> const &' to prevent copying
  for (const auto [Name, FileName] : Partials)
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  &
1 error generated.
2025-05-23 09:00:19 +08:00
Paul Kirth
97dee78eb3
[clang-doc] Add helpers for Template config (#138062)
This patch adds or fills in some helper functions related to template
setup when initializing the mustache backend. It was split from #133161.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-22 14:20:08 -07:00
Paul Kirth
6a0e626af5
[clang-doc] Add HTMLMustacheGenerator methods (#138061)
Split from #133161. This patch fills in the implementation for a number
of the MustacheHTMLGenerator methods. Many of these APIs are just
stubbed out, and will have their implementation filled in by later
patches.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-16 17:30:45 -07:00
Paul Kirth
3bdfa6f3e8
[clang-doc] Add HTMLMustacheGenerator.cpp (#138060)
Split from #133161. This patch adds HTMLMustacheGenerator.cpp, and
the most basic class defintion for the generator. Future patches will
add functionality.

Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-05-12 18:54:04 -07:00