Skip to content

Commit e25581d

Browse files
committed
[clang-doc] fix conversion names of dependent types
Fixes llvm#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.
1 parent 9c60431 commit e25581d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,13 @@ template <typename T>
525525
static void populateInfo(Info &I, const T *D, const FullComment *C,
526526
bool &IsInAnonymousNamespace) {
527527
I.USR = getUSRForDecl(D);
528-
I.Name = D->getNameAsString();
528+
auto ConversionDecl = dyn_cast_or_null<CXXConversionDecl>(D);
529+
if (ConversionDecl && ConversionDecl->getConversionType()
530+
.getTypePtr()
531+
->isTemplateTypeParmType())
532+
I.Name = "operator " + ConversionDecl->getConversionType().getAsString();
533+
else
534+
I.Name = D->getNameAsString();
529535
populateParentNamespaces(I.Namespace, D, IsInAnonymousNamespace);
530536
if (C) {
531537
I.Description.emplace_back();

0 commit comments

Comments
 (0)