tblah created this revision. tblah added a reviewer: rsmith. Herald added a project: All. tblah requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D123667 Files: clang/lib/AST/TypePrinter.cpp Index: clang/lib/AST/TypePrinter.cpp =================================================================== --- clang/lib/AST/TypePrinter.cpp +++ clang/lib/AST/TypePrinter.cpp @@ -1466,8 +1466,7 @@ if (!Policy.SuppressScope) AppendScope(TD->getDeclContext(), OS, TD->getDeclName()); - IdentifierInfo *II = TD->getIdentifier(); - OS << II->getName(); + OS << TD->getName(); } else { T->getTemplateName().print(OS, Policy); }
Index: clang/lib/AST/TypePrinter.cpp =================================================================== --- clang/lib/AST/TypePrinter.cpp +++ clang/lib/AST/TypePrinter.cpp @@ -1466,8 +1466,7 @@ if (!Policy.SuppressScope) AppendScope(TD->getDeclContext(), OS, TD->getDeclName()); - IdentifierInfo *II = TD->getIdentifier(); - OS << II->getName(); + OS << TD->getName(); } else { T->getTemplateName().print(OS, Policy); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits