[clang-tools-extra] [clang-doc][nfc] Avoid constructing SmallString in ToString method (PR #96921)

Petr Hosek via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 1 23:22:43 PDT 2024


petrhosek wrote:

> > I'd use `std::string_view` as a return value instead of `const char *` as a more idiomatic C++ in which case you don't need to rename the method to `c_str()`.
> 
> I opted for `StringRef`, since that seems more in line w/ the conventions here, but I'm happy to switch to `std::string_view` if you'd prefer.

AFAIK the long-term plan is to replace `StringRef` with `std::string_view` but I'm fine using `StringRef` for consistency with the rest of the codebase.

https://github.com/llvm/llvm-project/pull/96921


More information about the cfe-commits mailing list