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,
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,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits