]> granicus.if.org Git - clang/commitdiff
[ASTDump] Mark null params with a tag rather than a child node
authorStephen Kelly <steveire@gmail.com>
Fri, 18 Jan 2019 22:00:16 +0000 (22:00 +0000)
committerStephen Kelly <steveire@gmail.com>
Fri, 18 Jan 2019 22:00:16 +0000 (22:00 +0000)
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

lib/AST/ASTDumper.cpp

index e2390baa7a4bea0fc1a2a007a999a52556b4efc3..d13651931f20f572dd6ca8a65237658efb1e1ab3 100644 (file)
@@ -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))