[PATCH] D113622: [wip] [analyzer] support ignoring use-after-free checking with reference_counted attribute

Chris D'Angelo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 13 13:11:56 PST 2021


chrisdangelo updated this revision to Diff 394017.
chrisdangelo added a comment.

These changes allow the analyzer to silence an issue discovered by MallocChecker if the SymRef or Statement in question is of a struct that has been declared with the compiler attribute annotation "reference_counted".

In the previous iteration of this diff, SymRef alone was used to determine the declared type, and if it was "reference_counted". Previously, if the SymRef was found to be "reference_counted" an analyzer warning would not be issued.

In the current changes, the static analyzer is more lenient and robust. Now, when a MallocChecker issue is discovered, each node in the bug path is visited, and any use of the pointer in question is checked for its type. If the type is found to be "reference_counted" the bug is marked invalid and ultimately not delivered to the developer. In the current changes, a pointer in question is checked for its type both by using the SymRef and using the type information in the AST.


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

https://reviews.llvm.org/D113622

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113622.394017.patch
Type: text/x-patch
Size: 10962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211213/7302ec93/attachment-0001.bin>


More information about the cfe-commits mailing list