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

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


DavidSpickett added a comment.

> I did not set const qualifier for return type because std::string_view is constant by design. Or should I mark it const explicitly?

I'm new to string_view but everything I see backs up that it is a constant view on the data as you say. I'm not sure what making it itself const would do, not worth looking into here.

Please update the commit message (here and locally, in case you happen to be using `arc`, which prefers one and I forget which one). It should include the reasoning for the change, as we've discussed here.



================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:942
   std::string Constraints = "={@ccc},r,r,~{cc},~{memory}";
-  std::string MachineClobbers = CGF.getTarget().getClobbers();
+  std::string_view MachineClobbers CGF.getTarget().getClobbers();
   if (!MachineClobbers.empty()) {
----------------
You dropped a `=`, please make sure it compiles before updating the review.


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

https://reviews.llvm.org/D148799



More information about the cfe-commits mailing list