[all-commits] [llvm/llvm-project] fde4b8: [-Wunsafe-buffer-usage] Minimize fixit range for p...
jkorous-apple via All-commits
all-commits at lists.llvm.org
Fri Feb 16 14:25:34 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fde4b80cb772897a8cf0b3d022f3041e10b6e816
https://github.com/llvm/llvm-project/commit/fde4b80cb772897a8cf0b3d022f3041e10b6e816
Author: jkorous-apple <32549412+jkorous-apple at users.noreply.github.com>
Date: 2024-02-16 (Fri, 16 Feb 2024)
Changed paths:
M clang/lib/Analysis/UnsafeBufferUsage.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-add-assign.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-addressof-arraysubscript.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-array-assign-to-ptr.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-array-inits-ptr.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-assign-to-array-subscr-on-ptr.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-deref-simple-ptr-arith.cpp
A clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span-cv-qualifiers.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-local-var-span.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-multi-parm-span.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-pointer-access.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-pointer-arg-to-func-ptr-call.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-pointer-deref.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-pre-increment.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-unevaluated-context.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-fixits-test.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-ptr-init-fixits.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-multi-decl-uuc-fixits.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-fixit.cpp
Log Message:
-----------
[-Wunsafe-buffer-usage] Minimize fixit range for pointer variables (#81935)
Example:
int * const my_var = my_initializer;
Currently when transforming my_var to std::span the fixits:
- replace "int * const my_var = " with "std::span<int> const my_var {"
- add ", SIZE}" after "my_initializer" where SIZE is either inferred or
a placeholder
This patch makes that behavior less intrusive by not modifying variable
cv-qualifiers and initialization syntax.
The new behavior is:
- replace "int *" with "std::span<int>"
- add "{" before "my_initializer"
- add ", SIZE}" after "my_initializer"
This is an improvement on its own - since we don't touch the identifier,
we automatically can handle macros in them.
It also simplifies future work on initializer fixits.
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