[PATCH] D148799: [clang] Return `StringRef` from `TargetInfo::getClobbers()`

David Spickett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 07:21:38 PDT 2023


DavidSpickett added a comment.

string_view is a good call, especially as this is not doing anything fancy with it, and we have recently been allowed to use it.

> (Maybe) Make private static field of std::string type for actual clobber value (or std::string_view type since it can be constexpr-constructed)

This I don't see the need for. If the string_views reference constant strings doesn't that amount to the same thing?

  const std::string_view getClobbers() const override {
      return "";
    }

This makes a string view out of a pointer to a const string, but I guess it's up to the compiler how far it can optimise that.

You may be correct but it seems like a small optimisation.


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

https://reviews.llvm.org/D148799



More information about the cfe-commits mailing list