[-Wunsafe-buffer-usage] Filter out conflicting fix-its
authorZiqing Luo <ziqing@udel.edu>
Wed, 8 Feb 2023 00:04:09 +0000 (16:04 -0800)
committerZiqing Luo <ziqing@udel.edu>
Wed, 8 Feb 2023 00:15:28 +0000 (16:15 -0800)
commit692da6245d719fcee9d55936a021d9f9e301c557
treec4e3c2e8f23132ed2711cd448c0dec12f2ff24b7
parentb1d8f40484dfcb28b19c83aa33a674308b17e5dc
[-Wunsafe-buffer-usage] Filter out conflicting fix-its

Two fix-its conflict if they have overlapping source ranges. We shall
not emit conflicting fix-its.  This patch checks conflicts in fix-its
generated for one variable (including variable declaration fix-its and
variable usage fix-its). If there is any, we do NOT emit any fix-it
for that variable.

Reviewed by: NoQ

Differential revision: https://reviews.llvm.org/D141338
clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/unittests/Analysis/CMakeLists.txt
clang/unittests/Analysis/UnsafeBufferUsageTest.cpp [new file with mode: 0644]