Index: include/lldb/Target/CPPLanguageRuntime.h =================================================================== --- include/lldb/Target/CPPLanguageRuntime.h +++ include/lldb/Target/CPPLanguageRuntime.h @@ -39,12 +39,17 @@ ~CPPLanguageRuntime() override; + static bool classof(const LanguageRuntime *runtime) { + return runtime->GetKind() >= eItaniumABILanguageRuntime && + runtime->GetKind() < eLastCPPLanguageRuntime; + } + lldb::LanguageType GetLanguageType() const override { return lldb::eLanguageTypeC_plus_plus; } static CPPLanguageRuntime *GetCPPLanguageRuntime(Process &process) { - return static_cast( + return llvm::cast_or_null( process.GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus)); } @@ -71,7 +76,7 @@ bool IsRuntimeSupportValue(ValueObject &valobj) override; protected: // Classes that inherit from CPPLanguageRuntime can see and modify these - CPPLanguageRuntime(Process *process); + CPPLanguageRuntime(Process *process, LanguageRuntimeKind kind); private: DISALLOW_COPY_AND_ASSIGN(CPPLanguageRuntime); Index: include/lldb/Target/LanguageRuntime.h =================================================================== --- include/lldb/Target/LanguageRuntime.h +++ include/lldb/Target/LanguageRuntime.h @@ -175,13 +175,29 @@ return LLDB_INVALID_ADDRESS; } + enum LanguageRuntimeKind { + eItaniumABILanguageRuntime, + eRenderScriptLanguageRuntime, + eLastCPPLanguageRuntime, + eAppleObjCLanguageRuntimeV1, + eAppleObjCLanguageRuntimeV2, + eLastObjCLanguageRuntime, + }; + + LanguageRuntimeKind + GetKind() const { + return m_kind; + } + protected: // Classes that inherit from LanguageRuntime can see and modify these - LanguageRuntime(Process *process); + LanguageRuntime(Process *process, LanguageRuntimeKind kind); Process *m_process; private: + const LanguageRuntimeKind m_kind; + DISALLOW_COPY_AND_ASSIGN(LanguageRuntime); }; Index: include/lldb/Target/ObjCLanguageRuntime.h =================================================================== --- include/lldb/Target/ObjCLanguageRuntime.h +++ include/lldb/Target/ObjCLanguageRuntime.h @@ -189,6 +189,11 @@ ~ObjCLanguageRuntime() override; + static bool classof(const LanguageRuntime *runtime) { + return runtime->GetKind() >= eAppleObjCLanguageRuntimeV1 && + runtime->GetKind() < eLastObjCLanguageRuntime; + } + virtual TaggedPointerVendor *GetTaggedPointerVendor() { return nullptr; } typedef std::shared_ptr EncodingToTypeSP; @@ -289,7 +294,7 @@ protected: // Classes that inherit from ObjCLanguageRuntime can see and modify these - ObjCLanguageRuntime(Process *process); + ObjCLanguageRuntime(Process *process, LanguageRuntimeKind kind); virtual bool CalculateHasNewLiteralsAndIndexing() { return false; } Index: source/Plugins/Language/ObjC/CF.cpp =================================================================== --- source/Plugins/Language/ObjC/CF.cpp +++ source/Plugins/Language/ObjC/CF.cpp @@ -50,9 +50,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -114,9 +112,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -236,9 +232,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; Index: source/Plugins/Language/ObjC/Cocoa.cpp =================================================================== --- source/Plugins/Language/ObjC/Cocoa.cpp +++ source/Plugins/Language/ObjC/Cocoa.cpp @@ -43,9 +43,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -93,9 +91,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -140,9 +136,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -187,9 +181,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -235,9 +227,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -426,9 +416,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -679,9 +667,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -795,9 +781,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -892,9 +876,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -953,9 +935,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -1054,8 +1034,8 @@ if (!process_sp) return false; - if (AppleObjCRuntime *objc_runtime = - (AppleObjCRuntime *)process_sp->GetObjCLanguageRuntime()) { + if (AppleObjCRuntime *objc_runtime = llvm::dyn_cast_or_null( + process_sp->GetObjCLanguageRuntime())) { lldb::addr_t cf_true = LLDB_INVALID_ADDRESS, cf_false = LLDB_INVALID_ADDRESS; objc_runtime->GetValuesForGlobalCFBooleans(cf_true, cf_false); Index: source/Plugins/Language/ObjC/NSArray.cpp =================================================================== --- source/Plugins/Language/ObjC/NSArray.cpp +++ source/Plugins/Language/ObjC/NSArray.cpp @@ -344,9 +344,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; Index: source/Plugins/Language/ObjC/NSDictionary.cpp =================================================================== --- source/Plugins/Language/ObjC/NSDictionary.cpp +++ source/Plugins/Language/ObjC/NSDictionary.cpp @@ -347,9 +347,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; Index: source/Plugins/Language/ObjC/NSError.cpp =================================================================== --- source/Plugins/Language/ObjC/NSError.cpp +++ source/Plugins/Language/ObjC/NSError.cpp @@ -187,9 +187,7 @@ lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) return nullptr; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return nullptr; Index: source/Plugins/Language/ObjC/NSException.cpp =================================================================== --- source/Plugins/Language/ObjC/NSException.cpp +++ source/Plugins/Language/ObjC/NSException.cpp @@ -179,9 +179,7 @@ lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) return nullptr; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return nullptr; Index: source/Plugins/Language/ObjC/NSIndexPath.cpp =================================================================== --- source/Plugins/Language/ObjC/NSIndexPath.cpp +++ source/Plugins/Language/ObjC/NSIndexPath.cpp @@ -68,9 +68,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; Index: source/Plugins/Language/ObjC/NSSet.cpp =================================================================== --- source/Plugins/Language/ObjC/NSSet.cpp +++ source/Plugins/Language/ObjC/NSSet.cpp @@ -225,9 +225,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; @@ -304,9 +302,7 @@ lldb::ProcessSP process_sp(valobj_sp->GetProcessSP()); if (!process_sp) return nullptr; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return nullptr; Index: source/Plugins/Language/ObjC/NSString.cpp =================================================================== --- source/Plugins/Language/ObjC/NSString.cpp +++ source/Plugins/Language/ObjC/NSString.cpp @@ -59,9 +59,7 @@ if (!process_sp) return false; - ObjCLanguageRuntime *runtime = - (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime( - lldb::eLanguageTypeObjC); + ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime(); if (!runtime) return false; Index: source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h =================================================================== --- source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h +++ source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h @@ -36,6 +36,10 @@ static lldb_private::ConstString GetPluginNameStatic(); + static bool classof(const LanguageRuntime *runtime) { + return runtime->GetKind() == eItaniumABILanguageRuntime; + } + bool IsVTableName(const char *name) override; bool GetDynamicTypeAndAddress(ValueObject &in_value, @@ -86,7 +90,7 @@ ItaniumABILanguageRuntime(Process *process) : // Call CreateInstance instead. - lldb_private::CPPLanguageRuntime(process), + lldb_private::CPPLanguageRuntime(process, eItaniumABILanguageRuntime), m_cxx_exception_bp_sp(), m_dynamic_type_map(), m_dynamic_type_map_mutex() {} Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h @@ -28,14 +28,9 @@ // because // you can't make an instance of this generic runtime. - static bool classof(const ObjCLanguageRuntime *runtime) { - switch (runtime->GetRuntimeVersion()) { - case ObjCRuntimeVersions::eAppleObjC_V1: - case ObjCRuntimeVersions::eAppleObjC_V2: - return true; - default: - return false; - } + static bool classof(const LanguageRuntime *runtime) { + return runtime->GetKind() == eAppleObjCLanguageRuntimeV1 || + runtime->GetKind() == eAppleObjCLanguageRuntimeV2; } // These are generic runtime functions: @@ -101,7 +96,7 @@ protected: // Call CreateInstance instead. - AppleObjCRuntime(Process *process); + AppleObjCRuntime(Process *process, LanguageRuntimeKind kind); bool CalculateHasNewLiteralsAndIndexing() override; Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -47,8 +47,8 @@ AppleObjCRuntime::~AppleObjCRuntime() {} -AppleObjCRuntime::AppleObjCRuntime(Process *process) - : ObjCLanguageRuntime(process), m_read_objc_library(false), +AppleObjCRuntime::AppleObjCRuntime(Process *process, LanguageRuntimeKind kind) + : ObjCLanguageRuntime(process, kind), m_read_objc_library(false), m_objc_trampoline_handler_up(), m_Foundation_major() { ReadObjCLibraryIfNeeded(process->GetTarget().GetImages()); } Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h @@ -29,13 +29,8 @@ static lldb_private::ConstString GetPluginNameStatic(); - static bool classof(const ObjCLanguageRuntime *runtime) { - switch (runtime->GetRuntimeVersion()) { - case ObjCRuntimeVersions::eAppleObjC_V1: - return true; - default: - return false; - } + static bool classof(const LanguageRuntime *runtime) { + return runtime->GetKind() == eAppleObjCLanguageRuntimeV1; } lldb::addr_t GetTaggedPointerObfuscator(); Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp @@ -38,8 +38,8 @@ using namespace lldb_private; AppleObjCRuntimeV1::AppleObjCRuntimeV1(Process *process) - : AppleObjCRuntime(process), m_hash_signature(), - m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS) {} + : AppleObjCRuntime(process, eAppleObjCLanguageRuntimeV1), + m_hash_signature(), m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS) {} // for V1 runtime we just try to return a class name as that is the minimum // level of support required for the data formatters to work Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -35,13 +35,8 @@ static lldb_private::ConstString GetPluginNameStatic(); - static bool classof(const ObjCLanguageRuntime *runtime) { - switch (runtime->GetRuntimeVersion()) { - case ObjCRuntimeVersions::eAppleObjC_V2: - return true; - default: - return false; - } + static bool classof(const LanguageRuntime *runtime) { + return runtime->GetKind() == eAppleObjCLanguageRuntimeV2; } // These are generic runtime functions: Index: source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp =================================================================== --- source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -399,8 +399,8 @@ AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process, const ModuleSP &objc_module_sp) - : AppleObjCRuntime(process), m_get_class_info_code(), - m_get_class_info_args(LLDB_INVALID_ADDRESS), + : AppleObjCRuntime(process, eAppleObjCLanguageRuntimeV2), + m_get_class_info_code(), m_get_class_info_args(LLDB_INVALID_ADDRESS), m_get_class_info_args_mutex(), m_get_shared_cache_class_info_code(), m_get_shared_cache_class_info_args(LLDB_INVALID_ADDRESS), m_get_shared_cache_class_info_args_mutex(), m_decl_vendor_up(), Index: source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h =================================================================== --- source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -314,6 +314,10 @@ static lldb_private::ConstString GetPluginNameStatic(); + static bool classof(const LanguageRuntime *runtime) { + return runtime->GetKind() == eRenderScriptLanguageRuntime; + } + static bool IsRenderScriptModule(const lldb::ModuleSP &module_sp); static ModuleKind GetModuleKind(const lldb::ModuleSP &module_sp); Index: source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -1123,9 +1123,9 @@ RuntimeHook *hook = (RuntimeHook *)baton; ExecutionContext exe_ctx(ctx->exe_ctx_ref); - RenderScriptRuntime *lang_rt = - (RenderScriptRuntime *)exe_ctx.GetProcessPtr()->GetLanguageRuntime( - eLanguageTypeExtRenderScript); + RenderScriptRuntime *lang_rt = llvm::cast_or_null( + exe_ctx.GetProcessPtr()->GetLanguageRuntime( + eLanguageTypeExtRenderScript)); lang_rt->HookCallback(hook, exe_ctx); @@ -4122,9 +4122,9 @@ ~CommandObjectRenderScriptRuntimeModuleDump() override = default; bool DoExecute(Args &command, CommandReturnObject &result) override { - RenderScriptRuntime *runtime = - (RenderScriptRuntime *)m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( - eLanguageTypeExtRenderScript); + RenderScriptRuntime *runtime = llvm::cast_or_null( + m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( + eLanguageTypeExtRenderScript)); runtime->DumpModules(result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); return true; @@ -4157,9 +4157,9 @@ ~CommandObjectRenderScriptRuntimeKernelList() override = default; bool DoExecute(Args &command, CommandReturnObject &result) override { - RenderScriptRuntime *runtime = - (RenderScriptRuntime *)m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( - eLanguageTypeExtRenderScript); + RenderScriptRuntime *runtime = llvm::cast_or_null( + m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( + eLanguageTypeExtRenderScript)); runtime->DumpKernels(result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); return true; @@ -4404,9 +4404,9 @@ return false; } - RenderScriptRuntime *runtime = - (RenderScriptRuntime *)m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( - eLanguageTypeExtRenderScript); + RenderScriptRuntime *runtime = llvm::cast_or_null( + m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( + eLanguageTypeExtRenderScript)); auto &outstream = result.GetOutputStream(); auto &target = m_exe_ctx.GetTargetSP(); @@ -4588,9 +4588,9 @@ ~CommandObjectRenderScriptRuntimeContextDump() override = default; bool DoExecute(Args &command, CommandReturnObject &result) override { - RenderScriptRuntime *runtime = - (RenderScriptRuntime *)m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( - eLanguageTypeExtRenderScript); + RenderScriptRuntime *runtime = llvm::cast_or_null( + m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( + eLanguageTypeExtRenderScript)); runtime->DumpContexts(result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); return true; @@ -4980,9 +4980,9 @@ ~CommandObjectRenderScriptRuntimeStatus() override = default; bool DoExecute(Args &command, CommandReturnObject &result) override { - RenderScriptRuntime *runtime = - (RenderScriptRuntime *)m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( - eLanguageTypeExtRenderScript); + RenderScriptRuntime *runtime = llvm::cast_or_null( + m_exe_ctx.GetProcessPtr()->GetLanguageRuntime( + eLanguageTypeExtRenderScript)); runtime->DumpStatus(result.GetOutputStream()); result.SetStatus(eReturnStatusSuccessFinishResult); return true; @@ -5041,9 +5041,9 @@ void RenderScriptRuntime::Initiate() { assert(!m_initiated); } RenderScriptRuntime::RenderScriptRuntime(Process *process) - : lldb_private::CPPLanguageRuntime(process), m_initiated(false), - m_debuggerPresentFlagged(false), m_breakAllKernels(false), - m_ir_passes(nullptr) { + : lldb_private::CPPLanguageRuntime(process, eRenderScriptLanguageRuntime), + m_initiated(false), m_debuggerPresentFlagged(false), + m_breakAllKernels(false), m_ir_passes(nullptr) { ModulesDidLoad(process->GetTarget().GetImages()); } Index: source/Target/CPPLanguageRuntime.cpp =================================================================== --- source/Target/CPPLanguageRuntime.cpp +++ source/Target/CPPLanguageRuntime.cpp @@ -38,8 +38,9 @@ // Destructor CPPLanguageRuntime::~CPPLanguageRuntime() {} -CPPLanguageRuntime::CPPLanguageRuntime(Process *process) - : LanguageRuntime(process) {} +CPPLanguageRuntime::CPPLanguageRuntime(Process *process, + LanguageRuntimeKind kind) + : LanguageRuntime(process, kind) {} bool CPPLanguageRuntime::IsRuntimeSupportValue(ValueObject &valobj) { // All runtime support values have to be marked as artificial by the Index: source/Target/LanguageRuntime.cpp =================================================================== --- source/Target/LanguageRuntime.cpp +++ source/Target/LanguageRuntime.cpp @@ -218,7 +218,8 @@ return nullptr; } -LanguageRuntime::LanguageRuntime(Process *process) : m_process(process) {} +LanguageRuntime::LanguageRuntime(Process *process, LanguageRuntimeKind kind) + : m_process(process), m_kind(kind) {} LanguageRuntime::~LanguageRuntime() = default; Index: source/Target/ObjCLanguageRuntime.cpp =================================================================== --- source/Target/ObjCLanguageRuntime.cpp +++ source/Target/ObjCLanguageRuntime.cpp @@ -31,8 +31,9 @@ // Destructor ObjCLanguageRuntime::~ObjCLanguageRuntime() {} -ObjCLanguageRuntime::ObjCLanguageRuntime(Process *process) - : LanguageRuntime(process), m_impl_cache(), +ObjCLanguageRuntime::ObjCLanguageRuntime(Process *process, + LanguageRuntimeKind kind) + : LanguageRuntime(process, kind), m_impl_cache(), m_has_new_literals_and_indexing(eLazyBoolCalculate), m_isa_to_descriptor(), m_hash_to_isa_map(), m_type_size_cache(), m_isa_to_descriptor_stop_id(UINT32_MAX), m_complete_class_cache(), Index: source/Target/Process.cpp =================================================================== --- source/Target/Process.cpp +++ source/Target/Process.cpp @@ -1602,10 +1602,7 @@ std::lock_guard guard(m_language_runtimes_mutex); LanguageRuntime *runtime = GetLanguageRuntime(eLanguageTypeObjC, retry_if_null); - if (!runtime) - return nullptr; - - return static_cast(runtime); + return llvm::cast_or_null(runtime); } bool Process::IsPossibleDynamicValue(ValueObject &in_value) {