13 Commits

Author SHA1 Message Date
Paul Kirth
c1ed4f6423
[clang-doc] Format test files (#132428)
Many of the test files had an inconsistent formatting. This patch ran
clang-format over them using the project's .clang-format file, with
column limit = 0, to prevent test directives from being split over
multiple lines.
2025-03-24 17:27:16 -07:00
Paul Kirth
2b932bc111
[clang-doc] Use LangOpts when printing types (#120308)
The implementation in the clang-doc serializer failed to take in the
LangOpts from the declaration. As a result, we'd do things like print
`_Bool` instead of `bool`, even in C++ code.

Fixes #62970
2024-12-18 08:39:19 -08:00
Paul Kirth
229d78de31
[clang-doc] Use QualName in Markdown output
QualName will provide the more useful typename when the type is
templated.

Fixes #67549

Reviewers: petrhosek, PeterChou1

Reviewed By: petrhosek

Pull Request: https://github.com/llvm/llvm-project/pull/119815
2024-12-13 09:58:08 -08:00
Paul Kirth
e113a72562
[clang-doc] Precommit test case for functions with templated parameters and return
To address #67549 we need a test case that will show up in the markdown
output for functions.

Reviewers: PeterChou1, petrhosek

Reviewed By: petrhosek

Pull Request: https://github.com/llvm/llvm-project/pull/119814
2024-12-13 09:56:19 -08:00
Paul Kirth
52e25912f8
[clang-doc] Add tests for Markdown output with C++ templates
Reviewers: PeterChou1, petrhosek

Reviewed By: petrhosek

Pull Request: https://github.com/llvm/llvm-project/pull/119813
2024-12-13 09:53:29 -08:00
Paul Kirth
7d764db9be
[clang-doc][NFC] Avoid unnecessary operations in the template test (#119812) 2024-12-13 09:49:32 -08:00
Paul Kirth
b856952886
[clang-doc][NFC] Make test resilient to line changes (#119811)
This just reorganizes the test code, so its easy to use @LINE directives
in the test, and avoid needing to update all the line numbers when
making unrelated changes.
2024-12-13 09:39:50 -08:00
Paul Kirth
bc627a46a8
[clang-doc][NFC] Rename CHECK prefix for YAML
We plan to introduce checks for other backends, like markdown.

Reviewers: PeterChou1, petrhosek

Reviewed By: petrhosek

Pull Request: https://github.com/llvm/llvm-project/pull/119810
2024-12-13 09:34:43 -08:00
PeterChou1
3c9e3457d7
[clang-doc] fix flaky test in clang-doc (#101387)
Fixes https://github.com/llvm/llvm-project/issues/97507

#96809 introduce non-determinstic behaviour in clang-doc which caused
the output to be randomly ordered which lead to randomly failing test.
This patch modify clang-doc to behave deterministically again by sorting
the output by location or USR.
2024-08-08 01:15:21 -04:00
Krystian Stasiowski
640ef55bbb
Reapply "[Clang][Sema] Diagnose unexpanded packs in the template argument lists of function template specializations" (#76876) (#76915)
This reapplies f034044ad94d6f7ccec13d89f08acac257ed28bb after it was
reverted by 687396b5f4ba0713d103ebd172b308e92eb930cc due to a test
failure in clang-doc.

The test in question declares a partial specialization of a function
template, as well as an explicit specialization of the same function
template. Both declarations are now set as invalid, meaning neither is
emitted by clang-doc.

Since this is the sole test of function template specializations in
clang-doc, I presume the intent is for the partial specialization to
actually be the primary template. Doing so results in the expected
output.
2024-01-04 17:30:48 +01:00
Brett Wilson
4a68babd99 [clang-doc] Add template support.
Reads template information from the AST and adds template parameters and
specialization information to the corresponding clang-doc structures.

Add a "QualName" to the Reference struct which includes the full
qualified type name. The Reference object represents a link in the
HTML/MD generators so is based on the unqualified name. But this does
not encode C-V qualifiers or template information that decorate the
name. The new QualName member encodes all of this information and also
makes it easier for the generators or downsteam YAML consumers to
generate the full name (before they had to process the "Path").

In test code that was changed, remove made-up paths to built-in types
like "int". In addition to slightnly cleaning up the code, these types
do not have paths in real execution, and generating incorrect references
to nonexistant data may complicate future changes in the generators.

Convert llvm::Optional to std::optional (YAML library requires this for
the new usage, and this makes everything consistent according to the
llvm::Optional -> std::optional transition).

Differential Revision: https://reviews.llvm.org/D139154
2022-12-08 08:02:02 -08:00
Brett Wilson
91b38c6aad Revert "[clang-doc] Add template support."
Causes a build failure in YAML specializations.

This reverts commit 0f6dbb5f164662c3e6a167a89e7a89f07c60e32b.
2022-12-07 10:22:51 -08:00
Brett Wilson
0f6dbb5f16 [clang-doc] Add template support.
Reads template information from the AST and adds template parameters and
specialization information to the corresponding clang-doc structures.

Add a "QualName" to the Reference struct which includes the full
qualified type name. The Reference object represents a link in the
HTML/MD generators so is based on the unqualified name. But this does
not encode C-V qualifiers or template information that decorate the
name. The new QualName member encodes all of this information and also
makes it easier for the generators or downsteam YAML consumers to
generate the full name (before they had to process the "Path").

In test code that was changed, remove made-up paths to built-in types
like "int". In addition to slightnly cleaning up the code, these types
do not have paths in real execution, and generating incorrect references
to nonexistant data may complicate future changes in the generators.

Differential Revision: https://reviews.llvm.org/D139154
2022-12-07 09:48:13 -08:00