diff --git a/lldb/include/lldb/Target/CPPLanguageRuntime.h b/lldb/include/lldb/Target/CPPLanguageRuntime.h index 8de885372862..f035bac4b461 100644 --- a/lldb/include/lldb/Target/CPPLanguageRuntime.h +++ b/lldb/include/lldb/Target/CPPLanguageRuntime.h @@ -43,6 +43,11 @@ public: return lldb::eLanguageTypeC_plus_plus; } + static CPPLanguageRuntime *GetCPPLanguageRuntime(Process &process) { + return static_cast( + process.GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus)); + } + virtual bool IsVTableName(const char *name) = 0; bool GetObjectDescription(Stream &str, ValueObject &object) override; diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index 2657302340ee..c3ffa99a73c6 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -2184,8 +2184,6 @@ public: LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language, bool retry_if_null = true); - CPPLanguageRuntime *GetCPPLanguageRuntime(bool retry_if_null = true); - ObjCLanguageRuntime *GetObjCLanguageRuntime(bool retry_if_null = true); bool IsPossibleDynamicValue(ValueObject &in_value); diff --git a/lldb/include/lldb/lldb-forward.h b/lldb/include/lldb/lldb-forward.h index ebebd47f0614..fd2d272c8915 100644 --- a/lldb/include/lldb/lldb-forward.h +++ b/lldb/include/lldb/lldb-forward.h @@ -43,7 +43,6 @@ class BreakpointSiteList; class BroadcastEventSpec; class Broadcaster; class BroadcasterManager; -class CPPLanguageRuntime; class ClangASTContext; class ClangASTImporter; class ClangASTMetadata; diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index 9dceca6123f3..01b3a7ecad2a 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -67,7 +67,8 @@ bool lldb_private::formatters::LibcxxFunctionSummaryProvider( if (process == nullptr) return false; - CPPLanguageRuntime *cpp_runtime = process->GetCPPLanguageRuntime(); + CPPLanguageRuntime *cpp_runtime = + CPPLanguageRuntime::GetCPPLanguageRuntime(*process); if (!cpp_runtime) return false; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 8a0b5bf392cc..7ea3d6b32e8c 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -462,7 +462,7 @@ lldb::SearchFilterSP AppleObjCRuntime::CreateExceptionSearchFilter() { ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread( ThreadSP thread_sp) { - auto cpp_runtime = m_process->GetCPPLanguageRuntime(); + auto *cpp_runtime = m_process->GetLanguageRuntime(eLanguageTypeC_plus_plus); if (!cpp_runtime) return ValueObjectSP(); auto cpp_exception = cpp_runtime->GetExceptionObjectForThread(thread_sp); if (!cpp_exception) return ValueObjectSP(); diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 1d1fda18e3dd..b46ded442b4e 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -1598,16 +1598,6 @@ LanguageRuntime *Process::GetLanguageRuntime(lldb::LanguageType language, return runtime; } -CPPLanguageRuntime *Process::GetCPPLanguageRuntime(bool retry_if_null) { - std::lock_guard guard(m_language_runtimes_mutex); - LanguageRuntime *runtime = - GetLanguageRuntime(eLanguageTypeC_plus_plus, retry_if_null); - if (!runtime) - return nullptr; - - return static_cast(runtime); -} - ObjCLanguageRuntime *Process::GetObjCLanguageRuntime(bool retry_if_null) { std::lock_guard guard(m_language_runtimes_mutex); LanguageRuntime *runtime =