[clang] 8d4cb92 - [NFC][Clang][Interp] Add more test for `__builtin_os_log_format_buffer_size` (#100566)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 04:34:31 PDT 2024


Author: yronglin
Date: 2024-07-26T19:34:27+08:00
New Revision: 8d4cb92e3536e86b177c354c9c5cf6f06bd61c8d

URL: https://github.com/llvm/llvm-project/commit/8d4cb92e3536e86b177c354c9c5cf6f06bd61c8d
DIFF: https://github.com/llvm/llvm-project/commit/8d4cb92e3536e86b177c354c9c5cf6f06bd61c8d.diff

LOG: [NFC][Clang][Interp] Add more test for `__builtin_os_log_format_buffer_size` (#100566)

Signed-off-by: yronglin <yronglin777 at gmail.com>

Added: 
    

Modified: 
    clang/test/AST/Interp/builtins.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/Interp/builtins.cpp b/clang/test/AST/Interp/builtins.cpp
index a74b68bb9d89b..9b2b20773be58 100644
--- a/clang/test/AST/Interp/builtins.cpp
+++ b/clang/test/AST/Interp/builtins.cpp
@@ -31,3 +31,8 @@ constexpr bool assume() {
   return true;
 }
 static_assert(assume(), "");
+
+void test_builtin_os_log(void *buf, int i, const char *data) {
+  constexpr int len = __builtin_os_log_format_buffer_size("%d %{public}s %{private}.16P", i, data, data);
+  static_assert(len > 0, "Expect len > 0");
+}


        


More information about the cfe-commits mailing list