[clang] Thread Safety Analysis: Support guarded_by/pt_guarded_by with multiple capabilities (PR #186838)

Marco Elver via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 17 15:17:51 PDT 2026


================
@@ -1934,8 +1959,18 @@ void ThreadSafetyAnalyzer::checkAccess(const FactSet &FSet, const Expr *Exp,
     Handler.handleNoMutexHeld(D, POK, AK, Loc);
   }
 
-  for (const auto *I : D->specific_attrs<GuardedByAttr>())
-    warnIfMutexNotHeld(FSet, D, Exp, AK, I->getArg(), POK, nullptr, Loc);
+  for (const auto *I : D->specific_attrs<GuardedByAttr>()) {
+    if (AK == AK_Written || I->args_size() == 1) {
----------------
melver wrote:

Right, so I think I'll have to keep the size==1 case for now.

https://github.com/llvm/llvm-project/pull/186838


More information about the cfe-commits mailing list