History log of /llvm-project/libc/src/string/string_utils.h (Results 1 – 25 of 34)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# 631a6e00 23-Jan-2025 Nick Desaulniers <ndesaulniers@google.com>

[libc][wchar] implement wcslen (#124150)

Update string_utils' string_length to work with char* or wchar_t*, so that it
may be reusable when implementing wmemchr, wcspbrk, wcsrchr, wcsstr.

Link: #12

[libc][wchar] implement wcslen (#124150)

Update string_utils' string_length to work with char* or wchar_t*, so that it
may be reusable when implementing wmemchr, wcspbrk, wcsrchr, wcsstr.

Link: #121183
Link: #124027

Co-authored-by: Nick Desaulniers <ndesaulniers@google.com>

---------

Co-authored-by: Tristan Ross <tristan.ross@midstall.com>

show more ...


Revision tags: llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5
# d6fc7d3a 21-Nov-2024 Jay Foad <jay.foad@amd.com>

Fix typo "intead"


Revision tags: llvmorg-19.1.4
# 50c44478 30-Oct-2024 George Burgess IV <george.burgess.iv@gmail.com>

[libc] fix behavior of strrchr(x, '\0') (#112620)

`strrchr("foo", '\0')` is defined to point to the end of `foo`, rather
than returning NULL. This wasn't caught by tests, since llvm-libc's
`ASSERT

[libc] fix behavior of strrchr(x, '\0') (#112620)

`strrchr("foo", '\0')` is defined to point to the end of `foo`, rather
than returning NULL. This wasn't caught by tests, since llvm-libc's
`ASSERT_STREQ(nullptr, "");` is not an assertion error.

While I'm here, refactor the test slightly to check for NULL more
specifically. I considered adding fancier `ASSERT`s (and changing the
semantics of `ASSERT_STREQ`), but opted for a more local fix by fair
dice roll.

show more ...


# b03c8c4f 30-Oct-2024 George Burgess IV <george.burgess.iv@gmail.com>

libc: strlcpy/strlcat shouldn't bzero the rest of `buf` (#114259)

When running Bionic's testsuite over llvm-libc, tests broke because
e.g.,

```
const char *str = "abc";
char buf[7]{"111111"};

libc: strlcpy/strlcat shouldn't bzero the rest of `buf` (#114259)

When running Bionic's testsuite over llvm-libc, tests broke because
e.g.,

```
const char *str = "abc";
char buf[7]{"111111"};
strlcpy(buf, str, 7);
ASSERT_EQ(buf, {'1', '1', '1', '\0', '\0', '\0', '\0'});
```

On my machine (Debian w/ glibc and clang-16), a `printf` loop over `buf`
gets unrolled into a series of const `printf` at compile-time:
```
printf("%d\n", '1');
printf("%d\n", '1');
printf("%d\n", '1');
printf("%d\n", 0);
printf("%d\n", '1');
printf("%d\n", '1');
printf("%d\n", 0);
```

Seems best to match existing precedent here.

show more ...


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# 5ff3ff33 12-Jul-2024 Petr Hosek <phosek@google.com>

[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98597)

This is a part of #97655.


# ce9035f5 12-Jul-2024 Mehdi Amini <joker.eph@gmail.com>

Revert "[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration" (#98593)

Reverts llvm/llvm-project#98075

bots are broken


# 3f30effe 11-Jul-2024 Petr Hosek <phosek@google.com>

[libc] Migrate to using LIBC_NAMESPACE_DECL for namespace declaration (#98075)

This is a part of #97655.


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2
# b6bc9d72 26-Sep-2023 Guillaume Chatelet <gchatelet@google.com>

[libc] Mass replace enclosing namespace (#67032)

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


# 270547f3 21-Sep-2023 Guillaume Chatelet <gchatelet@google.com>

[libc][clang-tidy] Add llvm-header-guard to get consistant naming and prevent file copy/paste issues. (#66477)


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0
# 17114f8b 14-Sep-2023 Siva Chandra <sivachandra@gmail.com>

[libc] Remove common_libc_tuners.cmake and move options into config.json. (#66226)

The name has been changed to adhere to the config option naming format.
The necessary build changes to use the new

[libc] Remove common_libc_tuners.cmake and move options into config.json. (#66226)

The name has been changed to adhere to the config option naming format.
The necessary build changes to use the new option have also been made.

show more ...


Revision tags: llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2
# 019a477c 05-Aug-2023 Roland McGrath <mcgrathr@google.com>

[libc] Clean up required LIBC_INLINE uses in src/string

This was generated using clang-tidy and clang-apply-replacements,
on src/string/*.cpp for just the llvmlibc-inline-function-decl
check, after

[libc] Clean up required LIBC_INLINE uses in src/string

This was generated using clang-tidy and clang-apply-replacements,
on src/string/*.cpp for just the llvmlibc-inline-function-decl
check, after applying https://reviews.llvm.org/D157164, and then
some manual fixup.

Reviewed By: abrachet

Differential Revision: https://reviews.llvm.org/D157169

show more ...


Revision tags: llvmorg-17.0.0-rc1, llvmorg-18-init
# 1f578347 18-Jul-2023 Guillaume Chatelet <gchatelet@google.com>

[libc][NFC] Rename files

This patch mostly renames files so it better reflects the function they declare.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D155607


# 5bf8efd2 30-Jun-2023 Roland McGrath <mcgrathr@google.com>

[libc] Fix more inline definitions

Fix a bunch more instances of incorrect use of the `static`
keyword and missing use of LIBC_INLINE and LIBC_INLINE_VAR
macros. Note that even forward declarations

[libc] Fix more inline definitions

Fix a bunch more instances of incorrect use of the `static`
keyword and missing use of LIBC_INLINE and LIBC_INLINE_VAR
macros. Note that even forward declarations and generic template
declarations must follow the prescribed patterns for libc code so
that they match every definition, all template specializations.

Reviewed By: Caslyn

Differential Revision: https://reviews.llvm.org/D154260

show more ...


Revision tags: llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2
# 82ca29ce 11-Apr-2023 Alex Brachet <abrachet@google.com>

[libc] Move str{,r}chr implementation to headers

Differential Revision: https://reviews.llvm.org/D147463


# b4ab398c 06-Apr-2023 Alex Brachet <abrachet@google.com>

[libc] Implement strsep

Differential Revision: https://reviews.llvm.org/D147503


Revision tags: llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4
# c891ef6c 01-Mar-2023 Alex Brachet <abrachet@google.com>

[libc] Fix strcspn

Differential Revision: https://reviews.llvm.org/D144995


Revision tags: llvmorg-16.0.0-rc3
# c3228714 13-Feb-2023 Guillaume Chatelet <gchatelet@google.com>

[libc][NFC] Make tuning macros start with LIBC_COPT_

Rename preprocessor definitions that control tuning of llvm libc.

Differential Revision: https://reviews.llvm.org/D143913


# 737e1cd1 10-Feb-2023 Guillaume Chatelet <gchatelet@google.com>

[libc] Move likely/unlikely to the optimization header


Revision tags: llvmorg-16.0.0-rc2
# 29f8e076 07-Feb-2023 Guillaume Chatelet <gchatelet@google.com>

[libc][NFC] Move attributes from common to macros folder


Revision tags: llvmorg-16.0.0-rc1, llvmorg-17-init
# 6363320b 23-Jan-2023 Siva Chandra Reddy <sivachandra@google.com>

[libc][NFC] Another round of replacement of static inline with LIBC_INLINE.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D142398


Revision tags: llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init
# a3b74581 14-Jul-2022 Michael Jones <michaelrj@google.com>

[libc] add unsafe mode to strlen

The only safe way to implement strlen involves reading the string one
char at a time. It is faster to read in larger blocks, but this leads to
reading beyond the str

[libc] add unsafe mode to strlen

The only safe way to implement strlen involves reading the string one
char at a time. It is faster to read in larger blocks, but this leads to
reading beyond the string boundary, which is undefined behavior. This
patch adds an implementation and flag to use this fast but unsafe
version of strlen.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D129808

show more ...


# d85699eb 22-Nov-2022 Joseph Huber <jhuber6@vols.utk.edu>

[libc] Move strdup implementation to a new header

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 st

[libc] Move strdup implementation to a new header

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

show more ...


# 8b0e84a6 13-Oct-2022 Siva Chandra Reddy <sivachandra@google.com>

[libc] Add implementation of the POSIX getcwd function.

Reviewed By: michaelrj

Differential Revision: https://reviews.llvm.org/D135905


# aec908f9 26-Sep-2022 Guillaume Chatelet <gchatelet@google.com>

[libc][NFC] Move bzero_inline to separate file
This allows for easier discovery.


# 8a55dafd 26-Sep-2022 Guillaume Chatelet <gchatelet@google.com>

[libc][NFC] introduce inline_bzero


12