[PATCH] D101212: [AST][JSON] Fix null ptr crash dumping TemplateTemplateParmDecl

David Tolnay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 23 17:16:12 PDT 2021


dtolnay created this revision.
dtolnay added a reviewer: aaron.ballman.
Herald added a subscriber: kristof.beyls.
dtolnay requested review of this revision.
Herald added a project: clang.

Minimal repro-- the following program winds up with
D->getDefaultArgStorage().getInheritedFrom() == nullptr during dumping the
TemplateTemplateParmDecl corresponding to the template parameter of i.

  template <typename>
  struct R;
  template <template <typename> class = R>
  void i();

Previously--

   #6 clang::TemplateTemplateParmDecl::getSourceRange() const clang/include/clang/AST/DeclTemplate.h:1745
  #15 clang::JSONNodeDumper::VisitTemplateTemplateParmDecl(clang::TemplateTemplateParmDecl const*) clang/lib/AST/JSONNodeDumper.cpp:889
  #16 clang::JSONNodeDumper::Visit(clang::Decl const*) clang/lib/AST/JSONNodeDumper.cpp:128
  ...
  clang-13: error: unable to execute command: Segmentation fault (core dumped)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101212

Files:
  clang/lib/AST/JSONNodeDumper.cpp
  clang/test/AST/ast-dump-template-decls-json.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101212.340207.patch
Type: text/x-patch
Size: 5257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210424/2ca11c4f/attachment.bin>


More information about the cfe-commits mailing list