[PATCH] D148799: [clang] Return `StringRef` from `TargetInfo::getClobbers()`
Sviatoslav Osipov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 21 05:52:09 PDT 2023
Stoorx added a comment.
> In this case, no one is manipulating the string until (I assume) after it's converted to std::string, so we're not removing risky accesses in that way.
Maybe the solution is to return some kind of string (std::string or llvm::SmallString) by value or by const reference?
> If the API were returning a const char * that we then did a bunch of find first, split at, strlen, etc on, then this would make more sense.
At least StringRef has the `Length` inside (we do not need to call strlen or someting) and according to documentation it can handle non-null terminated strings.
/// StringRef - Represent a constant reference to a string, i.e. a character
/// array and a length, which need not be null terminated.
Offtop: Is there any discussion platform where I can share some ideas? I have some of them how to refactor TargetInfo classes, but it's a major (and maybe breaking) change I have to discuss prior to implement.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148799/new/
https://reviews.llvm.org/D148799
More information about the cfe-commits
mailing list