Seems unnecessary to create a StringRef here just so we can drop the trailing null bytes. We can do that with the std::string we create anyway.
Details
Details
- Reviewers
cjdb aaron.ballman - Group Reviewers
Restricted Project - Commits
- rGa806b3f49667: [clang][Diagnostics][NFC] Remove unnecessary StringRef
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
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.
Comment Actions
Okay, good. I don't think that's too bad since the common line of code has exactly 0 trailing null bytes anyway.