Fix "pointer is null" static analyzer warning. NFCI.

This commit is contained in:
Simon Pilgrim 2020-01-07 13:37:48 +00:00
parent 60e0120c91
commit 3b417b7cf7
1 changed files with 3 additions and 3 deletions

View File

@ -379,11 +379,11 @@ StringRef TParamCommandComment::getParamName(const FullComment *FC) const {
assert(isPositionValid());
const TemplateParameterList *TPL = FC->getDeclInfo()->TemplateParameters;
for (unsigned i = 0, e = getDepth(); i != e; ++i) {
if (i == e-1)
assert(TPL && "Unknown TemplateParameterList");
if (i == e - 1)
return TPL->getParam(getIndex(i))->getName();
const NamedDecl *Param = TPL->getParam(getIndex(i));
if (const TemplateTemplateParmDecl *TTP =
dyn_cast<TemplateTemplateParmDecl>(Param))
if (auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Param))
TPL = TTP->getTemplateParameters();
}
return "";