[Lldb-commits] [lldb] 7d30878 - [lldb][NFCI] Avoid a few unnecessary ConstString constructions in StructuredDataDarwinLog
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 16 14:22:49 PDT 2023
Author: Alex Langford
Date: 2023-06-16T14:19:13-07:00
New Revision: 7d30878bf8586a991264c5ca9095a7b5a5234a42
URL: https://github.com/llvm/llvm-project/commit/7d30878bf8586a991264c5ca9095a7b5a5234a42
DIFF: https://github.com/llvm/llvm-project/commit/7d30878bf8586a991264c5ca9095a7b5a5234a42.diff
LOG: [lldb][NFCI] Avoid a few unnecessary ConstString constructions in StructuredDataDarwinLog
Process::GetStructuredDataPlugin takes a StringRef directly, no need to
convert them to ConstString first.
Added:
Modified:
lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index a9f88233d9463..611e1506d8581 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -799,8 +799,8 @@ class EnableCommand : public CommandObjectParsed {
}
// Get the plugin for the process.
- auto plugin_sp = process_sp->GetStructuredDataPlugin(
- ConstString(GetDarwinLogTypeName()));
+ auto plugin_sp =
+ process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
if (!plugin_sp || (plugin_sp->GetPluginName() !=
StructuredDataDarwinLog::GetStaticPluginName())) {
result.AppendError("failed to get StructuredDataPlugin for "
@@ -871,8 +871,8 @@ class StatusCommand : public CommandObjectParsed {
stream.PutCString("Enabled: not applicable "
"(requires process)\n");
} else {
- auto plugin_sp = process_sp->GetStructuredDataPlugin(
- ConstString(GetDarwinLogTypeName()));
+ auto plugin_sp =
+ process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
stream.Printf("Availability: %s\n",
plugin_sp ? "available" : "unavailable");
llvm::StringRef plugin_name = StructuredDataDarwinLog::GetStaticPluginName();
@@ -1490,8 +1490,7 @@ bool StructuredDataDarwinLog::InitCompletionHookCallback(
LLDB_LOGF(log, "StructuredDataDarwinLog::%s() call is for process uid %d",
__FUNCTION__, process_sp->GetUniqueID());
- auto plugin_sp =
- process_sp->GetStructuredDataPlugin(ConstString(GetDarwinLogTypeName()));
+ auto plugin_sp = process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName());
if (!plugin_sp) {
LLDB_LOG(log, "warning: no plugin for feature {0} in process uid {1}",
GetDarwinLogTypeName(), process_sp->GetUniqueID());
More information about the lldb-commits
mailing list