[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 11:36:19 PST 2021


chrisdangelo updated this revision to Diff 395726.
chrisdangelo edited the summary of this revision.
chrisdangelo added a comment.

This change removes the previous ownership_takes_param work. This change augments the existing Ownership attribute so that it is now applicable to function parameters.

Theses changes have been used to run the analyzer on a large C / C++ project. The tests have been run locally and successfully with `ninja check-clang-analysis` and `ninja check-clang`.

This diff is functional but is not fully complete. As of this iteration, these are the current tasks unresolved...

1. This change does not fully validate correct usage in SemaDeclAttr.cpp. More can be done to validate that ownership attributes are not used in ways that are in conflict with one another. This conflict can occur with a combination of ownership attributes applied to the function declaration simultaneously with parameter annotations.

2. 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.

3. This change does not test semantic analysis of ownership parameters (malloc-annotations.c).

4. This change does not fully test static analysis of ownership parameters (attr-ownership.c/cpp).


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

https://reviews.llvm.org/D113530

Files:
  clang/include/clang/Basic/Attr.td
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  clang/test/Analysis/malloc-annotations.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113530.395726.patch
Type: text/x-patch
Size: 12288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211221/9dc45b33/attachment.bin>


More information about the cfe-commits mailing list