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

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 21 12:28:43 PST 2021


NoQ added a comment.

I'm really glad it actually works!

> We are interested in deprecating the use of function based ownership attributes in favor of using function parameter annotations. This change does not currently provide deprecation warnings.

Do we also need to convert `ownership_holds` to parameter attribute? I think it doesn't make sense to deprecate until we convert all of them.

> This change does not fully test static analysis of ownership parameters (malloc-annotations.c).

I think it makes sense to simply copy that file and replace function attributes with parameter attributes and see if it still passes.



================
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) {
----------------
`Call.getDecl()` is intended to be the ultimate source of truth on this subject.


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

https://reviews.llvm.org/D113530



More information about the cfe-commits mailing list