ziqingluo-90 added inline comments.

================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp:16
+void testArraySubscripts(int *p, int **pp) {
+  foo(p[0],             // expected-warning{{unchecked operation on raw buffer 
in expression}}
+      pp[0][0],         // expected-warning2{{unchecked operation on raw 
buffer in expression}}
----------------
aaron.ballman wrote:
> One test case I'd like to see is: `sizeof(p[0])` -- should code in an 
> unevaluated context be warned?
I think they should NOT be warned. We haven't addressed the issue of 
unevaluated context in our patches. I'm adding a test for code in unevaluated 
context so that we don't forget about it later.


================
Comment at: clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp:43
+}
+
+void testArraySubscriptsWithAuto(int *p, int **pp) {
----------------
aaron.ballman wrote:
> Can you also add tests for function declarations like:
> ```
> void foo(int not_really_an_array[10]) { ... }
> 
> template <int N>
> void bar(int (&actually_an_array)[N]) { ... }
> 
> // Using a dependent type but we know it's a pointer.
> template <typename Ty>
> void baz(Ty *ptr) { ... }
> 
> // Using a dependent type where we have no idea if it's a pointer.
> template <typename Ty>
> void quux(Ty ptr) { ... }
> ```
> 
Thanks for suggesting these test cases. They have been added in one of the 
following patches (https://reviews.llvm.org/D138318). That patch improves the 
matchers to recognize these cases.


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

https://reviews.llvm.org/D137379

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to