[PATCH] D157441: [-Wunsafe-buffer-usage] Use `Strategy` to determine whether to fix a parameter

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 24 13:14:19 PDT 2023


ziqingluo-90 updated this revision to Diff 553226.
ziqingluo-90 marked an inline comment as done.
ziqingluo-90 edited the summary of this revision.
ziqingluo-90 added a comment.

In our offline discussion, we realized that `p = q.data()` is not always a correct fix to `p = q` for cases where only `q` is an unsafe pointer.  It depends on whether `p` is being dereferenced later.  So I removed my changes to `PointerAssignmentGadget` and `PointerInitGadget`.

Note there are many tests adjusted due to the fact that now `p = q` cannot be fixed if only `q` is unsafe (previously incorrect fix-it was provided, so it is not a regression).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157441/new/

https://reviews.llvm.org/D157441

Files:
  clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
  clang/lib/Analysis/UnsafeBufferUsage.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-multi-parm-span.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-fixits-test.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-ptr-init-fixits.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-ptr-init.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-uuc-fixits.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-uuc.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-warnings.cpp
  clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-fixit.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157441.553226.patch
Type: text/x-patch
Size: 30136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230824/f7bc72d2/attachment-0001.bin>


More information about the cfe-commits mailing list