Skip to content

Commit 3b417b7

Browse files
committed
Fix "pointer is null" static analyzer warning. NFCI.
1 parent 60e0120 commit 3b417b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/AST/Comment.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,11 @@ StringRef TParamCommandComment::getParamName(const FullComment *FC) const {
379379
assert(isPositionValid());
380380
const TemplateParameterList *TPL = FC->getDeclInfo()->TemplateParameters;
381381
for (unsigned i = 0, e = getDepth(); i != e; ++i) {
382-
if (i == e-1)
382+
assert(TPL && "Unknown TemplateParameterList");
383+
if (i == e - 1)
383384
return TPL->getParam(getIndex(i))->getName();
384385
const NamedDecl *Param = TPL->getParam(getIndex(i));
385-
if (const TemplateTemplateParmDecl *TTP =
386-
dyn_cast<TemplateTemplateParmDecl>(Param))
386+
if (auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Param))
387387
TPL = TTP->getTemplateParameters();
388388
}
389389
return "";

0 commit comments

Comments
 (0)