[Lldb-commits] [lldb] b4827a3 - [lldb][NFCI] Remove ConstString from GDBRemoteCommunicationClient::ConfigureRemoteStructuredData
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 21 10:18:15 PDT 2023
Author: Alex Langford
Date: 2023-06-21T10:17:24-07:00
New Revision: b4827a3c0a7ef121ca376713e115b04eff0f5194
URL: https://github.com/llvm/llvm-project/commit/b4827a3c0a7ef121ca376713e115b04eff0f5194
DIFF: https://github.com/llvm/llvm-project/commit/b4827a3c0a7ef121ca376713e115b04eff0f5194.diff
LOG: [lldb][NFCI] Remove ConstString from GDBRemoteCommunicationClient::ConfigureRemoteStructuredData
ConstString's benefits are not being utilized here, StringRef is
sufficient.
Differential Revision: https://reviews.llvm.org/D153177
Added:
Modified:
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
Removed:
################################################################################
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index d97e3a7cf8f96..18aa98bc04649 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -4171,10 +4171,10 @@ Status GDBRemoteCommunicationClient::SendSignalsToIgnore(
}
Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData(
- ConstString type_name, const StructuredData::ObjectSP &config_sp) {
+ llvm::StringRef type_name, const StructuredData::ObjectSP &config_sp) {
Status error;
- if (type_name.GetLength() == 0) {
+ if (type_name.empty()) {
error.SetErrorString("invalid type_name argument");
return error;
}
@@ -4182,7 +4182,7 @@ Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData(
// Build command: Configure{type_name}: serialized config data.
StreamGDBRemote stream;
stream.PutCString("QConfigure");
- stream.PutCString(type_name.GetStringRef());
+ stream.PutCString(type_name);
stream.PutChar(':');
if (config_sp) {
// Gather the plain-text version of the configuration data.
@@ -4201,21 +4201,20 @@ Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData(
auto result = SendPacketAndWaitForResponse(stream.GetString(), response);
if (result == PacketResult::Success) {
// We failed if the config result comes back other than OK.
- if (strcmp(response.GetStringRef().data(), "OK") == 0) {
+ if (response.GetStringRef() == "OK") {
// Okay!
error.Clear();
} else {
- error.SetErrorStringWithFormat("configuring StructuredData feature "
- "%s failed with error %s",
- type_name.AsCString(),
- response.GetStringRef().data());
+ error.SetErrorStringWithFormatv(
+ "configuring StructuredData feature {0} failed with error {1}",
+ type_name, response.GetStringRef());
}
} else {
// Can we get more data here on the failure?
- error.SetErrorStringWithFormat("configuring StructuredData feature %s "
- "failed when sending packet: "
- "PacketResult=%d",
- type_name.AsCString(), (int)result);
+ error.SetErrorStringWithFormatv(
+ "configuring StructuredData feature {0} failed when sending packet: "
+ "PacketResult={1}",
+ type_name, (int)result);
}
return error;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
index 02185cf52e33e..6cf5de68911be 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
@@ -492,7 +492,7 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
///
/// \see \b Process::ConfigureStructuredData(...) for details.
Status
- ConfigureRemoteStructuredData(ConstString type_name,
+ ConfigureRemoteStructuredData(llvm::StringRef type_name,
const StructuredData::ObjectSP &config_sp);
llvm::Expected<TraceSupportedResponse>
More information about the lldb-commits
mailing list