[all-commits] [llvm/llvm-project] 5b012b: [-Wunsafe-buffer-usage] Improving insertion of the...

Ziqing Luo via All-commits all-commits at lists.llvm.org
Fri Jul 14 14:48:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b012bf5ab5fcb840fe7f6c8664b8981ce6f24f3
      https://github.com/llvm/llvm-project/commit/5b012bf5ab5fcb840fe7f6c8664b8981ce6f24f3
  Author: ziqingluo-90 <ziqing at udel.edu>
  Date:   2023-07-14 (Fri, 14 Jul 2023)

  Changed paths:
    M clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
    M clang/lib/Analysis/UnsafeBufferUsage.cpp
    M clang/lib/Sema/AnalysisBasedWarnings.cpp
    A clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-attributes-spelling.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span-overload.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span-qualified-names.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-span.cpp
    M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-parm-unsupported.cpp

  Log Message:
  -----------
  [-Wunsafe-buffer-usage] Improving insertion of the [[clang::unsafe_buffer_usage]] attribute

For a fix-it that inserts the `[[clang::unsafe_buffer_usage]]`
attribute, it will lookup existing macros defined for the attribute
and use the (last defined such) macro directly. Fix-its will use raw
`[[clang::unsafe_buffer_usage]]` if no such macro is defined.

The implementation mimics how a similar machine for the
`[[fallthrough]]` attribute was implemented.

Reviewed by: NoQ (Artem Dergachev)

Differential revision: https://reviews.llvm.org/D150338




More information about the All-commits mailing list