[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 14:05:18 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL351601: [ASTDump] Mark null params with a tag rather than a child node (authored by steveire, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D56753?vs=182476&id=182604#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D56753

Files:
  cfe/trunk/lib/AST/ASTDumper.cpp


Index: cfe/trunk/lib/AST/ASTDumper.cpp
===================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp
+++ cfe/trunk/lib/AST/ASTDumper.cpp
@@ -633,13 +633,18 @@
     }
   }
 
+  // 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.182604.patch
Type: text/x-patch
Size: 1062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190118/ccfc82e0/attachment.bin>


More information about the cfe-commits mailing list