[-Wunsafe-buffer-usage] Add an unsafe gadget for pointer-arithmetic operations
authorZiqing Luo <ziqing@udel.edu>
Thu, 5 Jan 2023 00:48:55 +0000 (16:48 -0800)
committerZiqing Luo <ziqing@udel.edu>
Thu, 5 Jan 2023 00:50:21 +0000 (16:50 -0800)
commitf84f17c489f7cb84d72e84a6b1b6c54bd8d52717
tree0c5b16108fec33e5b5578158ec23071167fff2c3
parent0dc7ecb1a70ec9f6eb41ebb4d1edf5d2acdfb4ce
[-Wunsafe-buffer-usage] Add an unsafe gadget for pointer-arithmetic operations

For -Wunsafe-buffer-usage diagnostics, we want to warn about pointer
arithmetics since resulting pointers can be used to access buffers.
Therefore, I add an `UnsafeGadget` representing general pointer
arithmetic operations.

Reviewed by: NoQ
Differential revision: https://reviews.llvm.org/D139233
clang/include/clang/Analysis/Analyses/UnsafeBufferUsageGadgets.def
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp