[PATCH] D138329: [-Wunsafe-buffer-usage] Add a new recursive matcher to replace `forEachDescendant` in unsafe buffer check
Nico Weber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 23 18:12:21 PDT 2023
thakis added a comment.
> ASTMatchers have been baked into clang binary for at least a few years already, actively used by the static analyzer (some backstory in D25429 <https://reviews.llvm.org/D25429>). This warning is, however, probably the first use in clang proper, so they'll be there even if static analyzer support is turned off through cmake flags.
>
> I'm open to a broader discussion. To me it's natural that there exist "analysis-based warnings" that take advantage of advanced analysis tools, and ASTMatchers is just one such tool, definitely not the most expensive one and not the most hazardous one (CFG and flow-sensitive analysis are arguably much scarier in both regards, and they're actively used in essential warnings such as `-Wuninitialized`).
This has been discussed extensively when ASTMatchers were introduced. Project leadership back then (Doug Gregor and iirc Richard Smith) thought ASTMatches weren't a great approach and agreed to have them merged only if they aren't used in clang itself, but only in clang-tools-extra.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138329/new/
https://reviews.llvm.org/D138329
More information about the cfe-commits
mailing list