mgrang updated this revision to Diff 260517.
mgrang retitled this revision from "[Sema] Fix null pointer dereference 
warnings [1/n]" to "[Analysis] Fix null pointer dereference warnings [1/n]".

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78853/new/

https://reviews.llvm.org/D78853

Files:
  clang/lib/Analysis/ThreadSafety.cpp


Index: clang/lib/Analysis/ThreadSafety.cpp
===================================================================
--- clang/lib/Analysis/ThreadSafety.cpp
+++ clang/lib/Analysis/ThreadSafety.cpp
@@ -1935,6 +1935,10 @@
                       CapDiagKind);
 
   if (isScopedVar) {
+    // The default value for the argument VD to the current function is
+    // nullptr. So we assert that VD is non null because we deref VD here.
+    assert(VD && "!VD");
+
     // Add the managing object as a dummy mutex, mapped to the underlying 
mutex.
     SourceLocation MLoc = VD->getLocation();
     DeclRefExpr DRE(VD->getASTContext(), VD, false, VD->getType(), VK_LValue,


Index: clang/lib/Analysis/ThreadSafety.cpp
===================================================================
--- clang/lib/Analysis/ThreadSafety.cpp
+++ clang/lib/Analysis/ThreadSafety.cpp
@@ -1935,6 +1935,10 @@
                       CapDiagKind);
 
   if (isScopedVar) {
+    // The default value for the argument VD to the current function is
+    // nullptr. So we assert that VD is non null because we deref VD here.
+    assert(VD && "!VD");
+
     // Add the managing object as a dummy mutex, mapped to the underlying mutex.
     SourceLocation MLoc = VD->getLocation();
     DeclRefExpr DRE(VD->getASTContext(), VD, false, VD->getType(), VK_LValue,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to