[all-commits] [llvm/llvm-project] 1e270b: [-Wunsafe-buffer-usage] Add fix-its for function p...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Fri Jun 9 15:55:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1e270be0886c3a770e7a967679552a02dfc1dca9
      https://github.com/llvm/llvm-project/commit/1e270be0886c3a770e7a967679552a02dfc1dca9
  Author: ziqingluo-90 <ziqing at udel.edu>
  Date:   2023-06-09 (Fri, 09 Jun 2023)

  Changed paths:
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-main.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span-overload.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span-qualified-names.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-unsupported.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Add fix-its for function parameters using the `span` strategy

Generate fix-its for function parameters that are raw pointers used
unsafely.  Currently, the analyzer fixes one parameter at a time.

Fix-its for a function parameter includes:

- Fix the parameter declaration of the definition, result in a new
  overload of the function. We call the function with the original
  signature the old overload.
- For any other existing declaration of the old overload, mark it with
  the [[unsafe_buffer_usage]] attribute and generate a new overload
  declaration next to it.
- Creates a new definition for the old overload, which is simply
  defined by a call to the new overload.

Reviewed by: NoQ (Artem Dergachev), t-rasmud (Rashmi Mudduluru), and
             jkorous (Jan Korous)

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




More information about the All-commits mailing list