[clang] [Sema] Suggest missing format attributes (PR #166738)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 26 11:12:24 PST 2025
================
@@ -7093,9 +7105,143 @@ bool Sema::CheckFormatString(const FormatMatchesAttr *Format,
return false;
}
+static bool CheckMissingFormatAttribute(
+ Sema *S, ArrayRef<const Expr *> Args, Sema::FormatArgumentPassingKind APK,
+ StringLiteral *ReferenceFormatString, unsigned FormatIdx,
+ unsigned FirstDataArg, FormatStringType FormatType, unsigned CallerParamIdx,
+ SourceLocation Loc) {
+ if (S->getDiagnostics().isIgnored(diag::warn_missing_format_attribute,
+ SourceLocation()))
----------------
apple-fcloutier wrote:
This needs to use an appropriate source location, or else the check will pass if the diagnostic is enabled on the command line but disabled by a `#pragma gcc diagnostic ignored` region. Isn't `Loc` the source location of the call?
https://github.com/llvm/llvm-project/pull/166738
More information about the cfe-commits
mailing list