[all-commits] [llvm/llvm-project] 294367: [NFC][-Wunsafe-buffer-usage] Refactor safe pattern...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Tue Jul 15 01:48:42 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 29436737baf8675ec98c8f738e291acb44eacd85
      https://github.com/llvm/llvm-project/commit/29436737baf8675ec98c8f738e291acb44eacd85
  Author: Ziqing Luo <ziqing at udel.edu>
  Date:   2025-07-15 (Tue, 15 Jul 2025)

  Changed paths:
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-libc-functions.cpp

  Log Message:
  -----------
  [NFC][-Wunsafe-buffer-usage] Refactor safe pattern check for pointer-size pairs (#145626)

Refactor the safe pattern analysis of pointer and size expression pairs
so that the check can be re-used in more places. For example, it can be
used to check whether the following cases are safe:
- `std::span<T>{ptr, size}        // span construction`
- `snprintf(ptr, size, "%s", ...)  // unsafe libc call`
- `printf("%.*s", size, ptr)        // unsafe libc call`



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list