[clang] [analyzer] Add path notes to PthreadLockChecker (PR #202473)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 9 04:15:26 PDT 2026
================
@@ -492,7 +490,19 @@ void PthreadLockChecker::AcquireLockAux(const CallEvent &Call,
// Record that the lock was acquired.
lockSucc = lockSucc->add<LockSet>(lockR);
lockSucc = lockSucc->set<LockMap>(lockR, LockState::getLocked());
- C.addTransition(lockSucc);
+ const NoteTag *Note =
+ C.getNoteTag([lockR](PathSensitiveBugReport &BR, llvm::raw_ostream &OS) {
+ if (BR.getBugType().getCategory() != "Lock checker")
+ return;
+ if (!BR.isInteresting(lockR))
+ return;
----------------
NagyDonat wrote:
These two checks appear multiple times, consider replacing them with something like
```c++
if (!lockR->isRelevantForReport(BR))
return;
```
by introducing a method `isRelevantForReport()` that performs these two checks. (Feel free to pick a different name etc. if you prefer.)
https://github.com/llvm/llvm-project/pull/202473
More information about the cfe-commits
mailing list