[clang] [clang-tools-extra] [clang][analyzer] Add ReportInC99AndEarlier option to DeprecatedOrUnsafeBuf… (PR #168704)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 9 05:25:05 PST 2026


================
@@ -754,7 +760,22 @@ void WalkAST::checkDeprecatedOrUnsafeBufferHandling(const CallExpr *CE,
   if (!filter.check_DeprecatedOrUnsafeBufferHandling)
     return;
 
-  if (!BR.getContext().getLangOpts().C11)
+  const bool ShouldReport = [this] {
+    const bool IsAnnexKAvailable = analysis::isAnnexKAvailable(
+        &BR.getPreprocessor(), BR.getContext().getLangOpts());
+    const bool IsC11OrLaterStandard = BR.getContext().getLangOpts().C11;
----------------
steakhal wrote:

A walker is constructed inside the `checkASTCodeBody` which is per fn definition; so it's not cached per TU, but rather per definition - which is different.

https://github.com/llvm/llvm-project/pull/168704


More information about the cfe-commits mailing list