summaryrefslogtreecommitdiff
path: root/llvm/lib/Support/StringSaver.cpp
AgeCommit message (Collapse)Author
2023-08-03[llvm][Support] Avoid intermediate heap allocations in `StringSaver`Jan Svoboda
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
2020-05-14Temporarily Revert "[Support] Make UniqueStringSaver wrap a StringSet"Eric Christopher
as it's causing asan failures in clangd. Followed up offline with repro instructions. This reverts commit 29560a89ddcaf3af9b8a73d98d968a0911d21e27.
2020-05-14[Support] Make UniqueStringSaver wrap a StringSetBenjamin Kramer
This is slightly more efficient while providing exactly the same semantics.
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-08-20Fix an undefined behavior when storing an empty StringRef.Haojian Wu
Summary: Passing a nullptr to memcpy is UB. Reviewers: ioeric Subscribers: llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D50966 llvm-svn: 340170
2018-07-23[Support] Add a UniqueStringSaver: like StringSaver, but deduplicating.Sam McCall
Summary: Clarify contract of StringSaver (it null-terminates, callers rely on it). Reviewers: hokein Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D49596 llvm-svn: 337677
2016-10-05Use StringRef in StringSaver API (NFC)Mehdi Amini
llvm-svn: 283290
2015-08-13There is only one saver of strings.Rafael Espindola
llvm-svn: 244854
2015-06-13Bring in a BumpPtrStringSaver from lld and simplify the interface.Rafael Espindola
StringSaver now always saves to a BumpPtrAllocator. The only reason for having the virtual saveImpl is so lld can have a thread safe version. The reason for the distinct BumpPtrStringSaver class is to avoid the virtual destructor. llvm-svn: 239669