[clang] [Clang] Added clang diagnostic when snprintf/vsnprintf uses sizeof(de… (PR #170637)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 5 00:13:11 PST 2025
https://github.com/ojhunt requested changes to this pull request.
I think a better solution here would to be to pull the logic that is diagnosing the same mistake in the memory accessing functions into a separate reusable function - DiagnoseSuspiciousBufferSizeof or something (my naming skills are terrible).
See the logic in Sema::CheckMemaccessArguments where we gate the diagnostics on warn_sizeof_pointer_expr_memaccess being enabled - that's what I think we should be investigating lifting into a separate function that can be used in other similarly behaving functions, either completely or partially.
https://github.com/llvm/llvm-project/pull/170637
More information about the cfe-commits
mailing list