diff options
author | jkorous-apple <32549412+jkorous-apple@users.noreply.github.com> | 2024-02-16 14:25:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-16 14:25:21 -0800 |
commit | fde4b80cb772897a8cf0b3d022f3041e10b6e816 (patch) | |
tree | 4f3cfb10ceedc8e5f89e99bd7855c2f0c04769c9 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | b3050f518cc57e064ab6b3f17fb00534bd5b85d6 (diff) | |
download | llvm-fde4b80cb772897a8cf0b3d022f3041e10b6e816.zip llvm-fde4b80cb772897a8cf0b3d022f3041e10b6e816.tar.gz llvm-fde4b80cb772897a8cf0b3d022f3041e10b6e816.tar.bz2 |
[-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.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions