[libc-commits] [libc] [libc][c23] add memset_explicit (PR #83577)

Paul T Robinson via libc-commits libc-commits at lists.llvm.org
Thu Mar 7 08:18:40 PST 2024


================
@@ -0,0 +1,31 @@
+//===-- Unittests for memset_explicit -------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "memory_utils/memory_check_utils.h"
+#include "src/string/memset_explicit.h"
+#include "test/UnitTest/Test.h"
+
+namespace LIBC_NAMESPACE {
+
+// Apply the same tests as memset
----------------
pogo59 wrote:

That seems inadequate. The idea is that `memset_explicit` works in situations where `memset` does not, so that's the functionality that really needs testing. Probably you need a lit test that shows `memset` is optimized away but `memset_explicit` is not. Or something like that.

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


More information about the libc-commits mailing list