================ @@ -435,6 +435,86 @@ bool Sema::ConstantFoldAttrArgs(const AttributeCommonInfo &CI, return true; } +// Warn if parent function does not have builtin function format attribute. +void Sema::DiagnoseMissingFormatAttributes(NamedDecl *FDecl, + SourceLocation Loc) { + if (!FDecl) + return; + + auto *FD = dyn_cast_or_null<FunctionDecl>(FDecl); + if (!FD) + return; + + unsigned BuiltinID = FD->getBuiltinID(/*ConsiderWrappers=*/true); + + // Function is not builtin if it's builtin ID is 0. + if (!BuiltinID) + return; ---------------- aaronpuchert wrote:
What about calling a regular function that also has a `format` attribute? The GCC warning catches that as well. https://github.com/llvm/llvm-project/pull/70024 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits