diff options
| author | Dmitry Vasilyev <dvassiliev@accesssoftek.com> | 2025-04-09 09:11:56 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-09 09:11:56 +0400 |
| commit | fbc6241d3af45d74ac8e8d3728a57435aab1d5ec (patch) | |
| tree | febb6066e933514377ac05188f39ee6edc7183e7 /lldb/source/Core/RichManglingContext.cpp | |
| parent | 5c27511cb6ece1798e4503bcf8169359472871be (diff) | |
[LLDB] Refactored CPlusPlusLanguage::MethodName to break lldb-server dependencies (#132274)
This patch addresses the issue #129543.
After this patch the size of lldb-server is reduced by 9MB.
Co-authored-by: @bulbazord Alex Langford
Diffstat (limited to 'lldb/source/Core/RichManglingContext.cpp')
| -rw-r--r-- | lldb/source/Core/RichManglingContext.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/lldb/source/Core/RichManglingContext.cpp b/lldb/source/Core/RichManglingContext.cpp index b68c9e11581b..82582a5d675a 100644 --- a/lldb/source/Core/RichManglingContext.cpp +++ b/lldb/source/Core/RichManglingContext.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "lldb/Core/RichManglingContext.h" -#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" #include "lldb/Utility/LLDBLog.h" #include "llvm/ADT/StringRef.h" @@ -24,9 +23,8 @@ RichManglingContext::~RichManglingContext() { void RichManglingContext::ResetCxxMethodParser() { // If we want to support parsers for other languages some day, we need a // switch here to delete the correct parser type. - if (m_cxx_method_parser.has_value()) { + if (m_cxx_method_parser) { assert(m_provider == PluginCxxLanguage); - delete get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser); m_cxx_method_parser.reset(); } } @@ -58,8 +56,11 @@ bool RichManglingContext::FromItaniumName(ConstString mangled) { } bool RichManglingContext::FromCxxMethodName(ConstString demangled) { + auto *lang = Language::FindPlugin(eLanguageTypeC_plus_plus); + if (!lang) + return false; ResetProvider(PluginCxxLanguage); - m_cxx_method_parser = new CPlusPlusLanguage::MethodName(demangled); + m_cxx_method_parser = lang->GetMethodName(demangled); return true; } @@ -70,8 +71,7 @@ bool RichManglingContext::IsCtorOrDtor() const { return m_ipd.isCtorOrDtor(); case PluginCxxLanguage: { // We can only check for destructors here. - auto base_name = - get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser)->GetBasename(); + auto base_name = m_cxx_method_parser->GetBasename(); return base_name.starts_with("~"); } case None: @@ -118,8 +118,7 @@ llvm::StringRef RichManglingContext::ParseFunctionBaseName() { return processIPDStrResult(buf, n); } case PluginCxxLanguage: - return get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser) - ->GetBasename(); + return m_cxx_method_parser->GetBasename(); case None: return {}; } @@ -135,8 +134,7 @@ llvm::StringRef RichManglingContext::ParseFunctionDeclContextName() { return processIPDStrResult(buf, n); } case PluginCxxLanguage: - return get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser) - ->GetContext(); + return m_cxx_method_parser->GetContext(); case None: return {}; } @@ -152,9 +150,7 @@ llvm::StringRef RichManglingContext::ParseFullName() { return processIPDStrResult(buf, n); } case PluginCxxLanguage: - return get<CPlusPlusLanguage::MethodName>(m_cxx_method_parser) - ->GetFullName() - .GetStringRef(); + return m_cxx_method_parser->GetFullName().GetStringRef(); case None: return {}; } |
