[clang-tools-extra] [clang-doc] fix names of conversions for template parameters (PR #140856)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 20 23:58:21 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Erick Velez (evelez7)
<details>
<summary>Changes</summary>
Fixes #<!-- -->59812
The names of conversion functions of template type parameters were being emitted as "type-parameter-N-M". Now we check if the conversion type is a TemplateTypeParmType and reconstruct the source name.
---
Full diff: https://github.com/llvm/llvm-project/pull/140856.diff
1 Files Affected:
- (modified) clang-tools-extra/clang-doc/Serialize.cpp (+7-1)
``````````diff
diff --git a/clang-tools-extra/clang-doc/Serialize.cpp b/clang-tools-extra/clang-doc/Serialize.cpp
index 18db427b5239e..585a46112d43d 100644
--- a/clang-tools-extra/clang-doc/Serialize.cpp
+++ b/clang-tools-extra/clang-doc/Serialize.cpp
@@ -525,7 +525,13 @@ template <typename T>
static void populateInfo(Info &I, const T *D, const FullComment *C,
bool &IsInAnonymousNamespace) {
I.USR = getUSRForDecl(D);
- I.Name = D->getNameAsString();
+ auto ConversionDecl = dyn_cast_or_null<CXXConversionDecl>(D);
+ if (ConversionDecl && ConversionDecl->getConversionType()
+ .getTypePtr()
+ ->isTemplateTypeParmType())
+ I.Name = "operator " + ConversionDecl->getConversionType().getAsString();
+ else
+ I.Name = D->getNameAsString();
populateParentNamespaces(I.Namespace, D, IsInAnonymousNamespace);
if (C) {
I.Description.emplace_back();
``````````
</details>
https://github.com/llvm/llvm-project/pull/140856
More information about the cfe-commits
mailing list