[libc-commits] [libc] Create a poor-developer's msan for libc wide read functions. (PR #170586)

via libc-commits libc-commits at lists.llvm.org
Thu Dec 4 09:49:35 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- libc/test/src/strings/wide_read_memory_test.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/test/src/strings/wide_read_memory_test.cpp b/libc/test/src/strings/wide_read_memory_test.cpp
index e353d49dd..5e2e02bb9 100644
--- a/libc/test/src/strings/wide_read_memory_test.cpp
+++ b/libc/test/src/strings/wide_read_memory_test.cpp
@@ -27,14 +27,13 @@
 
 namespace LIBC_NAMESPACE_DECL {
 
-
 class LlvmLibcWideAccessMemoryTest : public testing::Test {
   char *page0_;
   char *page1_;
   char *page2_;
   size_t page_size;
 
- public:
+public:
   void SetUp() override {
     page_size = getpagesize();
     page0_ =
@@ -65,7 +64,7 @@ class LlvmLibcWideAccessMemoryTest : public testing::Test {
   // 512-byte arrays. The termination condition, eg, end-of string or character
   // being searched for, should be near the end of the data.
   template <typename TestFunc>
-  void TestMemoryAccess(const std::vector<char>& buf, TestFunc func) {
+  void TestMemoryAccess(const std::vector<char> &buf, TestFunc func) {
     // Run func on data near the start boundary of valid memory.
     for (unsigned long offset = 0;
          offset < std::alignment_of<std::max_align_t>::value; ++offset) {
@@ -76,7 +75,7 @@ class LlvmLibcWideAccessMemoryTest : public testing::Test {
     // Run func on data near the end boundary of valid memory.
     for (unsigned long offset = 0;
          offset < std::alignment_of<std::max_align_t>::value; ++offset) {
-      char *test_addr = page2_  - buf.size() - offset - 1;
+      char *test_addr = page2_ - buf.size() - offset - 1;
       assert(test_addr + buf.size() < page2_);
       BasicMemCopy(test_addr, buf.data(), buf.size());
       func(test_addr);
@@ -89,10 +88,10 @@ TEST_F(LlvmLibcWideAccessMemoryTest, StringLength) {
   std::vector<char> buf(1536, 'a');
   // Make sure it is null terminated.
   buf.push_back('\0');
-  this->TestMemoryAccess(buf, [this, buf](const char* test_data) {
+  this->TestMemoryAccess(buf, [this, buf](const char *test_data) {
     // -1 for the null character.
     ASSERT_EQ(internal::string_length(test_data), size_t(buf.size() - 1));
   });
 }
 
-}
+} // namespace LIBC_NAMESPACE_DECL

``````````

</details>


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


More information about the libc-commits mailing list