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

Tom Eccles via All-commits all-commits at lists.llvm.org
Fri May 20 04:03:41 PDT 2022


  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 3bfae7816bdb5b09930f073f1eb99f72015d9f78
      https://github.com/llvm/llvm-project/commit/3bfae7816bdb5b09930f073f1eb99f72015d9f78
  Author: Tom Eccles <tom.eccles at codethink.co.uk>
  Date:   2022-05-19 (Thu, 19 May 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.

(cherry picked from commit 225b91e6cbba31ff1ce787a152a67977d08fdcab)




More information about the All-commits mailing list