This revision was automatically updated to reflect the committed changes.
Closed by commit rL362981: [Target] Remove Process::GetObjCLanguageRuntime 
(authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63052/new/

https://reviews.llvm.org/D63052

Files:
  lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
  lldb/trunk/include/lldb/Target/Process.h
  lldb/trunk/include/lldb/lldb-forward.h
  lldb/trunk/source/API/SBTarget.cpp
  lldb/trunk/source/Core/ValueObject.cpp
  lldb/trunk/source/Expression/IRDynamicChecks.cpp
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/trunk/source/Plugins/Language/ObjC/CF.cpp
  lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
  lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
  lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
  lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp
  lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp
  lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp
  lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
  lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
  lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
  lldb/trunk/source/Symbol/ClangASTContext.cpp
  lldb/trunk/source/Target/Process.cpp

Index: lldb/trunk/source/API/SBTarget.cpp
===================================================================
--- lldb/trunk/source/API/SBTarget.cpp
+++ lldb/trunk/source/API/SBTarget.cpp
@@ -1854,7 +1854,7 @@
 
     if (process_sp) {
       ObjCLanguageRuntime *objc_language_runtime =
-          process_sp->GetObjCLanguageRuntime();
+          ObjCLanguageRuntime::Get(*process_sp);
 
       if (objc_language_runtime) {
         DeclVendor *objc_decl_vendor = objc_language_runtime->GetDeclVendor();
@@ -1924,7 +1924,7 @@
 
     if (process_sp) {
       ObjCLanguageRuntime *objc_language_runtime =
-          process_sp->GetObjCLanguageRuntime();
+          ObjCLanguageRuntime::Get(*process_sp);
 
       if (objc_language_runtime) {
         DeclVendor *objc_decl_vendor = objc_language_runtime->GetDeclVendor();
Index: lldb/trunk/source/Core/ValueObject.cpp
===================================================================
--- lldb/trunk/source/Core/ValueObject.cpp
+++ lldb/trunk/source/Core/ValueObject.cpp
@@ -302,7 +302,7 @@
 
       if (process_sp) {
         ObjCLanguageRuntime *objc_language_runtime(
-            process_sp->GetObjCLanguageRuntime());
+            ObjCLanguageRuntime::Get(*process_sp));
 
         if (objc_language_runtime) {
           TypeSP complete_objc_class_type_sp =
@@ -1699,7 +1699,7 @@
     LanguageRuntime *runtime =
         process->GetLanguageRuntime(GetObjectRuntimeLanguage());
     if (!runtime)
-      runtime = process->GetObjCLanguageRuntime();
+      runtime = ObjCLanguageRuntime::Get(*process);
     if (runtime)
       return runtime->IsRuntimeSupportValue(*this);
     // If there is no language runtime, trust the compiler to mark all
@@ -3399,4 +3399,3 @@
     return m_root_valobj_sp->GetFrameSP();
   return lldb::StackFrameSP();
 }
-
Index: lldb/trunk/source/Target/Process.cpp
===================================================================
--- lldb/trunk/source/Target/Process.cpp
+++ lldb/trunk/source/Target/Process.cpp
@@ -47,7 +47,6 @@
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/MemoryHistory.h"
 #include "lldb/Target/MemoryRegionInfo.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/OperatingSystem.h"
 #include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
@@ -1597,13 +1596,6 @@
   return 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);
-  return llvm::cast_or_null<ObjCLanguageRuntime>(runtime);
-}
-
 bool Process::IsPossibleDynamicValue(ValueObject &in_value) {
   if (m_finalizing)
     return false;
Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -5035,7 +5035,7 @@
       ExecutionContext exe_ctx(exe_scope);
       Process *process = exe_ctx.GetProcessPtr();
       if (process) {
-        ObjCLanguageRuntime *objc_runtime = process->GetObjCLanguageRuntime();
+        ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
         if (objc_runtime) {
           uint64_t bit_size = 0;
           if (objc_runtime->GetTypeBitSize(
@@ -6842,7 +6842,7 @@
                   process = exe_ctx->GetProcessPtr();
                 if (process) {
                   ObjCLanguageRuntime *objc_runtime =
-                      process->GetObjCLanguageRuntime();
+                      ObjCLanguageRuntime::Get(*process);
                   if (objc_runtime != nullptr) {
                     CompilerType parent_ast_type(getASTContext(),
                                                  parent_qual_type);
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -42,6 +42,7 @@
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
@@ -591,7 +592,7 @@
     }
 
     Process *process = m_exe_ctx.GetProcessPtr();
-    ObjCLanguageRuntime *objc_runtime = process->GetObjCLanguageRuntime();
+    ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
     if (objc_runtime) {
       auto iterators_pair = objc_runtime->GetDescriptorIteratorPair();
       auto iterator = iterators_pair.first;
@@ -693,7 +694,7 @@
 
     Process *process = m_exe_ctx.GetProcessPtr();
     ExecutionContext exe_ctx(process);
-    ObjCLanguageRuntime *objc_runtime = process->GetObjCLanguageRuntime();
+    ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
     if (objc_runtime) {
       ObjCLanguageRuntime::TaggedPointerVendor *tagged_ptr_vendor =
           objc_runtime->GetTaggedPointerVendor();
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
===================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
@@ -171,7 +171,7 @@
                   target_addr);
 
     ObjCLanguageRuntime *objc_runtime =
-        GetThread().GetProcess()->GetObjCLanguageRuntime();
+        ObjCLanguageRuntime::Get(*GetThread().GetProcess());
     assert(objc_runtime != nullptr);
     objc_runtime->AddToMethodCache(m_isa_addr, m_sel_addr, target_addr);
     if (log)
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
===================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -457,8 +457,9 @@
     size_t num_modules = target_modules.GetSize();
     if (!m_objc_module_sp) {
       for (size_t i = 0; i < num_modules; i++) {
-        if (process_sp->GetObjCLanguageRuntime()->IsModuleObjCLibrary(
-                target_modules.GetModuleAtIndexUnlocked(i))) {
+        if (ObjCLanguageRuntime::Get(*process_sp)
+                ->IsModuleObjCLibrary(
+                    target_modules.GetModuleAtIndexUnlocked(i))) {
           m_objc_module_sp = target_modules.GetModuleAtIndexUnlocked(i);
           break;
         }
@@ -1036,7 +1037,7 @@
                     isa_addr, sel_addr);
       }
       ObjCLanguageRuntime *objc_runtime =
-          thread.GetProcess()->GetObjCLanguageRuntime();
+          ObjCLanguageRuntime::Get(*thread.GetProcess());
       assert(objc_runtime != nullptr);
 
       impl_addr = objc_runtime->LookupInMethodCache(isa_addr, sel_addr);
Index: lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
@@ -347,7 +347,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime =  process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -437,8 +437,8 @@
   lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
   if (!process_sp)
     return nullptr;
-  AppleObjCRuntime *runtime =
-      llvm::dyn_cast_or_null<AppleObjCRuntime>(process_sp->GetObjCLanguageRuntime());
+  AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
+      ObjCLanguageRuntime::Get(*process_sp));
   if (!runtime)
     return nullptr;
 
Index: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp
@@ -179,7 +179,7 @@
   lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
   if (!process_sp)
     return nullptr;
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
   if (!runtime)
     return nullptr;
 
Index: lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
@@ -225,7 +225,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -302,7 +302,7 @@
   lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
   if (!process_sp)
     return nullptr;
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
   if (!runtime)
     return nullptr;
 
Index: lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp
@@ -187,7 +187,7 @@
   lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
   if (!process_sp)
     return nullptr;
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
   if (!runtime)
     return nullptr;
 
Index: lldb/trunk/source/Plugins/Language/ObjC/CF.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/CF.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/CF.cpp
@@ -50,7 +50,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -112,7 +112,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -232,7 +232,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
Index: lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp
@@ -68,7 +68,7 @@
     if (!process_sp)
       return false;
 
-    ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+    ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
     if (!runtime)
       return false;
Index: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
@@ -43,7 +43,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -91,7 +91,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -136,7 +136,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -181,7 +181,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -227,7 +227,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -416,7 +416,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -472,10 +472,9 @@
       return true;
     } else {
       Status error;
-      
-      AppleObjCRuntime *runtime =
-      llvm::dyn_cast_or_null<AppleObjCRuntime>(
-          process_sp->GetObjCLanguageRuntime());
+
+      AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
+          ObjCLanguageRuntime::Get(*process_sp));
 
       const bool new_format =
           (runtime && runtime->GetFoundationVersion() >= 1400);
@@ -667,7 +666,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -781,7 +780,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -848,7 +847,7 @@
   // Accomodate for the __NSTaggedDate format introduced in Foundation 1600.
   if (class_name == g___NSTaggedDate) {
     auto *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
-        process_sp->GetObjCLanguageRuntime());
+        ObjCLanguageRuntime::Get(*process_sp));
     if (runtime && runtime->GetFoundationVersion() >= 1600)
       date_value = decodeTaggedTimeInterval(value_bits << 4);
   }
@@ -876,7 +875,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -935,7 +934,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -1035,7 +1034,7 @@
     return false;
 
   if (AppleObjCRuntime *objc_runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
-          process_sp->GetObjCLanguageRuntime())) {
+          ObjCLanguageRuntime::Get(*process_sp))) {
     lldb::addr_t cf_true = LLDB_INVALID_ADDRESS,
                  cf_false = LLDB_INVALID_ADDRESS;
     objc_runtime->GetValuesForGlobalCFBooleans(cf_true, cf_false);
Index: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -890,7 +890,7 @@
       lldb::ProcessSP process_sp = valobj.GetProcessSP();
       if (!process_sp)
         break;
-      ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+      ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
       if (runtime == nullptr)
         break;
       ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp(
@@ -934,8 +934,7 @@
 
       Process *process = exe_scope->CalculateProcess().get();
       if (process) {
-        const bool create_on_demand = false;
-        auto objc_runtime = process->GetObjCLanguageRuntime(create_on_demand);
+        auto objc_runtime = ObjCLanguageRuntime::Get(*process);
         if (objc_runtime) {
           auto decl_vendor = objc_runtime->GetDeclVendor();
           if (decl_vendor) {
Index: lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
@@ -344,7 +344,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
@@ -797,7 +797,7 @@
   if (!process_sp)
     return nullptr;
   AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
-      process_sp->GetObjCLanguageRuntime());
+      ObjCLanguageRuntime::Get(*process_sp));
   if (!runtime)
     return nullptr;
 
Index: lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
===================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
+++ lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
@@ -59,7 +59,7 @@
   if (!process_sp)
     return false;
 
-  ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process_sp);
 
   if (!runtime)
     return false;
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -90,7 +90,7 @@
       if (!process)
         break;
 
-      ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
+      ObjCLanguageRuntime *language_runtime(ObjCLanguageRuntime::Get(*process));
 
       if (!language_runtime)
         break;
@@ -479,7 +479,7 @@
   if (!process)
     return nullptr;
 
-  ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
+  ObjCLanguageRuntime *language_runtime(ObjCLanguageRuntime::Get(*process));
 
   if (!language_runtime)
     return nullptr;
@@ -950,7 +950,7 @@
           break;
 
         ObjCLanguageRuntime *language_runtime(
-            process->GetObjCLanguageRuntime());
+            ObjCLanguageRuntime::Get(*process));
 
         if (!language_runtime)
           break;
@@ -1401,7 +1401,7 @@
     if (!process)
       break;
 
-    ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
+    ObjCLanguageRuntime *language_runtime(ObjCLanguageRuntime::Get(*process));
 
     if (!language_runtime)
       break;
@@ -1593,7 +1593,7 @@
     if (!process)
       return;
 
-    ObjCLanguageRuntime *language_runtime(process->GetObjCLanguageRuntime());
+    ObjCLanguageRuntime *language_runtime(ObjCLanguageRuntime::Get(*process));
 
     if (!language_runtime)
       return;
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
===================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -698,7 +698,7 @@
   }
 
   if (symbol_load_addr == LLDB_INVALID_ADDRESS && process) {
-    ObjCLanguageRuntime *runtime = process->GetObjCLanguageRuntime();
+    ObjCLanguageRuntime *runtime = ObjCLanguageRuntime::Get(*process);
 
     if (runtime) {
       symbol_load_addr = runtime->LookupRuntimeSymbol(name);
Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -512,15 +512,15 @@
   }
 
   if (process_sp && lang_opts.ObjC) {
-    if (process_sp->GetObjCLanguageRuntime()) {
-      if (process_sp->GetObjCLanguageRuntime()->GetRuntimeVersion() ==
+    if (auto *runtime = ObjCLanguageRuntime::Get(*process_sp)) {
+      if (runtime->GetRuntimeVersion() ==
           ObjCLanguageRuntime::ObjCRuntimeVersions::eAppleObjC_V2)
         lang_opts.ObjCRuntime.set(ObjCRuntime::MacOSX, VersionTuple(10, 7));
       else
         lang_opts.ObjCRuntime.set(ObjCRuntime::FragileMacOSX,
                                   VersionTuple(10, 7));
 
-      if (process_sp->GetObjCLanguageRuntime()->HasNewLiteralsAndIndexing())
+      if (runtime->HasNewLiteralsAndIndexing())
         lang_opts.DebuggerObjCLiteral = true;
     }
   }
Index: lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
===================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
+++ lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
@@ -693,7 +693,7 @@
   if (module_sp.get() == nullptr)
     return false;
 
-  ObjCLanguageRuntime *objc_runtime = m_process->GetObjCLanguageRuntime();
+  ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*m_process);
   return objc_runtime != nullptr &&
          objc_runtime->IsModuleObjCLibrary(module_sp);
 }
Index: lldb/trunk/source/Expression/IRDynamicChecks.cpp
===================================================================
--- lldb/trunk/source/Expression/IRDynamicChecks.cpp
+++ lldb/trunk/source/Expression/IRDynamicChecks.cpp
@@ -61,7 +61,7 @@
 
   if (process) {
     ObjCLanguageRuntime *objc_language_runtime =
-        process->GetObjCLanguageRuntime();
+        ObjCLanguageRuntime::Get(*process);
 
     if (objc_language_runtime) {
       m_objc_object_check.reset(objc_language_runtime->CreateObjectChecker(
Index: lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
===================================================================
--- lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
+++ lldb/trunk/include/lldb/Target/ObjCLanguageRuntime.h
@@ -199,6 +199,11 @@
     return runtime->isA(&ID);
   }
 
+  static ObjCLanguageRuntime *Get(Process &process) {
+    return llvm::cast_or_null<ObjCLanguageRuntime>(
+        process.GetLanguageRuntime(lldb::eLanguageTypeObjC));
+  }
+
   virtual TaggedPointerVendor *GetTaggedPointerVendor() { return nullptr; }
 
   typedef std::shared_ptr<EncodingToType> EncodingToTypeSP;
Index: lldb/trunk/include/lldb/Target/Process.h
===================================================================
--- lldb/trunk/include/lldb/Target/Process.h
+++ lldb/trunk/include/lldb/Target/Process.h
@@ -2184,8 +2184,6 @@
   LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
                                       bool retry_if_null = true);
 
-  ObjCLanguageRuntime *GetObjCLanguageRuntime(bool retry_if_null = true);
-
   bool IsPossibleDynamicValue(ValueObject &in_value);
 
   bool IsRunning() const;
Index: lldb/trunk/include/lldb/lldb-forward.h
===================================================================
--- lldb/trunk/include/lldb/lldb-forward.h
+++ lldb/trunk/include/lldb/lldb-forward.h
@@ -130,7 +130,6 @@
 class ModuleSpec;
 class ModuleSpecList;
 struct NameSearchContext;
-class ObjCLanguageRuntime;
 class ObjectContainer;
 class OptionGroup;
 class OptionGroupOptions;
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to