[all-commits] [llvm/llvm-project] 2f4905: [-Wunsafe-buffer-usage] Fix debug notes for unclai...
jkorous-apple via All-commits
all-commits at lists.llvm.org
Tue Feb 6 16:19:59 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2f490583c368627f552c71e340c39f2b55c0526c
https://github.com/llvm/llvm-project/commit/2f490583c368627f552c71e340c39f2b55c0526c
Author: jkorous-apple <32549412+jkorous-apple at users.noreply.github.com>
Date: 2024-02-06 (Tue, 06 Feb 2024)
Changed paths:
M clang/lib/Analysis/UnsafeBufferUsage.cpp
M clang/test/SemaCXX/warn-unsafe-buffer-usage-debug.cpp
Log Message:
-----------
[-Wunsafe-buffer-usage] Fix debug notes for unclaimed DREs (#80787)
Debug notes for unclaimed DeclRefExpr should report any DRE of an unsafe
variable that is not covered by a Fixable (i. e. fixit for the
particular AST pattern isn't implemented for whatever reason). Currently
not all unclaimed DeclRefExpr-s are reported which is a bug. The debug
notes report only those DREs where the referred VarDecl has at least one
other DeclRefExpr which is claimed (covered by a fixit). If there is an
unsafe VarDecl that has exactly one DRE and the DRE isn't claimed then
the debug note about missing fixit won't be emitted. That is because the
debug note is emitted from within a loop over set of successfully
matched FixableGadgets which by-definition is missing those DRE that are
not matched at all.
The new code simply iterates over all unsafe VarDecls and all of their
unclaimed DREs.
More information about the All-commits
mailing list