[-Wunsafe-buffer-usage] Fixits for assignments to array subscript expressions
authorZiqing Luo <ziqing@udel.edu>
Thu, 23 Feb 2023 22:53:43 +0000 (14:53 -0800)
committerZiqing Luo <ziqing@udel.edu>
Thu, 23 Feb 2023 23:02:46 +0000 (15:02 -0800)
commitcd2652963b6b97c01329419f15c336e5560afa98
tree04f00e08898e0f7fb1ae948432c2229055d6ece9
parentc8b37e48f6f00bb2aa3882ca3cc26082f85ca999
[-Wunsafe-buffer-usage] Fixits for assignments to array subscript expressions

Let generate fix-its to make assignments' left-hand side of the form
`dre[e]` safe if `e` is known to be non-negative.

Commit on behalf of jkorous (Jan Korous)

Reviewed by: NoQ (Artem Dergachev)

Differential revision: https://reviews.llvm.org/D142794
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-assign-to-array-subscr-on-ptr.cpp [new file with mode: 0644]