[all-commits] [llvm/llvm-project] 225b91: Fix crash getting name of a template decl

Tom Eccles via All-commits all-commits at lists.llvm.org
Fri Apr 22 10:04:27 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 225b91e6cbba31ff1ce787a152a67977d08fdcab
  Author: Tom Eccles <tom.eccles at codethink.co.uk>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    M clang/lib/AST/TypePrinter.cpp
    M clang/unittests/AST/TypePrinterTest.cpp

  Log Message:
  Fix crash getting name of a template decl

NamedDecl::getIdentifier can return a nullptr when
DeclarationName::isIdentifier is false, which leads to a null pointer
dereference when TypePrinter::printTemplateId calls ->getName().

NamedDecl::getName does the same thing in the successful case and
returns an empty string in the failure case.

This crash affects the llvm 14 packages on llvm.org.

More information about the All-commits mailing list