]> granicus.if.org Git - clang/commitdiff
Delete a trivially true check for a variable 'S' being null.
authorChandler Carruth <chandlerc@gmail.com>
Fri, 4 Nov 2016 06:16:09 +0000 (06:16 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 4 Nov 2016 06:16:09 +0000 (06:16 +0000)
The exact same test guards entry into the loop in which this test
occurs, and there is nothing inside the loop that assigns to the
variable, so it has already been checked for null.

This was flagged by PVS-Studio as well, but the report is actually wrong
-- this is not a case where we dereference a variable prior to testing
it for null, this is a case where we have a redundant test for null
after we already performed the exact same test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285983 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp

index 044a3aaa4bb36c96b96542a9f6c9d048c97191a1..e5b7af86179bf47b15a40d050d2cf41fc4616831 100644 (file)
@@ -1293,7 +1293,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
         // If we have a context, and it's not a context stashed in the
         // template parameter scope for an out-of-line definition, also
         // look into that context.
-        if (!(Found && S && S->isTemplateParamScope())) {
+        if (!(Found && S->isTemplateParamScope())) {
           assert(Ctx->isFileContext() &&
               "We should have been looking only at file context here already.");