[PATCH] D151300: [clang][Diagnostics][NFC] Remove unnecessary StringRef

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 05:20:44 PDT 2023


tbaeder added a comment.

In D151300#4367943 <https://reviews.llvm.org/D151300#4367943>, @aaron.ballman wrote:

> In D151300#4367939 <https://reviews.llvm.org/D151300#4367939>, @tbaeder wrote:
>
>> In D151300#4367884 <https://reviews.llvm.org/D151300#4367884>, @aaron.ballman wrote:
>>
>>> LGTM, but it's worth noting that `std::string::pop_back()` calls `erase()` and there's no guarantee that there's not an extra allocation involved as a result. However, I've not seen evidence that STLs actually do an allocation (looking at libc++ and MSVC STL, they don't appear to allocate), so I think this is fine.
>>
>> Is the allocation only relevant for performance reasons or something else?
>
> Performance was my only concern there.

Okay, good. I don't think that's too bad since the common line of code has exactly 0 trailing null bytes anyway.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151300/new/

https://reviews.llvm.org/D151300



More information about the cfe-commits mailing list