[all-commits] [llvm/llvm-project] bb328c: [libc][cpp::string] Don't allocate a string in ope...
Jackson Stogel via All-commits
all-commits at lists.llvm.org
Mon Jul 13 12:16:58 PDT 2026
Branch: refs/heads/users/jtstogel/realpath/validate-path
Home: https://github.com/llvm/llvm-project
Commit: bb328c399a3fb41eaaa5c6da86614d6036e3dab1
https://github.com/llvm/llvm-project/commit/bb328c399a3fb41eaaa5c6da86614d6036e3dab1
Author: jtstogel <jtstogel at gmail.com>
Date: 2026-07-13 (Mon, 13 Jul 2026)
Changed paths:
M libc/src/__support/CPP/CMakeLists.txt
M libc/src/__support/CPP/string.h
M libc/test/src/__support/CPP/string_test.cpp
M utils/bazel/llvm-project-overlay/libc/BUILD.bazel
Log Message:
-----------
[libc][cpp::string] Don't allocate a string in operator=(string_view)
Currently, `opreator=(string_view)` allocates a temporary string: https://github.com/llvm/llvm-project/blob/67ebc4b221c3e94028b33004cd5cd08deee95048/libc/src/__support/CPP/string.h#L106-L108.
This PR updates `=` and `+=` to better support `string_view`. It also adds debug checks so that `cpp::string` makes it clear it does not support aliasing (e.g. `s = s` would zero out the string).
Commit: ff3481c447c2e0c66b0249bfefa495544866b0cb
https://github.com/llvm/llvm-project/commit/ff3481c447c2e0c66b0249bfefa495544866b0cb
Author: jtstogel <jtstogel at gmail.com>
Date: 2026-07-13 (Mon, 13 Jul 2026)
Changed paths:
M libc/src/stdlib/linux/CMakeLists.txt
M libc/src/stdlib/linux/realpath.cpp
M libc/test/UnitTest/HermeticTestUtils.cpp
M libc/test/src/stdlib/CMakeLists.txt
M libc/test/src/stdlib/realpath_test.cpp
Log Message:
-----------
[libc][realpath] Validate path components.
This PR also bumps the memory limit in `HermeticTestUtils.cpp`. The realpath unit tests allocate quite a few strings. Since memory is never free'd, the unit test quickly reaches the limit.
Compare: https://github.com/llvm/llvm-project/compare/f462d9dab8e9...ff3481c447c2
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list