ziqingluo-90 added a comment.

In D137379#4225000 <https://reviews.llvm.org/D137379#4225000>, @manojgupta 
wrote:

> This is firing even in checked length codes, is that expected?

Yes, it is expected.  The unsafe buffer analysis is syntax-based.  The analysis 
warns operations that do not follow the buffer-safe programming model we are 
suggesting.  The programming model prohibits pointer arithmetic.  In the model, 
pointer arithmetic and buffer access can be done using hardened libc++ 
facilities such as `std::span`.

More information about the analysis and the programming model can be found at 
https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734.

To suppress the warning, you can either turn the analysis off using 
`-Wno-unsafe-buffer-usage` or put code in a pair of opt-out pragmas `#pragma 
clang unsafe_buffer_usage begin` & `#pragma clang unsafe_buffer_usage end`


Repository:
  rG LLVM Github Monorepo

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