llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Prajwal Nadig (snprajwal) <details> <summary>Changes</summary> The subheading for a destructor contained only the identifier. The tilde must also be included as it is necessary to differentiate the destructor from any constructors present. rdar://129587608 --- Full diff: https://github.com/llvm/llvm-project/pull/146001.diff 2 Files Affected: - (modified) clang/lib/ExtractAPI/DeclarationFragments.cpp (+8-3) - (modified) clang/test/ExtractAPI/constructor_destructor.cpp (+1-1) ``````````diff diff --git a/clang/lib/ExtractAPI/DeclarationFragments.cpp b/clang/lib/ExtractAPI/DeclarationFragments.cpp index 348e7588690a2..62b69436c0f97 100644 --- a/clang/lib/ExtractAPI/DeclarationFragments.cpp +++ b/clang/lib/ExtractAPI/DeclarationFragments.cpp @@ -1610,10 +1610,13 @@ DeclarationFragmentsBuilder::getFunctionSignature(const ObjCMethodDecl *); DeclarationFragments DeclarationFragmentsBuilder::getSubHeading(const NamedDecl *Decl) { DeclarationFragments Fragments; - if (isa<CXXConstructorDecl>(Decl) || isa<CXXDestructorDecl>(Decl)) + if (isa<CXXConstructorDecl>(Decl)) { Fragments.append(cast<CXXRecordDecl>(Decl->getDeclContext())->getName(), DeclarationFragments::FragmentKind::Identifier); - else if (isa<CXXConversionDecl>(Decl)) { + } else if (isa<CXXDestructorDecl>(Decl)) { + Fragments.append(cast<CXXDestructorDecl>(Decl)->getNameAsString(), + DeclarationFragments::FragmentKind::Identifier); + } else if (isa<CXXConversionDecl>(Decl)) { Fragments.append( cast<CXXConversionDecl>(Decl)->getConversionType().getAsString(), DeclarationFragments::FragmentKind::Identifier); @@ -1627,9 +1630,11 @@ DeclarationFragmentsBuilder::getSubHeading(const NamedDecl *Decl) { } else if (Decl->getIdentifier()) { Fragments.append(Decl->getName(), DeclarationFragments::FragmentKind::Identifier); - } else + } else { Fragments.append(Decl->getDeclName().getAsString(), DeclarationFragments::FragmentKind::Identifier); + } + return Fragments; } diff --git a/clang/test/ExtractAPI/constructor_destructor.cpp b/clang/test/ExtractAPI/constructor_destructor.cpp index 27112c95ac45c..2f2150a6d0da0 100644 --- a/clang/test/ExtractAPI/constructor_destructor.cpp +++ b/clang/test/ExtractAPI/constructor_destructor.cpp @@ -213,7 +213,7 @@ class Foo { "subHeading": [ { "kind": "identifier", - "spelling": "Foo" + "spelling": "~Foo" } ], "title": "~Foo" `````````` </details> https://github.com/llvm/llvm-project/pull/146001 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits