diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -44,7 +44,7 @@ public: PlatformProperties(); - static ConstString GetSettingName(); + static llvm::StringRef GetSettingName(); bool GetUseModuleCache() const; bool SetUseModuleCache(bool use_module_cache); diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -75,8 +75,7 @@ } // namespace ModuleListProperties::ModuleListProperties() { - m_collection_sp = - std::make_shared(ConstString("symbols")); + m_collection_sp = std::make_shared("symbols"); m_collection_sp->Initialize(g_modulelist_properties); m_collection_sp->SetValueChangedCallback(ePropertySymLinkPaths, [this] { UpdateSymlinkMappings(); }); diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -311,7 +311,7 @@ bool can_create) { UpdateValueIfNeeded(); - uint32_t index = GetIndexOfChildWithName(ConstString(name)); + uint32_t index = GetIndexOfChildWithName(name); if (index == UINT32_MAX) return lldb::ValueObjectSP(); diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -128,8 +128,8 @@ bool synchronous_execution) : Broadcaster(debugger.GetBroadcasterManager(), CommandInterpreter::GetStaticBroadcasterClass().AsCString()), - Properties(OptionValuePropertiesSP( - new OptionValueProperties(ConstString("interpreter")))), + Properties( + OptionValuePropertiesSP(new OptionValueProperties("interpreter"))), IOHandlerDelegate(IOHandlerDelegate::Completion::LLDBCommand), m_debugger(debugger), m_synchronous_execution(true), m_skip_lldbinit_files(false), m_skip_app_init_files(false), diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -98,8 +98,8 @@ class DynamicLoaderDarwinKernelProperties : public Properties { public: - static ConstString &GetSettingName() { - static ConstString g_setting_name("darwin-kernel"); + static llvm::StringRef GetSettingName() { + static constexpr llvm::StringLiteral g_setting_name("darwin-kernel"); return g_setting_name; } diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp --- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp +++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp @@ -89,8 +89,8 @@ class PluginProperties : public Properties { public: - static ConstString GetSettingName() { - return ConstString(JITLoaderGDB::GetPluginNameStatic()); + static llvm::StringRef GetSettingName() { + return JITLoaderGDB::GetPluginNameStatic(); } PluginProperties() { diff --git a/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp b/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp --- a/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp @@ -38,7 +38,7 @@ ValueObjectSP GetChildAtIndex(size_t idx) override; private: - ConstString GetDataContainerMemberName(); + llvm::StringRef GetDataContainerMemberName(); // The lifetime of a ValueObject and all its derivative ValueObjects // (children, clones, etc.) is managed by a ClusterManager. These @@ -66,12 +66,14 @@ } } -ConstString GenericBitsetFrontEnd::GetDataContainerMemberName() { +llvm::StringRef GenericBitsetFrontEnd::GetDataContainerMemberName() { + static constexpr llvm::StringLiteral s_libcxx_case("__first_"); + static constexpr llvm::StringLiteral s_libstdcpp_case("_M_w"); switch (m_stdlib) { case StdLib::LibCxx: - return ConstString("__first_"); + return s_libcxx_case; case StdLib::LibStdcpp: - return ConstString("_M_w"); + return s_libstdcpp_case; } llvm_unreachable("Unknown StdLib enum"); } diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -79,8 +79,8 @@ class PluginProperties : public Properties { public: - static ConstString GetSettingName() { - return ConstString(ObjectFilePECOFF::GetPluginNameStatic()); + static llvm::StringRef GetSettingName() { + return ObjectFilePECOFF::GetPluginNameStatic(); } PluginProperties() { diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -43,7 +43,7 @@ public: PluginProperties() { m_collection_sp = std::make_shared( - ConstString(PlatformAndroid::GetPluginNameStatic(false))); + PlatformAndroid::GetPluginNameStatic(false)); m_collection_sp->Initialize(g_android_properties); } }; @@ -155,8 +155,8 @@ } void PlatformAndroid::DebuggerInitialize(Debugger &debugger) { - if (!PluginManager::GetSettingForPlatformPlugin( - debugger, ConstString(GetPluginNameStatic(false)))) { + if (!PluginManager::GetSettingForPlatformPlugin(debugger, + GetPluginNameStatic(false))) { PluginManager::CreateSettingForPlatformPlugin( debugger, GetGlobalProperties().GetValueProperties(), "Properties for the Android platform plugin.", diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -123,8 +123,8 @@ class PlatformDarwinProperties : public Properties { public: - static ConstString &GetSettingName() { - static ConstString g_setting_name("darwin"); + static llvm::StringRef GetSettingName() { + static constexpr llvm::StringLiteral g_setting_name("darwin"); return g_setting_name; } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -187,8 +187,8 @@ class PlatformDarwinKernelProperties : public Properties { public: - static ConstString &GetSettingName() { - static ConstString g_setting_name("darwin-kernel"); + static llvm::StringRef GetSettingName() { + static constexpr llvm::StringLiteral g_setting_name("darwin-kernel"); return g_setting_name; } diff --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp --- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp +++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp @@ -36,7 +36,7 @@ public: PluginProperties() { m_collection_sp = std::make_shared( - ConstString(PlatformQemuUser::GetPluginNameStatic())); + PlatformQemuUser::GetPluginNameStatic()); m_collection_sp->Initialize(g_platformqemuuser_properties); } @@ -89,8 +89,8 @@ } void PlatformQemuUser::DebuggerInitialize(Debugger &debugger) { - if (!PluginManager::GetSettingForPlatformPlugin( - debugger, ConstString(GetPluginNameStatic()))) { + if (!PluginManager::GetSettingForPlatformPlugin(debugger, + GetPluginNameStatic())) { PluginManager::CreateSettingForPlatformPlugin( debugger, GetGlobalProperties().GetValueProperties(), "Properties for the qemu-user platform plugin.", diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -65,8 +65,8 @@ class PluginProperties : public Properties { public: - static ConstString GetSettingName() { - return ConstString(ProcessKDP::GetPluginNameStatic()); + static llvm::StringRef GetSettingName() { + return ProcessKDP::GetPluginNameStatic(); } PluginProperties() : Properties() { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -129,8 +129,8 @@ class PluginProperties : public Properties { public: - static ConstString GetSettingName() { - return ConstString(ProcessGDBRemote::GetPluginNameStatic()); + static llvm::StringRef GetSettingName() { + return ProcessGDBRemote::GetPluginNameStatic(); } PluginProperties() : Properties() { diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp --- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -117,8 +117,8 @@ class StructuredDataDarwinLogProperties : public Properties { public: - static ConstString &GetSettingName() { - static ConstString g_setting_name("darwin-log"); + static llvm::StringRef GetSettingName() { + static constexpr llvm::StringLiteral g_setting_name("darwin-log"); return g_setting_name; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -114,8 +114,8 @@ class PluginProperties : public Properties { public: - static ConstString GetSettingName() { - return ConstString(SymbolFileDWARF::GetPluginNameStatic()); + static llvm::StringRef GetSettingName() { + return SymbolFileDWARF::GetPluginNameStatic(); } PluginProperties() { diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -72,8 +72,8 @@ } // namespace -ConstString PlatformProperties::GetSettingName() { - static ConstString g_setting_name("platform"); +llvm::StringRef PlatformProperties::GetSettingName() { + static constexpr llvm::StringLiteral g_setting_name("platform"); return g_setting_name; } diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -89,7 +89,7 @@ class ProcessOptionValueProperties : public Cloneable { public: - ProcessOptionValueProperties(ConstString name) : Cloneable(name) {} + ProcessOptionValueProperties(llvm::StringRef name) : Cloneable(name) {} const Property * GetPropertyAtIndex(size_t idx, @@ -146,8 +146,7 @@ OptionValueProperties> { public: ProcessExperimentalOptionValueProperties() - : Cloneable( - ConstString(Properties::GetExperimentalSettingsName())) {} + : Cloneable(Properties::GetExperimentalSettingsName()) {} }; ProcessExperimentalProperties::ProcessExperimentalProperties() @@ -162,8 +161,7 @@ { if (process == nullptr) { // Global process properties, set them up one time - m_collection_sp = - std::make_shared(ConstString("process")); + m_collection_sp = std::make_shared("process"); m_collection_sp->Initialize(g_process_properties); m_collection_sp->AppendProperty( "thread", "Settings specific to threads.", true, diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -4062,7 +4062,7 @@ class TargetOptionValueProperties : public Cloneable { public: - TargetOptionValueProperties(ConstString name) : Cloneable(name) {} + TargetOptionValueProperties(llvm::StringRef name) : Cloneable(name) {} const Property * GetPropertyAtIndex(size_t idx, @@ -4098,7 +4098,7 @@ OptionValueProperties> { public: TargetExperimentalOptionValueProperties() - : Cloneable(ConstString(Properties::GetExperimentalSettingsName())) {} + : Cloneable(Properties::GetExperimentalSettingsName()) {} }; TargetExperimentalProperties::TargetExperimentalProperties() @@ -4152,8 +4152,7 @@ "errors if the setting is not present.", true, m_experimental_properties_up->GetValueProperties()); } else { - m_collection_sp = - std::make_shared(ConstString("target")); + m_collection_sp = std::make_shared("target"); m_collection_sp->Initialize(g_target_properties); m_experimental_properties_up = std::make_unique(); diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -76,7 +76,7 @@ class ThreadOptionValueProperties : public Cloneable { public: - ThreadOptionValueProperties(ConstString name) : Cloneable(name) {} + ThreadOptionValueProperties(llvm::StringRef name) : Cloneable(name) {} const Property * GetPropertyAtIndex(size_t idx, @@ -100,8 +100,7 @@ ThreadProperties::ThreadProperties(bool is_global) : Properties() { if (is_global) { - m_collection_sp = - std::make_shared(ConstString("thread")); + m_collection_sp = std::make_shared("thread"); m_collection_sp->Initialize(g_thread_properties); } else m_collection_sp =