Author: Alex Langford Date: 2023-06-26T11:06:29-07:00 New Revision: 2014572d9a6839745a920ec19ebfa73814548061
URL: https://github.com/llvm/llvm-project/commit/2014572d9a6839745a920ec19ebfa73814548061 DIFF: https://github.com/llvm/llvm-project/commit/2014572d9a6839745a920ec19ebfa73814548061.diff LOG: [lldb][NFCI] Remove unneeded ConstString constructions for OptionValueProperties::AppendProperty I removed ConstString from OptionValueProperties in 643ba926c1f6, but there are a few call sites that still create a ConstString as an argument. I did not catch these initially because ConstString has an implicit conversion method to StringRef. Differential Revision: https://reviews.llvm.org/D153673 Added: Modified: lldb/source/Core/Debugger.cpp lldb/source/Core/PluginManager.cpp lldb/source/Target/Process.cpp lldb/source/Target/Target.cpp lldb/unittests/Interpreter/TestOptionValue.cpp Removed: ################################################################################ diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 535b276cd8c75..bf672fe013847 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -815,17 +815,17 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton) // LLDB will start querying them during construction. m_collection_sp->Initialize(g_debugger_properties); m_collection_sp->AppendProperty( - ConstString("target"), "Settings specify to debugging targets.", true, + "target", "Settings specify to debugging targets.", true, Target::GetGlobalProperties().GetValueProperties()); m_collection_sp->AppendProperty( - ConstString("platform"), "Platform settings.", true, + "platform", "Platform settings.", true, Platform::GetGlobalPlatformProperties().GetValueProperties()); m_collection_sp->AppendProperty( - ConstString("symbols"), "Symbol lookup and cache settings.", true, + "symbols", "Symbol lookup and cache settings.", true, ModuleList::GetGlobalModuleListProperties().GetValueProperties()); if (m_command_interpreter_up) { m_collection_sp->AppendProperty( - ConstString("interpreter"), + "interpreter", "Settings specify to the debugger's command interpreter.", true, m_command_interpreter_up->GetValueProperties()); } diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index 057342d24340b..bf23cefe3a7f6 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -1438,7 +1438,7 @@ GetDebuggerPropertyForPlugins(Debugger &debugger, ConstString plugin_type_name, lldb::OptionValuePropertiesSP parent_properties_sp( debugger.GetValueProperties()); if (parent_properties_sp) { - static ConstString g_property_name("plugin"); + static constexpr llvm::StringLiteral g_property_name("plugin"); OptionValuePropertiesSP plugin_properties_sp = parent_properties_sp->GetSubProperty(nullptr, g_property_name); @@ -1471,7 +1471,7 @@ GetDebuggerPropertyForPlugins(Debugger &debugger, ConstString plugin_type_name, static lldb::OptionValuePropertiesSP GetDebuggerPropertyForPluginsOldStyle( Debugger &debugger, ConstString plugin_type_name, llvm::StringRef plugin_type_desc, bool can_create) { - static ConstString g_property_name("plugin"); + static constexpr llvm::StringLiteral g_property_name("plugin"); lldb::OptionValuePropertiesSP parent_properties_sp( debugger.GetValueProperties()); if (parent_properties_sp) { diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 246279de086ae..05e8a0ad9c477 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -167,7 +167,7 @@ ProcessProperties::ProcessProperties(lldb_private::Process *process) std::make_shared<ProcessOptionValueProperties>(ConstString("process")); m_collection_sp->Initialize(g_process_properties); m_collection_sp->AppendProperty( - ConstString("thread"), "Settings specific to threads.", true, + "thread", "Settings specific to threads.", true, Thread::GetGlobalProperties().GetValueProperties()); } else { m_collection_sp = @@ -180,7 +180,7 @@ ProcessProperties::ProcessProperties(lldb_private::Process *process) m_experimental_properties_up = std::make_unique<ProcessExperimentalProperties>(); m_collection_sp->AppendProperty( - ConstString(Properties::GetExperimentalSettingsName()), + Properties::GetExperimentalSettingsName(), "Experimental settings - setting these won't produce " "errors if the setting is not present.", true, m_experimental_properties_up->GetValueProperties()); diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 94317f3c0535c..1444bb6d1217e 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -4112,7 +4112,7 @@ TargetProperties::TargetProperties(Target *target) m_experimental_properties_up = std::make_unique<TargetExperimentalProperties>(); m_collection_sp->AppendProperty( - ConstString(Properties::GetExperimentalSettingsName()), + Properties::GetExperimentalSettingsName(), "Experimental settings - setting these won't produce " "errors if the setting is not present.", true, m_experimental_properties_up->GetValueProperties()); @@ -4123,12 +4123,12 @@ TargetProperties::TargetProperties(Target *target) m_experimental_properties_up = std::make_unique<TargetExperimentalProperties>(); m_collection_sp->AppendProperty( - ConstString(Properties::GetExperimentalSettingsName()), + Properties::GetExperimentalSettingsName(), "Experimental settings - setting these won't produce " "errors if the setting is not present.", true, m_experimental_properties_up->GetValueProperties()); m_collection_sp->AppendProperty( - ConstString("process"), "Settings specific to processes.", true, + "process", "Settings specific to processes.", true, Process::GetGlobalProperties().GetValueProperties()); m_collection_sp->SetValueChangedCallback( ePropertySaveObjectsDir, [this] { CheckJITObjectsDir(); }); diff --git a/lldb/unittests/Interpreter/TestOptionValue.cpp b/lldb/unittests/Interpreter/TestOptionValue.cpp index 7753d3d968b03..704f460e43b8b 100644 --- a/lldb/unittests/Interpreter/TestOptionValue.cpp +++ b/lldb/unittests/Interpreter/TestOptionValue.cpp @@ -85,11 +85,10 @@ class TestProperties : public OptionValueProperties { const bool is_global = false; auto dict_sp = std::make_shared<OptionValueDictionary>(1 << eTypeUInt64); - props_sp->AppendProperty(ConstString("dict"), "", is_global, dict_sp); + props_sp->AppendProperty("dict", "", is_global, dict_sp); auto file_list_sp = std::make_shared<OptionValueFileSpecList>(); - props_sp->AppendProperty(ConstString("file-list"), "", is_global, - file_list_sp); + props_sp->AppendProperty("file-list", "", is_global, file_list_sp); return props_sp; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits