Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6
# 9c50182b 12-Dec-2024 Malavika Samak <malavika.samak@gmail.com>

[-Wunsafe-buffer-usage] Suppress warning for multi-dimensional constant arrays (#118249)

Do not warn about unsafe buffer access, when multi-dimensional constant
arrays are accessed and their indice

[-Wunsafe-buffer-usage] Suppress warning for multi-dimensional constant arrays (#118249)

Do not warn about unsafe buffer access, when multi-dimensional constant
arrays are accessed and their indices are within the bounds of the
buffer. Warning in such cases would be a false positive. Such a
suppression already exists for 1-d
arrays and it is now extended to multi-dimensional arrays.

(rdar://137926311)
(rdar://140320139)

Co-authored-by: MalavikaSamak <malavika2@apple.com>

show more ...


Revision tags: llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, 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, 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, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3
# 41279e87 17-Aug-2023 Ziqing Luo <ziqing@udel.edu>

[-Wunsafe-buffer-usage] Refactor and improve for parameter fix-its

- Factor out the code that will be shared by both parameter and local variable fix-its
- Add a check to ensure that a TypeLoc::isNu

[-Wunsafe-buffer-usage] Refactor and improve for parameter fix-its

- Factor out the code that will be shared by both parameter and local variable fix-its
- Add a check to ensure that a TypeLoc::isNull is false before using the TypeLoc
- Remove the special check for whether a fixing variable involves unnamed types. This check is unnecessary now.
- Move tests for cv-qualified parameters and unnamed types out of the "...-unsupported.cpp" test file.

Reviewed by: NoQ (Artem Dergachev)

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

show more ...


Revision tags: llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# a6302b69 19-Jul-2023 ziqingluo-90 <ziqing@udel.edu>

[-Wunsafe-buffer-usage] Check source location validity before using `TypeLoc`s

The safe-buffer analysis analyzes TypeLocs of types of variable
declarations in order to get source locations of them.

[-Wunsafe-buffer-usage] Check source location validity before using `TypeLoc`s

The safe-buffer analysis analyzes TypeLocs of types of variable
declarations in order to get source locations of them.

However, in some cases, the source locations of a TypeLoc are not
valid. Using invalid source locations results in assertion violation
or incorrect analysis or fix-its.

It is still not clear to me in what circumstances a TypeLoc does not
have valid source locations (it looks like a bug in Clang to me, but
it is not our responsibility to fix it). So we will conservatively
give up the analysis when required source locations are not valid.

Reviewed By: NoQ (Artem Dergachev)

Differential Revision: https://reviews.llvm.org/D155667

show more ...


# a07a6f6c 15-Jul-2023 ziqingluo-90 <ziqing@udel.edu>

Re-land "5b012bf5ab5fcb840fe7f6c8664b8981ce6f24f3"

Removed dependency on `clangSema` from UnsafeBufferAnalysis.


# c915908f 15-Jul-2023 NAKAMURA Takumi <geek4civic@gmail.com>

Revert D150338, "[-Wunsafe-buffer-usage] Improving insertion of the [[clang::unsafe_buffer_usage]] attribute"

clangAnalysis should not depend on clangSema.

This reverts commit 5b012bf5ab5fcb840fe7f

Revert D150338, "[-Wunsafe-buffer-usage] Improving insertion of the [[clang::unsafe_buffer_usage]] attribute"

clangAnalysis should not depend on clangSema.

This reverts commit 5b012bf5ab5fcb840fe7f6c8664b8981ce6f24f3.

show more ...


# 5b012bf5 14-Jul-2023 ziqingluo-90 <ziqing@udel.edu>

[-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 d

[-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

show more ...


Revision tags: llvmorg-16.0.6
# 1e270be0 09-Jun-2023 ziqingluo-90 <ziqing@udel.edu>

[-Wunsafe-buffer-usage] Add fix-its for function parameters using the `span` strategy

Generate fix-its for function parameters that are raw pointers used
unsafely. Currently, the analyzer fixes one

[-Wunsafe-buffer-usage] Add fix-its for function parameters using the `span` strategy

Generate fix-its for function parameters that are raw pointers used
unsafely. Currently, the analyzer fixes one parameter at a time.

Fix-its for a function parameter includes:

- Fix the parameter declaration of the definition, result in a new
overload of the function. We call the function with the original
signature the old overload.
- For any other existing declaration of the old overload, mark it with
the [[unsafe_buffer_usage]] attribute and generate a new overload
declaration next to it.
- Creates a new definition for the old overload, which is simply
defined by a call to the new overload.

Reviewed by: NoQ (Artem Dergachev), t-rasmud (Rashmi Mudduluru), and
jkorous (Jan Korous)

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

show more ...