[all-commits] [llvm/llvm-project] 87b580: [-Wunsafe-buffer-usage] Fix-Its transforming `&DRE...
Ziqing Luo via All-commits
all-commits at lists.llvm.org
Tue Apr 4 13:27:11 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 87b5807d3802b932c06d83c4287014872aa2caab
https://github.com/llvm/llvm-project/commit/87b5807d3802b932c06d83c4287014872aa2caab
Author: ziqingluo-90 <ziqing at udel.edu>
Date: 2023-04-04 (Tue, 04 Apr 2023)
Changed paths:
M clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
M clang/include/clang/Analysis/Analyses/UnsafeBufferUsageGadgets.def
M clang/lib/Analysis/UnsafeBufferUsage.cpp
A clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-addressof-arraysubscript.cpp
Log Message:
-----------
[-Wunsafe-buffer-usage] Fix-Its transforming `&DRE[any]` to `&DRE.data()[any]`
For an expression of the form `&DRE[any]` under an Unspecified
Pointer Context (UPC), we generate a fix-it for it with respect to a
strategy. In case the strategy is `std::span` (it is the only supported
one for now), the fix-it replaces the expression with
`&DRE.data()[any]`.
A UPC includes at least the contexts where
- the expression is being casted to an integer; and
- the expression is an argument of a call to a function that is not marked unsafe.
Reviewed by: NoQ, malavikasamak, t-rasmud, jkorous
Differential revision: https://reviews.llvm.org/D143128
More information about the All-commits
mailing list