This revision was automatically updated to reflect the committed changes. Closed by commit rG1a397ecffdea: [lldb][NFCI] Remove use of ConstString from StructuredDataPlugin (authored by bulbazord).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153482/new/ https://reviews.llvm.org/D153482 Files: lldb/include/lldb/Target/Process.h lldb/include/lldb/Target/StructuredDataPlugin.h lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h lldb/source/Target/Process.cpp lldb/source/Target/StructuredDataPlugin.cpp
Index: lldb/source/Target/StructuredDataPlugin.cpp =================================================================== --- lldb/source/Target/StructuredDataPlugin.cpp +++ lldb/source/Target/StructuredDataPlugin.cpp @@ -32,7 +32,7 @@ StructuredDataPlugin::~StructuredDataPlugin() = default; -bool StructuredDataPlugin::GetEnabled(ConstString type_name) const { +bool StructuredDataPlugin::GetEnabled(llvm::StringRef type_name) const { // By default, plugins are always enabled. Plugin authors should override // this if there is an enabled/disabled state for their plugin. return true; Index: lldb/source/Target/Process.cpp =================================================================== --- lldb/source/Target/Process.cpp +++ lldb/source/Target/Process.cpp @@ -6070,7 +6070,7 @@ // For any of the remaining type names, map any that this plugin supports. std::vector<llvm::StringRef> names_to_remove; for (llvm::StringRef type_name : type_names) { - if (plugin_sp->SupportsStructuredDataType(ConstString(type_name))) { + if (plugin_sp->SupportsStructuredDataType(type_name)) { m_structured_data_plugin_map.insert( std::make_pair(type_name, plugin_sp)); names_to_remove.push_back(type_name); @@ -6110,8 +6110,7 @@ } // Route the structured data to the plugin. - find_it->second->HandleArrivalOfStructuredData(*this, ConstString(type_name), - object_sp); + find_it->second->HandleArrivalOfStructuredData(*this, type_name, object_sp); return true; } Index: lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h =================================================================== --- lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h +++ lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.h @@ -50,16 +50,16 @@ // StructuredDataPlugin API - bool SupportsStructuredDataType(ConstString type_name) override; + bool SupportsStructuredDataType(llvm::StringRef type_name) override; void HandleArrivalOfStructuredData( - Process &process, ConstString type_name, + Process &process, llvm::StringRef type_name, const StructuredData::ObjectSP &object_sp) override; Status GetDescription(const StructuredData::ObjectSP &object_sp, lldb_private::Stream &stream) override; - bool GetEnabled(ConstString type_name) const override; + bool GetEnabled(llvm::StringRef type_name) const override; void ModulesDidLoad(Process &process, ModuleList &module_list) override; Index: lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp =================================================================== --- lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp +++ lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp @@ -875,9 +875,10 @@ process_sp->GetStructuredDataPlugin(GetDarwinLogTypeName()); stream.Printf("Availability: %s\n", plugin_sp ? "available" : "unavailable"); - llvm::StringRef plugin_name = StructuredDataDarwinLog::GetStaticPluginName(); const bool enabled = - plugin_sp ? plugin_sp->GetEnabled(ConstString(plugin_name)) : false; + plugin_sp ? plugin_sp->GetEnabled( + StructuredDataDarwinLog::GetStaticPluginName()) + : false; stream.Printf("Enabled: %s\n", enabled ? "true" : "false"); } @@ -1057,12 +1058,12 @@ // StructuredDataPlugin API bool StructuredDataDarwinLog::SupportsStructuredDataType( - ConstString type_name) { + llvm::StringRef type_name) { return type_name == GetDarwinLogTypeName(); } void StructuredDataDarwinLog::HandleArrivalOfStructuredData( - Process &process, ConstString type_name, + Process &process, llvm::StringRef type_name, const StructuredData::ObjectSP &object_sp) { Log *log = GetLog(LLDBLog::Process); if (log) { @@ -1086,11 +1087,9 @@ // Ignore any data that isn't for us. if (type_name != GetDarwinLogTypeName()) { - LLDB_LOGF(log, - "StructuredDataDarwinLog::%s() StructuredData type " - "expected to be %s but was %s, ignoring", - __FUNCTION__, GetDarwinLogTypeName().str().c_str(), - type_name.AsCString()); + LLDB_LOG(log, + "StructuredData type expected to be {0} but was {1}, ignoring", + GetDarwinLogTypeName(), type_name); return; } @@ -1200,11 +1199,10 @@ return error; } -bool StructuredDataDarwinLog::GetEnabled(ConstString type_name) const { - if (type_name.GetStringRef() == GetStaticPluginName()) +bool StructuredDataDarwinLog::GetEnabled(llvm::StringRef type_name) const { + if (type_name == GetStaticPluginName()) return m_is_enabled; - else - return false; + return false; } void StructuredDataDarwinLog::SetEnabled(bool enabled) { Index: lldb/include/lldb/Target/StructuredDataPlugin.h =================================================================== --- lldb/include/lldb/Target/StructuredDataPlugin.h +++ lldb/include/lldb/Target/StructuredDataPlugin.h @@ -64,7 +64,7 @@ /// /// \return /// true if the plugin supports the feature; otherwise, false. - virtual bool SupportsStructuredDataType(ConstString type_name) = 0; + virtual bool SupportsStructuredDataType(llvm::StringRef type_name) = 0; /// Handle the arrival of asynchronous structured data from the process. /// @@ -92,7 +92,7 @@ /// key named "type" that must be a string value containing the /// structured data type name. virtual void - HandleArrivalOfStructuredData(Process &process, ConstString type_name, + HandleArrivalOfStructuredData(Process &process, llvm::StringRef type_name, const StructuredData::ObjectSP &object_sp) = 0; /// Get a human-readable description of the contents of the data. @@ -124,7 +124,7 @@ /// \param[in] type_name /// The name of the feature tag for the asynchronous structured data. /// This is needed for plugins that support more than one feature. - virtual bool GetEnabled(ConstString type_name) const; + virtual bool GetEnabled(llvm::StringRef type_name) const; /// Allow the plugin to do work related to modules that loaded in the /// the corresponding process. Index: lldb/include/lldb/Target/Process.h =================================================================== --- lldb/include/lldb/Target/Process.h +++ lldb/include/lldb/Target/Process.h @@ -2833,7 +2833,7 @@ /// /// virtual void /// HandleArrivalOfStructuredData(Process &process, - /// ConstString type_name, + /// llvm::StringRef type_name, /// const StructuredData::ObjectSP /// &object_sp) ///
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits