[PATCH] D144304: [-Wunsafe-buffer-usage] Add a Fixable for pointer pre-increment

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 4 13:12:57 PDT 2023


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

LGTM!



================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-addressof-arraysubscript.cpp:19
   bool a = (bool) &p[5];
-  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:19-[[@LINE-1]]:24}:"(p.data() + 5)"
+  // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:19-[[@LINE-1]]:24}:"&p.data()[5]"
   bool b = (bool) &p[x];
----------------
These changes look unrelated, probably accidentally included from another patch 🤔


================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp:37
 
-void testArraySubscripts(int *p, int **pp) {
+void testArraySubscripts(int *p, int **pp) { // expected-note{{change type of 'pp' to 'std::span' to preserve bounds information}}
 // expected-warning at -1{{'p' is an unsafe pointer used for buffer access}}
----------------
These also seem unrelated.


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

https://reviews.llvm.org/D144304



More information about the cfe-commits mailing list