[PATCH] D158561: [-Wunsafe-buffer-usage] Add AST info to the unclaimed DRE debug notes for analysis

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 22 15:55:26 PDT 2023


ziqingluo-90 created this revision.
ziqingluo-90 added reviewers: jkorous, NoQ, t-rasmud, malavikasamak.
Herald added a project: All.
ziqingluo-90 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The debug note for an unclaimed DRE highlights a usage of an unsafe pointer that is not supported by our analysis.

For a better understand of what the unsupported cases are,  we add more information to the debug note---a string of ancestor AST nodes of the unclaimed DRE.    For example, an unclaimed DRE `p` in an expression `*(p++)` will result in a string `DRE, UnaryOperator(++), Paren, UnaryOperator(*)`.

To find out the most common patterns of those unsupported use cases,  we add a simple script to build a prefix tree over those strings and count each prefix.   The script reads input line by line, assumes a line is a list of words separated by `,`s, and builds a prefix tree over those lists.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158561

Files:
  clang/lib/Analysis/UnsafeBufferUsage.cpp
  clang/utils/analyze_safe_buffer_debug_notes.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158561.552520.patch
Type: text/x-patch
Size: 5839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230822/b26a97b2/attachment-0001.bin>


More information about the cfe-commits mailing list