[clang] ffcb4b4 - Revert "[clang][Checkers] Extend PthreadLockChecker state dump (NFC)."
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 31 06:19:29 PDT 2021
Author: Balázs Kéri
Date: 2021-03-31T15:28:53+02:00
New Revision: ffcb4b43b799f518891088076ef083ca8f13c537
URL: https://github.com/llvm/llvm-project/commit/ffcb4b43b799f518891088076ef083ca8f13c537
DIFF: https://github.com/llvm/llvm-project/commit/ffcb4b43b799f518891088076ef083ca8f13c537.diff
LOG: Revert "[clang][Checkers] Extend PthreadLockChecker state dump (NFC)."
This reverts commit 49c0ab6d7611050ae902f6369fc878e17da453ad.
Test failures showed up because non-deterministic output.
Added:
Modified:
clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
Removed:
clang/test/Analysis/pthreadlock_state.c
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
index eb10a42b7d3d8..88e80c481a5a7 100644
--- a/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp
@@ -339,16 +339,7 @@ void PthreadLockChecker::printState(raw_ostream &Out, ProgramStateRef State,
}
}
- DestroyRetValTy DRV = State->get<DestroyRetVal>();
- if (!DRV.isEmpty()) {
- Out << Sep << "Mutexes in unresolved possibly destroyed state:" << NL;
- for (auto I : DRV) {
- I.first->dumpToStream(Out);
- Out << ": ";
- I.second->dumpToStream(Out);
- Out << NL;
- }
- }
+ // TODO: Dump destroyed mutex symbols?
}
void PthreadLockChecker::AcquirePthreadLock(const CallEvent &Call,
diff --git a/clang/test/Analysis/pthreadlock_state.c b/clang/test/Analysis/pthreadlock_state.c
deleted file mode 100644
index dfbc10430bee9..0000000000000
--- a/clang/test/Analysis/pthreadlock_state.c
+++ /dev/null
@@ -1,67 +0,0 @@
-// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.unix.PthreadLock,debug.ExprInspection 2>&1 %s | FileCheck %s
-
-#include "Inputs/system-header-simulator-for-pthread-lock.h"
-
-#define NULL 0
-
-void clang_analyzer_printState();
-
-pthread_mutex_t mtx;
-
-void test(pthread_mutex_t *mtx1) {
- clang_analyzer_printState();
- // CHECK: "checker_messages": null
-
- pthread_mutex_init(&mtx, NULL);
- clang_analyzer_printState();
- // CHECK: { "checker": "alpha.core.PthreadLockBase", "messages": [
- // CHECK-NEXT: "Mutex states:",
- // CHECK-NEXT: "mtx: unlocked",
- // CHECK-NEXT: ""
- // CHECK-NEXT: ]}
-
- pthread_mutex_lock(&mtx);
- clang_analyzer_printState();
- // CHECK: { "checker": "alpha.core.PthreadLockBase", "messages": [
- // CHECK-NEXT: "Mutex states:",
- // CHECK-NEXT: "mtx: locked",
- // CHECK-NEXT: "Mutex lock order:",
- // CHECK-NEXT: "mtx",
- // CHECK-NEXT: ""
- // CHECK-NEXT: ]}
-
- pthread_mutex_unlock(&mtx);
- clang_analyzer_printState();
- // CHECK: { "checker": "alpha.core.PthreadLockBase", "messages": [
- // CHECK-NEXT: "Mutex states:",
- // CHECK-NEXT: "mtx: unlocked",
- // CHECK-NEXT: ""
- // CHECK-NEXT: ]}
-
- int ret = pthread_mutex_destroy(&mtx);
- clang_analyzer_printState();
- // CHECK: { "checker": "alpha.core.PthreadLockBase", "messages": [
- // CHECK-NEXT: "Mutex states:",
- // CHECK-NEXT: "mtx: unlocked, possibly destroyed",
- // CHECK-NEXT: "Mutexes in unresolved possibly destroyed state:",
- // CHECK-NEXT: "mtx: conj_$
- // CHECK-NEXT: ""
- // CHECK-NEXT: ]}
-
- if (ret)
- return;
-
- ret = pthread_mutex_destroy(mtx1);
- clang_analyzer_printState();
- // CHECK: { "checker": "alpha.core.PthreadLockBase", "messages": [
- // CHECK-NEXT: "Mutex states:",
- // CHECK-NEXT: "mtx: destroyed",
- // CHECK-NEXT: "SymRegion{reg_$[[REG:[0-9]+]]<pthread_mutex_t * mtx1>}: not tracked, possibly destroyed",
- // CHECK-NEXT: "Mutexes in unresolved possibly destroyed state:",
- // CHECK-NEXT: "SymRegion{reg_$[[REG]]<pthread_mutex_t * mtx1>}: conj_$
- // CHECK-NEXT: ""
- // CHECK-NEXT: ]}
- if (ret)
- return;
- pthread_mutex_init(mtx1, NULL);
-}
More information about the cfe-commits
mailing list