r305860 - Special-case handling of destructors in override lists when dumping ASTs.
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 12 22:36:22 PDT 2017
Hi Lang,
clang crashes when I compile the following code with "-Xclang -ast-dump”:
class Base {
public:
virtual void operator()() {}
};
class Derived : public Base {
public:
void operator()() override {}
};
If I change “OS << D->getName()” to “OS << D->getNameAsString()”, the crash disappears.
Can you take a look please?
> On Jun 20, 2017, at 2:30 PM, 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.
>
>
> 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/20170712/65842b84/attachment-0001.html>
More information about the cfe-commits
mailing list