[clang] [NFC][Clang][Interp] Add more test for `__builtin_os_log_format_buffer_size` (PR #100566)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 25 07:12:06 PDT 2024
yronglin wrote:
> Did you check locally that this works with sanitizers enabled?
Yeah, the memory leak issue in https://github.com/llvm/llvm-project/pull/99895 seems to be caused by other floating point builtins in clang/test/CodeGen/builtins.c. The new examples added in this PR do not have any floating point operations. And I've verifyed in my local with address sanitizer enabled.
Clang build with:
```
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;compiler-rt;libunwind" -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_C_FLAGS="-fsanitize=address" -DCMAKE_CXX_FLAGS="-fsanitize=address" -DLLVM_USE_SANITIZER=Address ../llvm-project/llvm
```
```
➜ test cat os_format.cpp
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");
}
➜ test ../rel/bin/clang++ -c -fexperimental-new-constant-interpreter ./os_format.cpp
➜ test
```
https://github.com/llvm/llvm-project/pull/100566
More information about the cfe-commits
mailing list