Make llvm::StringRef to std::string conversions explicit.
This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.
This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.
This doesn't actually modify StringRef yet, I'll do that in a follow-up.
diff --git a/clang-tools-extra/clangd/JSONTransport.cpp b/clang-tools-extra/clangd/JSONTransport.cpp
index 6351b80..43be9f7 100644
--- a/clang-tools-extra/clangd/JSONTransport.cpp
+++ b/clang-tools-extra/clangd/JSONTransport.cpp
@@ -34,7 +34,8 @@
}
llvm::Error decodeError(const llvm::json::Object &O) {
- std::string Msg = O.getString("message").getValueOr("Unspecified error");
+ std::string Msg =
+ std::string(O.getString("message").getValueOr("Unspecified error"));
if (auto Code = O.getInteger("code"))
return llvm::make_error<LSPError>(std::move(Msg), ErrorCode(*Code));
return llvm::make_error<llvm::StringError>(std::move(Msg),