[PATCH] D98502: [clang][Checkers] Extend PthreadLockChecker state dump (NFC).

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 12 06:32:12 PST 2021


balazske created this revision.
Herald added subscribers: martong, gamesh411, Szelethus, dkrupp.
Herald added a reviewer: Szelethus.
balazske requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add printing of map 'DestroyRetVal'.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98502

Files:
  clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp


Index: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
@@ -302,7 +302,6 @@
       state = state->set<LockMap>(lockR, LockState::getUnlocked());
   } else
     state = state->set<LockMap>(lockR, LockState::getDestroyed());
-
   // Removing the map entry (lockR, sym) from DestroyRetVal as the lock state is
   // now resolved.
   state = state->remove<DestroyRetVal>(lockR);
@@ -339,7 +338,16 @@
     }
   }
 
-  // TODO: Dump destroyed mutex symbols?
+  DestroyRetValTy DRV = State->get<DestroyRetVal>();
+  if (!DRV.isEmpty()) {
+    Out << Sep << "Mutex destroys with unknown result:" << NL;
+    for (auto I : DRV) {
+      I.first->dumpToStream(Out);
+      Out << ": ";
+      I.second->dumpToStream(Out);
+      Out << NL;
+    }
+  }
 }
 
 void PthreadLockChecker::AcquirePthreadLock(const CallEvent &Call,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98502.330228.patch
Type: text/x-patch
Size: 1013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210312/a81421ec/attachment.bin>


More information about the cfe-commits mailing list