Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3 |
|
#
fde4b80c |
| 16-Feb-2024 |
jkorous-apple <32549412+jkorous-apple@users.noreply.github.com> |
[-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 "
[-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.
show more ...
|
Revision tags: llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2 |
|
#
87b8c85b |
| 19-Sep-2023 |
Rashmi Mudduluru <r_mudduluru@apple.com> |
[-Wunsafe-bugger-usage] Clean tests: remove nondeterministic ordering
Differential Review: https://reviews.llvm.org/D158553
|
Revision tags: llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5 |
|
#
b7bdf199 |
| 18-May-2023 |
Artem Dergachev <adergachev@apple.com> |
[-Wunsafe-buffer-usage] Hide fixits/suggestions behind an extra flag.
This patch implements a new clang driver flag -fsafe-buffer-usage-suggestions which allows turning the smart suggestion machine
[-Wunsafe-buffer-usage] Hide fixits/suggestions behind an extra flag.
This patch implements a new clang driver flag -fsafe-buffer-usage-suggestions which allows turning the smart suggestion machine on and off (defaults to off). This is valuable for stability reasons, as the machine is being rapidly improved\ and we don't want accidental breakages to ruin the build for innocent users. It is also arguably useful in general because it enables separation of concerns between project contributors: some users will actively update the code to conform to the programming model, while others simply want to make sure that they aren't regressing it. Finally, there could be other valid reasons to opt out of suggestions entirely on some codebases (while continuing to enforce -Wunsafe-buffer-usage warnings), such as lack of access to hardened libc++ (or even to the C++ standard library in general) on the target platform.
When the flag is disabled, the unsafe buffer usage analysis is reduced to an extremely minimal mode of operation that contains virtually no smarts: not only it doesn't offer automatic fixits, but also textual suggestions such as "change the type of this variable to std::span to preserve bounds information" are not displayed, and in fact the machine doesn't even try to blame specific variables in the first place, it simply warns on the operations and leaves everything else to the user. So this flag turns off a lot more of our complex machinery than what we already turn off in presence of say -fno-diagnostic-fixit-info.
The flag is discoverable: when it's off, the warnings are accompanied by a note: telling the user that there's a flag they can use.
Differential Revision: https://reviews.llvm.org/D146669
show more ...
|
Revision tags: llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1 |
|
#
6a0f2e53 |
| 20-Mar-2023 |
ziqingluo-90 <ziqing@udel.edu> |
[-Wunsafe-buffer-usage] Add Fixable for dereference of simple ptr arithmetic
For each expression `e` of the form `*(DRE + n)` (or `*(n + DRE)`), where `DRE` has a pointer type and `n` is an integer
[-Wunsafe-buffer-usage] Add Fixable for dereference of simple ptr arithmetic
For each expression `e` of the form `*(DRE + n)` (or `*(n + DRE)`), where `DRE` has a pointer type and `n` is an integer literal, `e` will be transformed to `DRE[n]` (or `n[DRE]` respectively), if - `e` is at the left-hand side of an assignment or is an lvalue being casted to an rvalue; and - the variable referred by `DRE` is going to be transformed to be of `std::span` type.
Reviewed by: jkorous, NoQ
Differential revision: https://reviews.llvm.org/D142795
show more ...
|