Files
clang-p2996/llvm/lib/Support/StringSaver.cpp
Jan Svoboda efcb07bf6e [llvm][Support] Avoid intermediate heap allocations in StringSaver
The `Twine::str()` function currently always allocates heap memory via `std::string`. However, some instances of `Twine` don't need an intermediate buffer at all, and the rest can attempt to print into a stack buffer first.

This is intentionally not making use of `Twine::isSingleStringLiteral()` from D157010 to skip saving the string in the bump-pointer allocator, since the `StringSaver` documentation suggests that MUST happen for every given string.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D157015
2023-08-03 11:12:05 -07:00

1.1 KiB