================
@@ -2141,6 +2142,38 @@ class ThreadSafetyReporter : public
clang::threadSafety::ThreadSafetyHandler {
Warnings.emplace_back(std::move(Warning), getNotes());
}
+ void handleGuardedByAnyReadNotHeld(const NamedDecl *D,
+ ProtectedOperationKind POK,
+ ArrayRef<StringRef> LockNames,
+ SourceLocation Loc) override {
+ bool IsDeref;
+ switch (POK) {
+ case POK_VarAccess:
+ case POK_PassByRef:
+ case POK_ReturnByRef:
+ case POK_PassPointer:
+ case POK_ReturnPointer:
+ IsDeref = false;
+ break;
+ case POK_VarDereference:
+ case POK_PtPassByRef:
+ case POK_PtReturnByRef:
+ case POK_PtPassPointer:
+ case POK_PtReturnPointer:
+ IsDeref = true;
+ break;
+ case POK_FunctionCall:
+ llvm_unreachable("POK_FunctionCall not applicable here");
+ }
+ SmallVector<std::string, 2> Quoted;
+ for (StringRef Name : LockNames)
+ Quoted.push_back(("'" + Name + "'").str());
+ PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_requires_any_of_locks)
+ << D << IsDeref
+ << llvm::join(Quoted, ", "));
----------------
aaronpuchert wrote:
Maybe it makes sense to do quoting and joining in one step.
https://github.com/llvm/llvm-project/pull/186838
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits