[PATCH] D113530: [wip] [analyzer] support use-after-free checking with parameter annotation

Chris D'Angelo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 21 17:31:34 PST 2021


chrisdangelo added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:1405
 
-void MallocChecker::checkOwnershipAttr(const CallEvent &Call,
-                                       CheckerContext &C) const {
+static const FunctionDecl *functionDeclForCall(const CallEvent &Call,
+                                               CheckerContext &C) {
----------------
NoQ wrote:
> `Call.getDecl()` is intended to be the ultimate source of truth on this subject.
Thank you. This function definition has been removed and the call-site has changed to...

```
  const Decl *D = Call.getDecl();
  const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
  if (!FD)
    return;
```

... I plan to push the above changes soon to Differential. The tests pass successfully using `ninja check-clang-analysis`.

Previously, `functionDeclForCall` mimicked the existing solution using `const FunctionDecl *FD = C.getCalleeDecl(CE);`. I'm not sure what that existing solution provided differently from `Call.getDecl()`.




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113530/new/

https://reviews.llvm.org/D113530



More information about the cfe-commits mailing list