[Lldb-commits] [lldb] r361666 - [Process] Clean up some logic around LanguageRuntimes

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Fri May 24 12:39:50 PDT 2019


Author: xiaobai
Date: Fri May 24 12:39:50 2019
New Revision: 361666

URL: http://llvm.org/viewvc/llvm-project?rev=361666&view=rev
Log:
[Process] Clean up some logic around LanguageRuntimes

Modified:
    lldb/trunk/source/Target/Process.cpp

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=361666&r1=361665&r2=361666&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Fri May 24 12:39:50 2019
@@ -1569,19 +1569,22 @@ CPPLanguageRuntime *Process::GetCPPLangu
   std::lock_guard<std::recursive_mutex> guard(m_language_runtimes_mutex);
   LanguageRuntime *runtime =
       GetLanguageRuntime(eLanguageTypeC_plus_plus, retry_if_null);
-  if (runtime != nullptr &&
-      runtime->GetLanguageType() == eLanguageTypeC_plus_plus)
-    return static_cast<CPPLanguageRuntime *>(runtime);
-  return nullptr;
+  if (!runtime)
+    return nullptr;
+
+  assert(runtime->GetLanguageType() == eLanguageTypeC_plus_plus);
+  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 =
       GetLanguageRuntime(eLanguageTypeObjC, retry_if_null);
-  if (runtime != nullptr && runtime->GetLanguageType() == eLanguageTypeObjC)
-    return static_cast<ObjCLanguageRuntime *>(runtime);
-  return nullptr;
+  if (!runtime)
+    return nullptr;
+
+  assert(runtime->GetLanguageType() == eLanguageTypeObjC);
+  return static_cast<ObjCLanguageRuntime *>(runtime);
 }
 
 bool Process::IsPossibleDynamicValue(ValueObject &in_value) {




More information about the lldb-commits mailing list