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

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Thu Mar 7 11:26:36 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
----------------
nickdesaulniers wrote:

AFAIK, llvm-libc doesn't yet have testing frameworks in place to do what @pogo59 is suggesting.  It may be useful to have at some point in the future, but I would say for right now, I struggle to think of additional cases where that would be useful.  I sure that view will change over time and use cases for doing so will only grow, so we may end up eventually integrating some unit tests that make use of `llvm-lit` in the future.  Because of the minimal need at the moment, I would say it's lower priority than say implementation work.  When we have such testing framework in place, we should revisit verifying this invariant.

Perhaps for now:
1. file a todo in llvm's issue tracker mentioning that we might want to pursue using llvm-lit to do some binary analysis testing of llvmlibc.
2. link to it from this unit test

Over time, more use cases will be added to the issue which will help us reprioritize.

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


More information about the libc-commits mailing list