From: Stephen Kelly Date: Fri, 18 Jan 2019 22:00:16 +0000 (+0000) Subject: [ASTDump] Mark null params with a tag rather than a child node X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa2a5337ff3019a3c91f254768c226d25096d121;p=clang [ASTDump] Mark null params with a tag rather than a child node Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56753 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351601 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index e2390baa7a..d13651931f 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -633,13 +633,18 @@ void ASTDumper::VisitFunctionDecl(const FunctionDecl *D) { } } + // Since NumParams comes from the FunctionProtoType of the FunctionDecl and + // the Params are set later, it is possible for a dump during debugging to + // encounter a FunctionDecl that has been created but hasn't been assigned + // ParmVarDecls yet. + if (!D->param_empty() && !D->param_begin()) + OS << " <<getNumParams() << ">>>"; + if (const auto *FTSI = D->getTemplateSpecializationInfo()) dumpTemplateArgumentList(*FTSI->TemplateArguments); - if (!D->param_begin() && D->getNumParams()) - dumpChild([=] { OS << "<getNumParams() << ">>"; }); - else - for (const ParmVarDecl *Parameter : D->parameters()) + if (D->param_begin()) + for (const auto *Parameter : D->parameters()) dumpDecl(Parameter); if (const auto *C = dyn_cast(D))