Browse Source

Fix crash on nullptr `TemplateTypeParm` decl (#1901)

pull/1909/head
Jelle 5 months ago committed by GitHub
parent
commit
99e5e19e72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      src/CppParser/Parser.cpp

8
src/CppParser/Parser.cpp

@ -2868,9 +2868,13 @@ Type* Parser::WalkType(clang::QualType QualType, const clang::TypeLoc* TL,
} }
assertm(TL->getTypeLocClass() == TypeLoc::TemplateTypeParm, "Token should be template type parameter!\n"); assertm(TL->getTypeLocClass() == TypeLoc::TemplateTypeParm, "Token should be template type parameter!\n");
auto TTTL = TL->getAs<TemplateTypeParmTypeLoc>(); auto TTPTL = TL->getAs<TemplateTypeParmTypeLoc>();
auto TTPD = TTPTL.getDecl();
TPT->parameter = WalkTypeTemplateParameter(TTTL.getDecl()); if (!TTPD)
return nullptr; // Can happen when a template param is used in a nested template argument
TPT->parameter = WalkTypeTemplateParameter(TTPD);
} }
else if (TP->getDecl()) else if (TP->getDecl())
TPT->parameter = WalkTypeTemplateParameter(TP->getDecl()); TPT->parameter = WalkTypeTemplateParameter(TP->getDecl());

Loading…
Cancel
Save