[libc-commits] [PATCH] D147375: [libc] Use string_view for write_to_stderr

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Sat Apr 1 05:28:58 PDT 2023


jhuber6 added a comment.

In D147375#4238363 <https://reviews.llvm.org/D147375#4238363>, @gchatelet wrote:

> In D147375#4238339 <https://reviews.llvm.org/D147375#4238339>, @jhuber6 wrote:
>
>> Do we want to stop using `const char *`? We only use this internally currently, but it was easier for me to test when it was a C type. I'll let @sivachandra decide.
>
> `cpp::string_view` is implicitly constructible from a `const char*` so the current code still works. Are you calling the function from C code?
> Relevant discussion for this patch: https://reviews.llvm.org/D147231#inline-1423241

I was just calling it using this function for a standalone test, but it's not a huge deal. Alternatively, we could keep the function interface the same and do the conversion internally.

  namespace __llvm_libc {
  void write_to_stderr(const char *msg);
  void quick_exit(int);
  } // namespace __llvm_libc


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147375



More information about the libc-commits mailing list