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

Remove Ctx null test as clang static analyzer assumes that this can fail - replace it with an assertion as the pointer is always dereferenced below.
This commit is contained in:
Simon Pilgrim 2020-01-14 13:54:39 +00:00
parent 591cd40584
commit 1d6b964ed1
1 changed files with 2 additions and 1 deletions

View File

@ -7386,7 +7386,8 @@ Sema::CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams) {
// C++ [temp]p4:
// A template [...] shall not have C linkage.
DeclContext *Ctx = S->getEntity();
if (Ctx && Ctx->isExternCContext()) {
assert(Ctx && "Unknown context");
if (Ctx->isExternCContext()) {
Diag(TemplateParams->getTemplateLoc(), diag::err_template_linkage)
<< TemplateParams->getSourceRange();
if (const LinkageSpecDecl *LSD = Ctx->getExternCContext())