diff --git a/llvm/include/llvm/ADT/Twine.h b/llvm/include/llvm/ADT/Twine.h --- a/llvm/include/llvm/ADT/Twine.h +++ b/llvm/include/llvm/ADT/Twine.h @@ -291,9 +291,9 @@ /// Construct from an std::string_view by converting it to a pointer and /// length. This handles string_views on a pure API basis, and avoids /// storing one (or a pointer to one) inside a Twine, which avoids problems - /// when mixing code compiled under various C++ standards. - /*implicit*/ Twine(const std::string_view &Str) - : LHSKind(PtrAndLengthKind) { + /// when mixing code compiled under various C++ standards. Pass string_view + /// by value is preferred. + /*implicit*/ Twine(std::string_view Str) : LHSKind(PtrAndLengthKind) { LHS.ptrAndLength.ptr = Str.data(); LHS.ptrAndLength.length = Str.length(); assert(isValid() && "Invalid twine!");