[libc-commits] [libc] [libc] Expand usage of libc null checks. (PR #116262)

via libc-commits libc-commits at lists.llvm.org
Sun Dec 22 14:18:53 PST 2024


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 ce25bd20dc56cef651170f1ee5820758dee415a2 2c4f2592b0b9d5d3137cb69b577110da7bdb95bb --extensions h,cpp -- libc/src/string/memchr.cpp libc/src/string/memcmp.cpp libc/src/string/memcpy.cpp libc/src/string/memmove.cpp libc/src/string/memory_utils/inline_strcmp.h libc/src/string/memory_utils/inline_strstr.h libc/src/string/mempcpy.cpp libc/src/string/memrchr.cpp libc/src/string/memset.cpp libc/src/string/stpncpy.cpp libc/src/string/strcat.cpp libc/src/string/strcoll.cpp libc/src/string/strcoll_l.cpp libc/src/string/strcpy.cpp libc/src/string/string_utils.h libc/src/string/strncpy.cpp libc/src/string/strsep.cpp libc/src/string/strspn.cpp libc/src/strings/rindex.cpp libc/test/src/string/memchr_test.cpp libc/test/src/string/memcmp_test.cpp libc/test/src/string/memcpy_test.cpp libc/test/src/string/mempcpy_test.cpp libc/test/src/string/memrchr_test.cpp libc/test/src/string/stpncpy_test.cpp libc/test/src/string/strcat_test.cpp libc/test/src/string/strcoll_test.cpp libc/test/src/string/strcpy_test.cpp libc/test/src/string/strlcpy_test.cpp libc/test/src/string/strsep_test.cpp libc/test/src/string/strspn_test.cpp
``````````

</details>

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

``````````diff
diff --git a/libc/test/src/string/memcpy_test.cpp b/libc/test/src/string/memcpy_test.cpp
index 20e01ec8f6..fdab181506 100644
--- a/libc/test/src/string/memcpy_test.cpp
+++ b/libc/test/src/string/memcpy_test.cpp
@@ -74,7 +74,7 @@ TEST(LlvmLibcMemcpyTest, CheckAccess) {
 #endif // !defined(LIBC_FULL_BUILD) && defined(LIBC_TARGET_OS_IS_LINUX)
 
 TEST(LlvmLibcMemcpyTest, CrashOnNullPtr) {
-  ASSERT_DEATH([](){LIBC_NAMESPACE::memcpy(nullptr, nullptr, 1);},
+  ASSERT_DEATH([]() { LIBC_NAMESPACE::memcpy(nullptr, nullptr, 1); },
                WITH_SIGNAL(SIGSEGV));
 }
 

``````````

</details>


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


More information about the libc-commits mailing list