[all-commits] [llvm/llvm-project] a43235: [-Wunsafe-buffer-usage] Add AST info to the unclai...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Fri Oct 20 14:29:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a4323586fcbb20f39f00d5d1bc4a94a1aeea15c4
      https://github.com/llvm/llvm-project/commit/a4323586fcbb20f39f00d5d1bc4a94a1aeea15c4
  Author: ziqingluo-90 <ziqing at udel.edu>
  Date:   2023-10-20 (Fri, 20 Oct 2023)

  Changed paths:
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-debug-unclaimed/lit.local.cfg
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-debug-unclaimed/warn-unsafe-buffer-usage-debug-unclaimed.cpp
    A clang/utils/analyze_safe_buffer_debug_notes.py

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Add AST info to the unclaimed DRE debug notes for 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 starting with
  `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.

Reviewed by: t-rasmud (Rashmi Mudduluru), NoQ (Artem Dergachev)

Differential revision: https://reviews.llvm.org/D158561




More information about the All-commits mailing list