forked from OSchip/llvm-project
[Target] Sink some asserts into Process::GetLanguageRuntime
llvm-svn: 362032
This commit is contained in:
parent
79b3ea701c
commit
7d3e97fbe6
|
@ -1574,17 +1574,28 @@ LanguageRuntime *Process::GetLanguageRuntime(lldb::LanguageType language,
|
|||
if (m_finalizing)
|
||||
return nullptr;
|
||||
|
||||
LanguageRuntime *runtime = nullptr;
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(m_language_runtimes_mutex);
|
||||
LanguageRuntimeCollection::iterator pos;
|
||||
pos = m_language_runtimes.find(language);
|
||||
if (pos == m_language_runtimes.end() || (retry_if_null && !(*pos).second)) {
|
||||
if (pos == m_language_runtimes.end() || (retry_if_null && !pos->second)) {
|
||||
lldb::LanguageRuntimeSP runtime_sp(
|
||||
LanguageRuntime::FindPlugin(this, language));
|
||||
|
||||
m_language_runtimes[language] = runtime_sp;
|
||||
return runtime_sp.get();
|
||||
runtime = runtime_sp.get();
|
||||
} else
|
||||
return (*pos).second.get();
|
||||
runtime = pos->second.get();
|
||||
|
||||
if (runtime)
|
||||
// It's possible that a language runtime can support multiple LanguageTypes,
|
||||
// for example, CPPLanguageRuntime will support eLanguageTypeC_plus_plus,
|
||||
// eLanguageTypeC_plus_plus_03, etc. Because of this, we should get the
|
||||
// primary language type and make sure that our runtime supports it.
|
||||
assert(runtime->GetLanguageType() == Language::GetPrimaryLanguage(language));
|
||||
|
||||
return runtime;
|
||||
}
|
||||
|
||||
CPPLanguageRuntime *Process::GetCPPLanguageRuntime(bool retry_if_null) {
|
||||
|
@ -1594,7 +1605,6 @@ CPPLanguageRuntime *Process::GetCPPLanguageRuntime(bool retry_if_null) {
|
|||
if (!runtime)
|
||||
return nullptr;
|
||||
|
||||
assert(runtime->GetLanguageType() == eLanguageTypeC_plus_plus);
|
||||
return static_cast<CPPLanguageRuntime *>(runtime);
|
||||
}
|
||||
|
||||
|
@ -1605,7 +1615,6 @@ ObjCLanguageRuntime *Process::GetObjCLanguageRuntime(bool retry_if_null) {
|
|||
if (!runtime)
|
||||
return nullptr;
|
||||
|
||||
assert(runtime->GetLanguageType() == eLanguageTypeObjC);
|
||||
return static_cast<ObjCLanguageRuntime *>(runtime);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue