Skip to content

Commit 7d30878

Browse files
committed
[lldb][NFCI] Avoid a few unnecessary ConstString constructions in StructuredDataDarwinLog
Process::GetStructuredDataPlugin takes a StringRef directly, no need to convert them to ConstString first.
1 parent 8e1f820 commit 7d30878

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -799,8 +799,8 @@ class EnableCommand : public CommandObjectParsed {
799799
}
800800

801801
// Get the plugin for the process.
802-
auto plugin_sp = process_sp->GetStructuredDataPlugin(
803-
ConstString(GetDarwinLogTypeName()));
802+
auto plugin_sp =
803+
process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
804804
if (!plugin_sp || (plugin_sp->GetPluginName() !=
805805
StructuredDataDarwinLog::GetStaticPluginName())) {
806806
result.AppendError("failed to get StructuredDataPlugin for "
@@ -871,8 +871,8 @@ class StatusCommand : public CommandObjectParsed {
871871
stream.PutCString("Enabled: not applicable "
872872
"(requires process)\n");
873873
} else {
874-
auto plugin_sp = process_sp->GetStructuredDataPlugin(
875-
ConstString(GetDarwinLogTypeName()));
874+
auto plugin_sp =
875+
process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
876876
stream.Printf("Availability: %s\n",
877877
plugin_sp ? "available" : "unavailable");
878878
llvm::StringRef plugin_name = StructuredDataDarwinLog::GetStaticPluginName();
@@ -1490,8 +1490,7 @@ bool StructuredDataDarwinLog::InitCompletionHookCallback(
14901490
LLDB_LOGF(log, "StructuredDataDarwinLog::%s() call is for process uid %d",
14911491
__FUNCTION__, process_sp->GetUniqueID());
14921492

1493-
auto plugin_sp =
1494-
process_sp->GetStructuredDataPlugin(ConstString(GetDarwinLogTypeName()));
1493+
auto plugin_sp = process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
14951494
if (!plugin_sp) {
14961495
LLDB_LOG(log, "warning: no plugin for feature {0} in process uid {1}",
14971496
GetDarwinLogTypeName(), process_sp->GetUniqueID());

0 commit comments

Comments
 (0)