[clang] Thread Safety Analysis: Support passing scoped locks between functions with appropriate annotations (PR #110523)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 09:10:37 PST 2024


================
@@ -645,6 +670,10 @@ static void handleLockReturnedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
 }
 
 static void handleLocksExcludedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+  if (const auto *ParmDecl = dyn_cast<ParmVarDecl>(D))
+    if (!checkFunParamsAreScopedLockable(S, ParmDecl, AL))
+      return;
----------------
AaronBallman wrote:

```suggestion
  if (const auto *ParmDecl = dyn_cast<ParmVarDecl>(D); ParmDecl &&
      !checkFunParamsAreScopedLockable(S, ParmDecl, AL))
    return;
```
Same suggestion applies a few times below as well.

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


More information about the cfe-commits mailing list