summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2020-01-14 13:54:39 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2020-01-14 14:00:38 +0000
commit1d6b964ed1f7a77b178e86bef7d569611f2c0983 (patch)
tree7bea6dfceab014144f11cd2d70f0b640434f9c8d /clang
parent591cd40584300a1d5d33bfaefa4698c02ef56887 (diff)
downloadbcm5719-llvm-1d6b964ed1f7a77b178e86bef7d569611f2c0983.tar.gz
bcm5719-llvm-1d6b964ed1f7a77b178e86bef7d569611f2c0983.zip
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.
Diffstat (limited to 'clang')
-rwxr-xr-xclang/lib/Sema/SemaTemplate.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 0a3e59d5523..6f22326e8fc 100755
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -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())
OpenPOWER on IntegriCloud