aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2019-01-18 22:00:16 +0000
committerStephen Kelly <steveire@gmail.com>2019-01-18 22:00:16 +0000
commitbbd08cce792400302e3f5cf35d3d80cd12e2531f (patch)
treeecea2758d774f17d07866eb2910a715afc3ab9bc
parent5110ebd9fe5f3c4d6714b6b01635f8f211786808 (diff)
downloadllvm-bbd08cce792400302e3f5cf35d3d80cd12e2531f.zip
llvm-bbd08cce792400302e3f5cf35d3d80cd12e2531f.tar.gz
llvm-bbd08cce792400302e3f5cf35d3d80cd12e2531f.tar.bz2
[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 llvm-svn: 351601
-rw-r--r--clang/lib/AST/ASTDumper.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index e2390ba..d136519 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/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 << " <<<NULL params x " << D->getNumParams() << ">>>";
+
if (const auto *FTSI = D->getTemplateSpecializationInfo())
dumpTemplateArgumentList(*FTSI->TemplateArguments);
- if (!D->param_begin() && D->getNumParams())
- dumpChild([=] { OS << "<<NULL params x " << D->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<CXXConstructorDecl>(D))