Skip to content

Commit 1d6b964

Browse files
committed
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.
1 parent 591cd40 commit 1d6b964

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/Sema/SemaTemplate.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7386,7 +7386,8 @@ Sema::CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams) {
73867386
// C++ [temp]p4:
73877387
// A template [...] shall not have C linkage.
73887388
DeclContext *Ctx = S->getEntity();
7389-
if (Ctx && Ctx->isExternCContext()) {
7389+
assert(Ctx && "Unknown context");
7390+
if (Ctx->isExternCContext()) {
73907391
Diag(TemplateParams->getTemplateLoc(), diag::err_template_linkage)
73917392
<< TemplateParams->getSourceRange();
73927393
if (const LinkageSpecDecl *LSD = Ctx->getExternCContext())

0 commit comments

Comments
 (0)