[PATCH] D56753: [ASTDump] Mark null params with a tag rather than a child node

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 18 01:50:04 PST 2019


steveire updated this revision to Diff 182476.
steveire marked an inline comment as done.
steveire added a comment.

Update


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56753/new/

https://reviews.llvm.org/D56753

Files:
  lib/AST/ASTDumper.cpp


Index: lib/AST/ASTDumper.cpp
===================================================================
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -633,13 +633,19 @@
     }
   }
 
+  // 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))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56753.182476.patch
Type: text/x-patch
Size: 1036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190118/2171451b/attachment.bin>


More information about the cfe-commits mailing list