-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[libc] clean up string_utils memory functions #143031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] clean up string_utils memory functions #143031
Conversation
The string_utils.h file previously included both memcpy and bzero. There were no uses of bzero, and only one use of memcpy which was replaced with __builtin_memcpy.
|
@llvm/pr-subscribers-libc Author: Michael Jones (michaelrj-google) ChangesThe string_utils.h file previously included both memcpy and bzero. There Full diff: https://github.com/llvm/llvm-project/pull/143031.diff 3 Files Affected:
diff --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt
index 2c607bf8ea895..deb74d979a3f7 100644
--- a/libc/src/string/CMakeLists.txt
+++ b/libc/src/string/CMakeLists.txt
@@ -15,10 +15,7 @@ add_header_library(
HDRS
string_utils.h
DEPENDS
- .memory_utils.inline_bzero
- .memory_utils.inline_memcpy
libc.hdr.types.size_t
- libc.include.stdlib
libc.src.__support.CPP.bitset
libc.src.__support.CPP.type_traits
libc.src.__support.common
diff --git a/libc/src/string/string_utils.h b/libc/src/string/string_utils.h
index e4659f65c93e2..e666636632184 100644
--- a/libc/src/string/string_utils.h
+++ b/libc/src/string/string_utils.h
@@ -19,8 +19,6 @@
#include "src/__support/CPP/type_traits.h" // cpp::is_same_v
#include "src/__support/macros/config.h"
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
-#include "src/string/memory_utils/inline_bzero.h"
-#include "src/string/memory_utils/inline_memcpy.h"
namespace LIBC_NAMESPACE_DECL {
namespace internal {
@@ -220,7 +218,7 @@ LIBC_INLINE size_t strlcpy(char *__restrict dst, const char *__restrict src,
if (!size)
return len;
size_t n = len < size - 1 ? len : size - 1;
- inline_memcpy(dst, src, n);
+ __builtin_memcpy(dst, src, n);
dst[n] = '\0';
return len;
}
diff --git a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
index aa7f0a9389405..65e6a947eaed6 100644
--- a/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/libc/BUILD.bazel
@@ -4190,7 +4190,6 @@ libc_support_library(
":__support_cpp_bitset",
":__support_macros_optimization",
":llvm_libc_types_size_t",
- ":string_memory_utils",
":types_size_t",
],
)
|
|
thanks for the review, going to merge once the presubmits pass |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/6844 Here is the relevant piece of the build log for the reference |
|
Hi there, this PR had build failure that breaks our buildbots. Could you please take a look. Thanks! |
|
Hi @michaelrj-google, it seems the fix build successfully but failed a check. Appreciated if you could take another look.
buildbot: https://lab.llvm.org/buildbot/#/builders/10/builds/6850 |
This reverts commit 59f88a8.
The string_utils.h file previously included both memcpy and bzero. There were no uses of bzero, and only one use of memcpy which was replaced with __builtin_memcpy. Also fix strsep which was broken by this change, fix a useless assert of "sizeof(char) == sizeof(cpp::byte)", and update the bazel.
The string_utils.h file previously included both memcpy and bzero. There
were no uses of bzero, and only one use of memcpy which was replaced
with __builtin_memcpy.
Also fix strsep which was broken by this change, fix a useless assert of
"sizeof(char) == sizeof(cpp::byte)", and update the bazel.