diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index e5ad47386309..82051d51f430 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1112,14 +1112,14 @@ public: if (class_method_func) { - ObjCLanguageRuntime::ClassDescriptorSP metaclass = m_runtime.ObjCLanguageRuntime::GetClassDescriptor(objc_class->m_isa); + ClassDescriptorV2 metaclass(m_runtime, :q!objc_class->m_isa); // The metaclass is not in the cache // We don't care about the metaclass's superclass, or its class methods. Its instance methods are // our class methods. - metaclass->Describe(std::function (nullptr), - class_method_func, - std::function (nullptr)); + metaclass.Describe(std::function (nullptr), + class_method_func, + std::function (nullptr)); } while (0); @@ -1670,10 +1670,14 @@ private: ObjCLanguageRuntime::ClassDescriptorSP AppleObjCRuntimeV2::CreateClassDescriptor (ObjCISA isa) { - ClassDescriptorSP objc_class_sp; - if (isa != 0) - objc_class_sp.reset (new ClassDescriptorV2(*this, isa)); - return objc_class_sp; + UpdateISAToDescriptorMap(); + + ISAToDescriptorMap::const_iterator di = m_isa_to_descriptor_cache.find(isa); + + if (di == m_isa_to_descriptor_cache.end()) + return ObjCLanguageRuntime::ClassDescriptorSP(); + else + return di->second; } ObjCLanguageRuntime::ClassDescriptorSP