Skip to content

Commit b4827a3

Browse files
committed
[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
1 parent 74adc3e commit b4827a3

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4171,18 +4171,18 @@ Status GDBRemoteCommunicationClient::SendSignalsToIgnore(
41714171
}
41724172

41734173
Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData(
4174-
ConstString type_name, const StructuredData::ObjectSP &config_sp) {
4174+
llvm::StringRef type_name, const StructuredData::ObjectSP &config_sp) {
41754175
Status error;
41764176

4177-
if (type_name.GetLength() == 0) {
4177+
if (type_name.empty()) {
41784178
error.SetErrorString("invalid type_name argument");
41794179
return error;
41804180
}
41814181

41824182
// Build command: Configure{type_name}: serialized config data.
41834183
StreamGDBRemote stream;
41844184
stream.PutCString("QConfigure");
4185-
stream.PutCString(type_name.GetStringRef());
4185+
stream.PutCString(type_name);
41864186
stream.PutChar(':');
41874187
if (config_sp) {
41884188
// Gather the plain-text version of the configuration data.
@@ -4201,21 +4201,20 @@ Status GDBRemoteCommunicationClient::ConfigureRemoteStructuredData(
42014201
auto result = SendPacketAndWaitForResponse(stream.GetString(), response);
42024202
if (result == PacketResult::Success) {
42034203
// We failed if the config result comes back other than OK.
4204-
if (strcmp(response.GetStringRef().data(), "OK") == 0) {
4204+
if (response.GetStringRef() == "OK") {
42054205
// Okay!
42064206
error.Clear();
42074207
} else {
4208-
error.SetErrorStringWithFormat("configuring StructuredData feature "
4209-
"%s failed with error %s",
4210-
type_name.AsCString(),
4211-
response.GetStringRef().data());
4208+
error.SetErrorStringWithFormatv(
4209+
"configuring StructuredData feature {0} failed with error {1}",
4210+
type_name, response.GetStringRef());
42124211
}
42134212
} else {
42144213
// Can we get more data here on the failure?
4215-
error.SetErrorStringWithFormat("configuring StructuredData feature %s "
4216-
"failed when sending packet: "
4217-
"PacketResult=%d",
4218-
type_name.AsCString(), (int)result);
4214+
error.SetErrorStringWithFormatv(
4215+
"configuring StructuredData feature {0} failed when sending packet: "
4216+
"PacketResult={1}",
4217+
type_name, (int)result);
42194218
}
42204219
return error;
42214220
}

lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ class GDBRemoteCommunicationClient : public GDBRemoteClientBase {
492492
///
493493
/// \see \b Process::ConfigureStructuredData(...) for details.
494494
Status
495-
ConfigureRemoteStructuredData(ConstString type_name,
495+
ConfigureRemoteStructuredData(llvm::StringRef type_name,
496496
const StructuredData::ObjectSP &config_sp);
497497

498498
llvm::Expected<TraceSupportedResponse>

0 commit comments

Comments
 (0)