summaryrefslogtreecommitdiff
path: root/libc/src/string/strdup.cpp
AgeCommit message (Collapse)Author
2025-06-11[libc] Move libc_errno.h to libc/src/__support and make ↵lntue
LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2024-11-01[libc] Remove the #include <stdlib.h> header (#114453)Job Henandez Lara
2024-07-12[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)Petr Hosek
This is a part of #97655.
2024-07-12Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace ↵Mehdi Amini
declaration" (#98593) Reverts llvm/llvm-project#98075 bots are broken
2024-07-11[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)Petr Hosek
This is a part of #97655.
2023-09-26[libc] Mass replace enclosing namespace (#67032)Guillaume Chatelet
This is step 4 of https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079
2023-07-19[libc][NFC] Rename filesGuillaume Chatelet
This patch mostly renames files so it better reflects the function they declare. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D155607
2023-02-28[libc][NFC] Refactor internal errno.Siva Chandra Reddy
This is in preparation for the transition to a solution to make libc tests hermetic with respect to their use of errno. The implementation of strdup has been switched over to libc_errno as an example of what the code looks like in the new way. See #61037 for more information. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D144928
2022-12-11[libc] Add custom operator new to handle allocation failures gracefully.Siva Chandra Reddy
This patch adds the implementation of the custom operator new functions. The implementation of the internal strdup has been updated to use operator new for allocation. We will make it a policy and document that all allocations have to go through the libc's own operator new. A future change will also add operator delete replacements and make it a policy that deallocations in libc internal code have to go through those replacements. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D139584
2022-11-29[libc] Move strdup implementation to a new headerJoseph Huber
The `strdup` family of functions rely on `malloc` to be implemented. Its presence in the `string_utils.h` header meant that compiling many of the string functions relied on `malloc` being implementated as well. This patch simply moves the implementation into a new file to avoid including `stdlib.h` from the other string functions. This was a barrier for compiling string functions for the GPU where there is no malloc currently. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D138607
2022-10-14[libc] Add implementation of the POSIX getcwd function.Siva Chandra Reddy
Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D135905
2021-11-30[libc][clang-tidy] fix namespace check for externalsMichael Jones
Up until now, all references to `errno` were marked with `NOLINT`, since it was technically calling an external function. This fixes the lint rules so that `errno`, as well as `malloc`, `calloc`, `realloc`, and `free` are all allowed to be called as external functions. All of the relevant `NOLINT` comments have been removed, and the documentation has been updated. Reviewed By: sivachandra, lntue, aaron.ballman Differential Revision: https://reviews.llvm.org/D113946
2021-11-26[libc] Make string entrypoints mutualy exclusive.Siva Chandra Reddy
For example, strcpy does not pull memcpy now. Reviewed By: gchatelet Differential Revision: https://reviews.llvm.org/D114300
2021-10-27[libc] add strdup implementationMichael Jones
Add an implementation for strdup. Reviewed By: lntue, sivachandra Differential Revision: https://reviews.llvm.org/D111584