[PATCH] D139023: [NFC][Clang][Driver][AMDGPU] Avoid temporary copies of std::string by using Twine and StringRef

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 1 10:32:21 PST 2022


tra accepted this revision.
tra added a comment.
This revision is now accepted and ready to land.

LGTM in principle.

That said, I don't think `StringRef `buys us anything here as none of this code is in the hot path. It also comes with the downside that now one has to worry about lifetimes of the strings we refer to. Things do look OK in this case, but it would be good if it could be confirmed with sanitizer. 
In code that's not performance critical I personally prefer passing std::string by value and let compiler optimize them away.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139023



More information about the cfe-commits mailing list