[Lldb-commits] [PATCH] D62755: [Target] Remove Process::GetCPPLanguageRuntime
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 31 15:28:46 PDT 2019
xiaobai created this revision.
xiaobai added reviewers: compnerd, davide, JDevlieghere, jingham, clayborg, labath, aprantl.
I want to remove this method because I think that Process should be
language agnostic, or at least, not have knowledge about specific language
runtimes. There is "GetLanguageRuntime()" which should be used instead. If the
caller a CPPLanguageRuntime, they should cast it as needed. Ideally, this
should only happen in plugins that need C++ specific knowledge.
The next step I would like to do is remove "GetObjCLanguageRuntime()" as well.
There are a lot more instances of that function being used, so I wanted to
upload this one first to get the general reception to this idea.
https://reviews.llvm.org/D62755
Files:
include/lldb/Target/Process.h
source/Plugins/Language/CPlusPlus/LibCxx.cpp
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
source/Target/Process.cpp
Index: source/Target/Process.cpp
===================================================================
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -1598,16 +1598,6 @@
return runtime;
}
-CPPLanguageRuntime *Process::GetCPPLanguageRuntime(bool retry_if_null) {
- std::lock_guard<std::recursive_mutex> guard(m_language_runtimes_mutex);
- LanguageRuntime *runtime =
- GetLanguageRuntime(eLanguageTypeC_plus_plus, retry_if_null);
- if (!runtime)
- return nullptr;
-
- return static_cast<CPPLanguageRuntime *>(runtime);
-}
-
ObjCLanguageRuntime *Process::GetObjCLanguageRuntime(bool retry_if_null) {
std::lock_guard<std::recursive_mutex> guard(m_language_runtimes_mutex);
LanguageRuntime *runtime =
Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===================================================================
--- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -462,7 +462,8 @@
ValueObjectSP AppleObjCRuntime::GetExceptionObjectForThread(
ThreadSP thread_sp) {
- auto cpp_runtime = m_process->GetCPPLanguageRuntime();
+ auto *cpp_runtime = static_cast<CPPLanguageRuntime *>(
+ m_process->GetLanguageRuntime(eLanguageTypeC_plus_plus));
if (!cpp_runtime) return ValueObjectSP();
auto cpp_exception = cpp_runtime->GetExceptionObjectForThread(thread_sp);
if (!cpp_exception) return ValueObjectSP();
Index: source/Plugins/Language/CPlusPlus/LibCxx.cpp
===================================================================
--- source/Plugins/Language/CPlusPlus/LibCxx.cpp
+++ source/Plugins/Language/CPlusPlus/LibCxx.cpp
@@ -67,7 +67,8 @@
if (process == nullptr)
return false;
- CPPLanguageRuntime *cpp_runtime = process->GetCPPLanguageRuntime();
+ CPPLanguageRuntime *cpp_runtime = static_cast<CPPLanguageRuntime *>(
+ process->GetLanguageRuntime(eLanguageTypeC_plus_plus));
if (!cpp_runtime)
return false;
Index: include/lldb/Target/Process.h
===================================================================
--- include/lldb/Target/Process.h
+++ include/lldb/Target/Process.h
@@ -2184,8 +2184,6 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62755.202497.patch
Type: text/x-patch
Size: 2572 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190531/bc6e5d5c/attachment-0001.bin>
More information about the lldb-commits
mailing list