diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2023-08-03 10:15:01 -0700 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2023-08-03 11:12:05 -0700 |
commit | efcb07bf6e5fb0ff12e5855ab0ad86cd534d5578 (patch) | |
tree | 2ed9ee5149d430bd46153f2ed0c11d342be37c85 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 43dfe0f08ecaf50f986512d0548bd3ac84d1813b (diff) | |
download | llvm-efcb07bf6e5fb0ff12e5855ab0ad86cd534d5578.zip llvm-efcb07bf6e5fb0ff12e5855ab0ad86cd534d5578.tar.gz llvm-efcb07bf6e5fb0ff12e5855ab0ad86cd534d5578.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions