https://github.com/ziqingluo-90 created https://github.com/llvm/llvm-project/pull/178320
The format string is the 2nd argument of __builtin_os_log_format, thus has index 1 instead of 0 in 0-based indexing. The incorrect format attribute argument causes false positive -Wunsafe-buffer-usage-in-format-attr-call warnings. rdar://169043228 >From d3ad7ac147634500c15c92ef9cf9b1bb0356da1f Mon Sep 17 00:00:00 2001 From: Ziqing Luo <[email protected]> Date: Tue, 27 Jan 2026 15:41:48 -0800 Subject: [PATCH] [clang] __builtin_os_log_format has incorrect PrintfFormat Attribute argument The incorrect format attribute argument causes false positive -Wunsafe-buffer-usage-in-format-attr-call warnings. The format string is the 2nd argument of __builtin_os_log_format, thus has index 1 in 0-based indexing. rdar://169043228 --- clang/include/clang/Basic/Builtins.td | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td index dcf07d659cb15..1bfee45feb84f 100644 --- a/clang/include/clang/Basic/Builtins.td +++ b/clang/include/clang/Basic/Builtins.td @@ -4970,8 +4970,7 @@ def OSLogFormatBufferSize : Builtin { def OSLogFormat : Builtin { let Spellings = ["__builtin_os_log_format"]; - // FIXME: The printf attribute looks suspiciously like it should be argument #1. - let Attributes = [PrintfFormat<0>, NoThrow, CustomTypeChecking]; + let Attributes = [PrintfFormat<1>, NoThrow, CustomTypeChecking]; let Prototype = "void*(void*, char const*, ...)"; } _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
