[clang] [Sema] Suggest missing format attributes (PR #166738)

Vladimir Vuksanovic via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 10 09:14:23 PST 2025


================
@@ -7061,6 +7140,16 @@ bool Sema::CheckFormatArguments(ArrayRef<const Expr *> Args,
       SourceMgr.isInSystemMacro(FormatLoc))
     return false;
 
+  const LangOptions &LO = getLangOpts();
+  if (CallerParamIdx && (LO.GNUMode || LO.C23 || LO.CPlusPlus11))
+    CheckMissingFormatAttributes(this, Type, format_idx, firstDataArg, Args,
+                                 APK, *CallerParamIdx, Loc);
----------------
vvuksanovic wrote:

There is an exception for `strftime` calls which don't emit -Wformat-nonliteral because of the early return on line 7153.

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


More information about the cfe-commits mailing list