================ @@ -51,13 +51,13 @@ Status::Status(std::error_code EC) : eErrorTypeGeneric), m_string(EC.message()) {} -Status::Status(const char *format, ...) : m_string() { - va_list args; - va_start(args, format); - SetErrorToGenericError(); - SetErrorStringWithVarArg(format, args); - va_end(args); -} +Status::Status(std::string &&err_str) ---------------- Michael137 wrote:
Why `std::string&&`? Looks like in a lot of the cases you're going to have to do a c-str -> std::string conversion anyway? For the `FromErrorStringWithFormat` where you construct `Status` with an l-value string, you're actually silently copying (because this `std::string&&` overload isn't picked, instead it picks the `llvm::StringRef` constructor, and copies the string). All this might just be easier to reason about if you make it a by-value argument, for all cases. And the double-move (for std::move construction+std::move from the argument is probably not worth optimizing away by-hand?). https://github.com/llvm/llvm-project/pull/106163 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits