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

Vladimir Vuksanovic via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 17 07:34:28 PST 2025


================
@@ -7001,6 +7005,85 @@ bool Sema::CheckFormatString(const FormatMatchesAttr *Format,
   return false;
 }
 
+static void CheckMissingFormatAttributes(Sema *S, FormatStringType FormatType,
+                                         unsigned FormatIdx, unsigned FirstArg,
+                                         ArrayRef<const Expr *> Args,
+                                         Sema::FormatArgumentPassingKind APK,
+                                         unsigned CallerParamIdx,
+                                         SourceLocation Loc) {
+  const FunctionDecl *Caller = S->getCurFunctionDecl();
+  if (!Caller)
+    return;
----------------
vvuksanovic wrote:

Added support for Objective-C. Let me know if there are other cases I should test. Also, I wasn't sure which attribute syntax is supported, so I used the GNU extension.

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


More information about the cfe-commits mailing list