r305860 - Special-case handling of destructors in override lists when dumping ASTs.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 20 15:29:44 PDT 2017


On 20 June 2017 at 14:30, Lang Hames via cfe-commits <
cfe-commits at lists.llvm.org> wrote:

> Author: lhames
> Date: Tue Jun 20 16:30:43 2017
> New Revision: 305860
>
> URL: http://llvm.org/viewvc/llvm-project?rev=305860&view=rev
> Log:
> Special-case handling of destructors in override lists when dumping ASTs.
>
> Fixes a bug in r305850: CXXDestructors don't have names, so we need to
> handle
> printing of them separately.
>

Clang models destructors as having names, and should print them properly.
What was actually going wrong here? There are other kinds of name that can
be virtual and aren't simple identifiers...


> Modified:
>     cfe/trunk/lib/AST/ASTDumper.cpp
>
> Modified: cfe/trunk/lib/AST/ASTDumper.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/
> ASTDumper.cpp?rev=305860&r1=305859&r2=305860&view=diff
> ============================================================
> ==================
> --- cfe/trunk/lib/AST/ASTDumper.cpp (original)
> +++ cfe/trunk/lib/AST/ASTDumper.cpp Tue Jun 20 16:30:43 2017
> @@ -1189,9 +1189,12 @@ void ASTDumper::VisitFunctionDecl(const
>        auto dumpOverride =
>          [=](const CXXMethodDecl *D) {
>            SplitQualType T_split = D->getType().split();
> -          OS << D << " " << D->getParent()->getName() << "::"
> -             << D->getName() << " '"
> -             << QualType::getAsString(T_split) << "'";
> +          OS << D << " " << D->getParent()->getName() << "::";
> +          if (isa<CXXDestructorDecl>(D))
> +            OS << "~" << D->getParent()->getName();
> +          else
> +            OS << D->getName();
> +          OS << " '" << QualType::getAsString(T_split) << "'";
>          };
>
>        dumpChild([=] {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170620/a6150a29/attachment-0001.html>


More information about the cfe-commits mailing list