Author: rksimon
Date: Sun Oct 13 04:30:06 2019
New Revision: 374717

URL: http://llvm.org/viewvc/llvm-project?rev=374717&view=rev
Log:
BlockInCriticalSectionChecker - silence static analyzer dyn_cast null 
dereference warning. NFCI.

The static analyzer is warning about a potential null dereference, but we 
should be able to use cast<> directly and if not assert will fire for us.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp

Modified: 
cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp?rev=374717&r1=374716&r2=374717&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp 
(original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp Sun 
Oct 13 04:30:06 2019
@@ -126,7 +126,7 @@ bool BlockInCriticalSectionChecker::isLo
 
 bool BlockInCriticalSectionChecker::isUnlockFunction(const CallEvent &Call) 
const {
   if (const auto *Dtor = dyn_cast<CXXDestructorCall>(&Call)) {
-    const auto *DRecordDecl = 
dyn_cast<CXXRecordDecl>(Dtor->getDecl()->getParent());
+    const auto *DRecordDecl = 
cast<CXXRecordDecl>(Dtor->getDecl()->getParent());
     auto IdentifierInfo = DRecordDecl->getIdentifier();
     if (IdentifierInfo == IILockGuard || IdentifierInfo == IIUniqueLock)
       return true;


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to