[-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable...
authorZiqing Luo <ziqing@udel.edu>
Wed, 4 Jan 2023 23:51:56 +0000 (15:51 -0800)
committerZiqing Luo <ziqing@udel.edu>
Wed, 4 Jan 2023 23:51:56 +0000 (15:51 -0800)
commitb2ac5fd724c44cf662caed84bd8f84af574b981d
tree7e0bebf724edd6b489758a4f1560b6a2424536bc
parent733740b18936364f20d9858e3a6f08855ec66b8b
[-Wunsafe-buffer-usage] Add a new `forEachDescendant` matcher that skips callable declarations

Note this is a change local to -Wunsafe-buffer-usage checks.

Add a new matcher `forEveryDescendant` that recursively matches
descendants of a `Stmt` but skips nested callable definitions.  This
matcher has same effect as using `forEachDescendant` and skipping
`forCallable` explicitly but does not require the AST construction to be
complete.

Reviewed by: NoQ, xazax.hun

Differential revision: https://reviews.llvm.org/D138329
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/test/SemaCXX/warn-unsafe-buffer-usage.cpp