balazske updated this revision to Diff 330243.
balazske added a comment.
Improved commit message.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98504/new/
https://reviews.llvm.org/D98504
Files:
clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
clang/test/Analysis/pthreadlock.c
Index: clang/test/Analysis/pthreadlock.c
===================================================================
--- clang/test/Analysis/pthreadlock.c
+++ clang/test/Analysis/pthreadlock.c
@@ -513,3 +513,9 @@
fake_system_function();
pthread_mutex_lock(pmtx); // expected-warning{{This lock has already been
acquired}}
}
+
+void nocrash1(pthread_mutex_t *mutex) {
+ int ret = pthread_mutex_destroy(mutex);
+ if (ret == 0) // no crash
+ ;
+}
Index: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
@@ -646,8 +646,10 @@
for (auto I : State->get<LockMap>()) {
// Stop tracking dead mutex regions as well.
- if (!SymReaper.isLiveRegion(I.first))
+ if (!SymReaper.isLiveRegion(I.first)) {
State = State->remove<LockMap>(I.first);
+ State = State->remove<DestroyRetVal>(I.first);
+ }
}
// TODO: We probably need to clean up the lock stack as well.
Index: clang/test/Analysis/pthreadlock.c
===================================================================
--- clang/test/Analysis/pthreadlock.c
+++ clang/test/Analysis/pthreadlock.c
@@ -513,3 +513,9 @@
fake_system_function();
pthread_mutex_lock(pmtx); // expected-warning{{This lock has already been acquired}}
}
+
+void nocrash1(pthread_mutex_t *mutex) {
+ int ret = pthread_mutex_destroy(mutex);
+ if (ret == 0) // no crash
+ ;
+}
Index: clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
@@ -646,8 +646,10 @@
for (auto I : State->get<LockMap>()) {
// Stop tracking dead mutex regions as well.
- if (!SymReaper.isLiveRegion(I.first))
+ if (!SymReaper.isLiveRegion(I.first)) {
State = State->remove<LockMap>(I.first);
+ State = State->remove<DestroyRetVal>(I.first);
+ }
}
// TODO: We probably need to clean up the lock stack as well.
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits