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

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 7 10:19: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);
----------------
apple-fcloutier wrote:

Whenever -Wmissing-format-attribute hits, you will _also_ get -Wformat-nonliteral from line 7173, which I think we need to think about.

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


More information about the cfe-commits mailing list