[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


================
@@ -418,6 +431,18 @@ static void checkAttrArgsAreCapabilityObjs(Sema &S, Decl *D,
   }
 }
 
+static bool checkFunParamsAreScopedLockable(Sema &S,
+                                            const ParmVarDecl *ParamDecl,
+                                            const ParsedAttr &AL) {
+  QualType ParamType = ParamDecl->getType();
+  if (const auto *RefType = ParamType->getAs<ReferenceType>())
+    if (checkRecordTypeForScopedCapability(S, RefType->getPointeeType()))
+      return true;
----------------
AaronBallman wrote:

```suggestion
  if (const auto *RefType = ParamType->getAs<ReferenceType>(); RefType &&
      checkRecordTypeForScopedCapability(S, RefType->getPointeeType()))
    return true;
```

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


More information about the cfe-commits mailing list