================
@@ -1868,6 +1875,24 @@ void ThreadSafetyAnalyzer::warnIfMutexHeld(const FactSet
&FSet,
}
}
+void ThreadSafetyAnalyzer::warnIfAnyMutexNotHeldForRead(
+ const FactSet &FSet, const NamedDecl *D, const Expr *Exp,
+ llvm::ArrayRef<Expr *> Args, ProtectedOperationKind POK,
+ SourceLocation Loc) {
+ SmallVector<std::string, 2> Names;
+ for (auto *Arg : Args) {
+ CapabilityExpr Cp = SxBuilder.translateAttrExpr(Arg, D, Exp, nullptr);
+ if (Cp.isInvalid() || Cp.shouldIgnore())
+ continue;
+ const FactEntry *LDat = FSet.findLockUniv(FactMan, Cp);
+ if (LDat && LDat->isAtLeast(LK_Shared))
+ return; // At least one held — read access is safe.
+ Names.push_back("'" + Cp.toString() + "'");
+ }
+ if (!Names.empty())
+ Handler.handleGuardedByAnyReadNotHeld(D, POK, llvm::join(Names, ", "),
Loc);
----------------
melver wrote:
Adding a FIXME for now.
https://github.com/llvm/llvm-project/pull/186838
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits