[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


================
@@ -1915,6 +1936,101 @@ void BuildLockset::handleCall(const Expr *Exp, const NamedDecl *D,
     }
   }
 
+  std::optional<CallExpr::const_arg_range> Args;
+  if (Exp) {
+    if (const auto *CE = dyn_cast<CallExpr>(Exp))
+      Args = CE->arguments();
+    else if (const auto *CE = dyn_cast<CXXConstructExpr>(Exp))
+      Args = CE->arguments();
+    else
+      llvm_unreachable("Unknown call kind");
+  }
+  const FunctionDecl *CalledFunction = dyn_cast<FunctionDecl>(D);
----------------
AaronBallman wrote:

```suggestion
  const auto *CalledFunction = dyn_cast<FunctionDecl>(D);
```

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


More information about the cfe-commits mailing list