llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Ziqing Luo (ziqingluo-90)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/178320.diff


1 Files Affected:

- (modified) clang/include/clang/Basic/Builtins.td (+1-2) 


``````````diff
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*, ...)";
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/178320
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to