[PATCH] D153059: [-Wunsafe-buffer-usage] Group parameter fix-its

Ziqing Luo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 17:25:36 PDT 2023


ziqingluo-90 added inline comments.


================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-multi-parm-span.cpp:37-39
+// CHECK: fix-it:{{.*}}:{[[@LINE+3]]:24-[[@LINE+3]]:30}:"std::span<int> p"
+// CHECK: fix-it:{{.*}}:{[[@LINE+2]]:32-[[@LINE+2]]:39}:"std::span<int *> q"
+// CHECK: fix-it:{{.*}}:{[[@LINE+1]]:41-[[@LINE+1]]:48}:"std::span<int> a"
----------------
NoQ wrote:
> The fix is emitted 3 times right? Once for each warning?
> 
> Would it make sense to duplicate the three `CHECK:` lines three times to confirm that?
I wish there are better ways to test this.  I tried `CHECK-COUNT-3` but it doesn't work because it expects each line repeats 3 times consecutively.


================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-multi-parm-span.cpp:306
+  b[5] = 5; // expected-note{{used in buffer access here}}
+}
----------------
t-rasmud wrote:
> Can we have a test case with qualifiers on parameters and maybe another with a qualifier on the function itself?
good point.  I recently added such tests for parameters and local variables in following open patches:

- https://reviews.llvm.org/D156189 : clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp:49--62

- https://reviews.llvm.org/D156188 : clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp:150--198


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

https://reviews.llvm.org/D153059



More information about the cfe-commits mailing list