[libcxx-commits] [clang] [libcxx] [libc++] Add builtin to clear padding bytes (prework for P0528R3) (PR #75371)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 14 08:29:59 PDT 2024


================
@@ -0,0 +1,807 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// UNSUPPORTED: c++03
----------------
ldionne wrote:

@efriedma-quic There's a question of where this test should live. IIUC LLVM usually tests stuff by looking at the code that gets generated and using `FileCheck`. However, this test is different in that it actually runs on the target and ensures that we have the right behavior. This is quite nice and it's definitely how we would want to test that from the library side.

However, there is no user-facing facility exposed by C++ for this builtin, so I'm thinking it doesn't really belong under `libcxx/test/`. Is there precedent for these kinds of runtime tests in LLVM codegen?

Otherwise, one thing we could potentially do is define an internal libc++ helper like `__libcpp_clear_padding` and keep these tests under `libcxx/test/libcxx`. We'd still want to make sure that the tests for the builtin under `clang/test` are sufficient, though.

https://github.com/llvm/llvm-project/pull/75371


More information about the libcxx-commits mailing list