blob: 078fa5dd510c068deefcc7af304dde99d12a59b2 [file] [log] [blame]
Greg Clayton9b8ff512012-02-01 01:46:19 +00001//===-- ObjCLanguageRuntime.cpp ---------------------------------*- C++ -*-===//
Jim Ingham642036f2010-09-23 02:01:19 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Jim Ingham324067b2010-09-30 00:54:27 +00009#include "clang/AST/Type.h"
Jim Ingham642036f2010-09-23 02:01:19 +000010
Jim Inghamb66cd072010-09-28 01:25:32 +000011#include "lldb/Core/Log.h"
Greg Clayton49ce8962012-08-29 21:13:06 +000012#include "lldb/Core/Module.h"
Jim Ingham642036f2010-09-23 02:01:19 +000013#include "lldb/Core/PluginManager.h"
Greg Claytonf892c422013-01-30 00:18:29 +000014#include "lldb/Core/Timer.h"
Jim Ingham324067b2010-09-30 00:54:27 +000015#include "lldb/Core/ValueObject.h"
16#include "lldb/Symbol/ClangASTContext.h"
Jim Inghamef80aab2011-05-02 18:13:59 +000017#include "lldb/Symbol/Type.h"
Greg Clayton49ce8962012-08-29 21:13:06 +000018#include "lldb/Symbol/TypeList.h"
Jim Inghamb66cd072010-09-28 01:25:32 +000019#include "lldb/Target/ObjCLanguageRuntime.h"
Sean Callanan931acec2012-02-22 23:57:45 +000020#include "lldb/Target/Target.h"
Jim Ingham642036f2010-09-23 02:01:19 +000021
Greg Claytonf892c422013-01-30 00:18:29 +000022#include "llvm/ADT/StringRef.h"
23
Jim Ingham642036f2010-09-23 02:01:19 +000024using namespace lldb;
25using namespace lldb_private;
26
27//----------------------------------------------------------------------
28// Destructor
29//----------------------------------------------------------------------
30ObjCLanguageRuntime::~ObjCLanguageRuntime()
31{
32}
33
34ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) :
Sean Callanan6e12c7a2012-03-08 02:39:03 +000035 LanguageRuntime (process),
Sean Callanan6fe8d362012-09-15 01:05:12 +000036 m_has_new_literals_and_indexing (eLazyBoolCalculate),
Greg Claytona5104372012-10-11 18:07:21 +000037 m_isa_to_descriptor_cache(),
Greg Clayton90c6cd52012-10-25 16:54:22 +000038 m_isa_to_descriptor_cache_stop_id (UINT32_MAX)
Jim Ingham642036f2010-09-23 02:01:19 +000039{
40
Jim Inghamb66cd072010-09-28 01:25:32 +000041}
42
43void
44ObjCLanguageRuntime::AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t selector, lldb::addr_t impl_addr)
45{
Greg Claytone005f2c2010-11-06 01:53:30 +000046 LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
Jim Inghamb66cd072010-09-28 01:25:32 +000047 if (log)
48 {
Daniel Malea5f35a4b2012-11-29 21:49:15 +000049 log->Printf ("Caching: class 0x%" PRIx64 " selector 0x%" PRIx64 " implementation 0x%" PRIx64 ".", class_addr, selector, impl_addr);
Jim Inghamb66cd072010-09-28 01:25:32 +000050 }
51 m_impl_cache.insert (std::pair<ClassAndSel,lldb::addr_t> (ClassAndSel(class_addr, selector), impl_addr));
52}
53
54lldb::addr_t
55ObjCLanguageRuntime::LookupInMethodCache (lldb::addr_t class_addr, lldb::addr_t selector)
56{
57 MsgImplMap::iterator pos, end = m_impl_cache.end();
58 pos = m_impl_cache.find (ClassAndSel(class_addr, selector));
59 if (pos != end)
60 return (*pos).second;
61 return LLDB_INVALID_ADDRESS;
62}
Jim Inghamef80aab2011-05-02 18:13:59 +000063
Jim Ingham58513662011-06-24 22:03:24 +000064
Sean Callanan931acec2012-02-22 23:57:45 +000065lldb::TypeSP
66ObjCLanguageRuntime::LookupInCompleteClassCache (ConstString &name)
67{
68 CompleteClassMap::iterator complete_class_iter = m_complete_class_cache.find(name);
69
70 if (complete_class_iter != m_complete_class_cache.end())
71 {
Greg Claytonef22b902012-10-23 22:41:19 +000072 // Check the weak pointer to make sure the type hasn't been unloaded
73 TypeSP complete_type_sp (complete_class_iter->second.lock());
Sean Callanan931acec2012-02-22 23:57:45 +000074
Greg Claytonef22b902012-10-23 22:41:19 +000075 if (complete_type_sp)
76 return complete_type_sp;
Sean Callanan931acec2012-02-22 23:57:45 +000077 else
Greg Claytonef22b902012-10-23 22:41:19 +000078 m_complete_class_cache.erase(name);
Sean Callanan931acec2012-02-22 23:57:45 +000079 }
80
Enrico Granata146d9522012-11-08 02:22:02 +000081 const ModuleList &modules = m_process->GetTarget().GetImages();
Greg Claytonef22b902012-10-23 22:41:19 +000082
Sean Callanan931acec2012-02-22 23:57:45 +000083 SymbolContextList sc_list;
Greg Claytonef22b902012-10-23 22:41:19 +000084 const size_t matching_symbols = modules.FindSymbolsWithNameAndType (name,
85 eSymbolTypeObjCClass,
86 sc_list);
Sean Callanan931acec2012-02-22 23:57:45 +000087
Greg Claytonef22b902012-10-23 22:41:19 +000088 if (matching_symbols)
Sean Callanan931acec2012-02-22 23:57:45 +000089 {
Greg Claytonef22b902012-10-23 22:41:19 +000090 SymbolContext sc;
Sean Callanan931acec2012-02-22 23:57:45 +000091
Greg Claytonef22b902012-10-23 22:41:19 +000092 sc_list.GetContextAtIndex(0, sc);
93
94 ModuleSP module_sp(sc.module_sp);
95
96 if (!module_sp)
Sean Callanan931acec2012-02-22 23:57:45 +000097 return TypeSP();
Sean Callanan931acec2012-02-22 23:57:45 +000098
Greg Claytonef22b902012-10-23 22:41:19 +000099 const SymbolContext null_sc;
100 const bool exact_match = true;
101 const uint32_t max_matches = UINT32_MAX;
102 TypeList types;
103
104 const uint32_t num_types = module_sp->FindTypes (null_sc,
105 name,
106 exact_match,
107 max_matches,
108 types);
109
110 if (num_types)
Sean Callanan282c22c2012-12-19 23:05:01 +0000111 {
Greg Claytonef22b902012-10-23 22:41:19 +0000112 uint32_t i;
113 for (i = 0; i < num_types; ++i)
114 {
115 TypeSP type_sp (types.GetTypeAtIndex(i));
116
117 if (ClangASTContext::IsObjCClassType(type_sp->GetClangForwardType()))
118 {
119 if (type_sp->IsCompleteObjCClass())
120 {
121 m_complete_class_cache[name] = type_sp;
122 return type_sp;
123 }
Greg Claytonef22b902012-10-23 22:41:19 +0000124 }
125 }
Sean Callanan931acec2012-02-22 23:57:45 +0000126 }
127 }
Sean Callanan931acec2012-02-22 23:57:45 +0000128 return TypeSP();
129}
130
Jim Ingham58513662011-06-24 22:03:24 +0000131size_t
132ObjCLanguageRuntime::GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name)
133{
134 return LLDB_INVALID_IVAR_OFFSET;
135}
136
Greg Claytonf892c422013-01-30 00:18:29 +0000137void
138ObjCLanguageRuntime::MethodName::Clear()
Jim Ingham3ad4da02011-08-15 01:32:22 +0000139{
Greg Claytonf892c422013-01-30 00:18:29 +0000140 m_full.Clear();
141 m_class.Clear();
142 m_category.Clear();
143 m_selector.Clear();
144 m_type = eTypeUnspecified;
145 m_category_is_valid = false;
146}
Greg Clayton662e5672012-01-19 03:24:53 +0000147
Greg Claytonf892c422013-01-30 00:18:29 +0000148//bool
149//ObjCLanguageRuntime::MethodName::SetName (const char *name, bool strict)
150//{
151// Clear();
152// if (name && name[0])
153// {
154// // If "strict" is true. then the method must be specified with a
155// // '+' or '-' at the beginning. If "strict" is false, then the '+'
156// // or '-' can be omitted
157// bool valid_prefix = false;
158//
159// if (name[0] == '+' || name[0] == '-')
160// {
161// valid_prefix = name[1] == '[';
162// }
163// else if (!strict)
164// {
165// // "strict" is false, the name just needs to start with '['
166// valid_prefix = name[0] == '[';
167// }
168//
169// if (valid_prefix)
170// {
171// static RegularExpression g_regex("^([-+]?)\\[([A-Za-z_][A-Za-z_0-9]*)(\\([A-Za-z_][A-Za-z_0-9]*\\))? ([A-Za-z_][A-Za-z_0-9:]*)\\]$");
172// llvm::StringRef matches[4];
173// // Since we are using a global regular expression, we must use the threadsafe version of execute
174// if (g_regex.ExecuteThreadSafe(name, matches, 4))
175// {
176// m_full.SetCString(name);
177// if (matches[0].empty())
178// m_type = eTypeUnspecified;
179// else if (matches[0][0] == '+')
180// m_type = eTypeClassMethod;
181// else
182// m_type = eTypeInstanceMethod;
183// m_class.SetString(matches[1]);
184// m_selector.SetString(matches[3]);
185// if (!matches[2].empty())
186// m_category.SetString(matches[2]);
187// }
188// }
189// }
190// return IsValid(strict);
191//}
192
193bool
194ObjCLanguageRuntime::MethodName::SetName (const char *name, bool strict)
195{
196 Clear();
197 if (name && name[0])
Jim Ingham3ad4da02011-08-15 01:32:22 +0000198 {
Greg Claytonf892c422013-01-30 00:18:29 +0000199 // If "strict" is true. then the method must be specified with a
200 // '+' or '-' at the beginning. If "strict" is false, then the '+'
201 // or '-' can be omitted
202 bool valid_prefix = false;
203
204 if (name[0] == '+' || name[0] == '-')
Jim Ingham3ad4da02011-08-15 01:32:22 +0000205 {
Greg Claytonf892c422013-01-30 00:18:29 +0000206 valid_prefix = name[1] == '[';
207 if (name[0] == '+')
208 m_type = eTypeClassMethod;
209 else
210 m_type = eTypeInstanceMethod;
211 }
212 else if (!strict)
213 {
214 // "strict" is false, the name just needs to start with '['
215 valid_prefix = name[0] == '[';
216 }
217
218 if (valid_prefix)
219 {
220 int name_len = strlen (name);
221 // Objective C methods must have at least:
222 // "-[" or "+[" prefix
223 // One character for a class name
224 // One character for the space between the class name
225 // One character for the method name
226 // "]" suffix
227 if (name_len >= (5 + (strict ? 1 : 0)) && name[name_len - 1] == ']')
Jim Ingham3ad4da02011-08-15 01:32:22 +0000228 {
Greg Claytonf892c422013-01-30 00:18:29 +0000229 m_full.SetCStringWithLength(name, name_len);
230 }
231 }
232 }
233 return IsValid(strict);
234}
235
236const ConstString &
237ObjCLanguageRuntime::MethodName::GetClassName ()
238{
239 if (!m_class)
240 {
241 if (IsValid(false))
242 {
243 const char *full = m_full.GetCString();
244 const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
245 const char *paren_pos = strchr (class_start, '(');
246 if (paren_pos)
247 {
248 m_class.SetCStringWithLength (class_start, paren_pos - class_start);
249 }
250 else
251 {
252 // No '(' was found in the full name, we can definitively say
253 // that our category was valid (and empty).
254 m_category_is_valid = true;
255 const char *space_pos = strchr (full, ' ');
256 if (space_pos)
Greg Clayton662e5672012-01-19 03:24:53 +0000257 {
Greg Claytonf892c422013-01-30 00:18:29 +0000258 m_class.SetCStringWithLength (class_start, space_pos - class_start);
259 if (!m_class_category)
Jim Ingham3ad4da02011-08-15 01:32:22 +0000260 {
Greg Claytonf892c422013-01-30 00:18:29 +0000261 // No category in name, so we can also fill in the m_class_category
262 m_class_category = m_class;
Jim Ingham3ad4da02011-08-15 01:32:22 +0000263 }
264 }
265 }
Jim Ingham3ad4da02011-08-15 01:32:22 +0000266 }
Jim Ingham3ad4da02011-08-15 01:32:22 +0000267 }
Greg Claytonf892c422013-01-30 00:18:29 +0000268 return m_class;
Jim Ingham3ad4da02011-08-15 01:32:22 +0000269}
Enrico Granataae2ae942012-09-04 18:47:54 +0000270
Greg Claytonf892c422013-01-30 00:18:29 +0000271const ConstString &
272ObjCLanguageRuntime::MethodName::GetClassNameWithCategory ()
273{
274 if (!m_class_category)
275 {
276 if (IsValid(false))
277 {
278 const char *full = m_full.GetCString();
279 const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
280 const char *space_pos = strchr (full, ' ');
281 if (space_pos)
282 {
283 m_class_category.SetCStringWithLength (class_start, space_pos - class_start);
284 // If m_class hasn't been filled in and the class with category doesn't
285 // contain a '(', then we can also fill in the m_class
286 if (!m_class && strchr (m_class_category.GetCString(), '(') == NULL)
287 {
288 m_class = m_class_category;
289 // No '(' was found in the full name, we can definitively say
290 // that our category was valid (and empty).
291 m_category_is_valid = true;
292
293 }
294 }
295 }
296 }
297 return m_class_category;
298}
299
300const ConstString &
301ObjCLanguageRuntime::MethodName::GetSelector ()
302{
303 if (!m_selector)
304 {
305 if (IsValid(false))
306 {
307 const char *full = m_full.GetCString();
308 const char *space_pos = strchr (full, ' ');
309 if (space_pos)
310 {
311 ++space_pos; // skip the space
312 m_selector.SetCStringWithLength (space_pos, m_full.GetLength() - (space_pos - full) - 1);
313 }
314 }
315 }
316 return m_selector;
317}
318
319const ConstString &
320ObjCLanguageRuntime::MethodName::GetCategory ()
321{
322 if (!m_category_is_valid && !m_category)
323 {
324 if (IsValid(false))
325 {
326 m_category_is_valid = true;
327 const char *full = m_full.GetCString();
328 const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
329 const char *open_paren_pos = strchr (class_start, '(');
330 if (open_paren_pos)
331 {
332 ++open_paren_pos; // Skip the open paren
333 const char *close_paren_pos = strchr (open_paren_pos, ')');
334 if (close_paren_pos)
335 m_category.SetCStringWithLength (open_paren_pos, close_paren_pos - open_paren_pos);
336 }
337 }
338 }
339 return m_category;
340}
341
342ConstString
343ObjCLanguageRuntime::MethodName::GetFullNameWithoutCategory (bool empty_if_no_category)
344{
345 if (IsValid(false))
346 {
347 if (HasCategory())
348 {
349 StreamString strm;
350 if (m_type == eTypeClassMethod)
351 strm.PutChar('+');
352 else if (m_type == eTypeInstanceMethod)
353 strm.PutChar('-');
354 strm.Printf("[%s %s]", GetClassName().GetCString(), GetSelector().GetCString());
355 return ConstString(strm.GetString().c_str());
356 }
357
358 if (!empty_if_no_category)
359 {
360 // Just return the full name since it doesn't have a category
361 return GetFullName();
362 }
363 }
364 return ConstString();
365}
366
367size_t
368ObjCLanguageRuntime::MethodName::GetFullNames (std::vector<ConstString> &names, bool append)
369{
370 if (!append)
371 names.clear();
372 if (IsValid(false))
373 {
374 StreamString strm;
375 const bool is_class_method = m_type == eTypeClassMethod;
376 const bool is_instance_method = m_type == eTypeInstanceMethod;
377 const ConstString &category = GetCategory();
378 if (is_class_method || is_instance_method)
379 {
380 names.push_back (m_full);
381 if (category)
382 {
383 strm.Printf("%c[%s %s]",
384 is_class_method ? '+' : '-',
385 GetClassName().GetCString(),
386 GetSelector().GetCString());
387 names.push_back(ConstString(strm.GetString().c_str()));
388 }
389 }
390 else
391 {
392 const ConstString &class_name = GetClassName();
393 const ConstString &selector = GetSelector();
394 strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString());
395 names.push_back(ConstString(strm.GetString().c_str()));
396 strm.Clear();
397 strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString());
398 names.push_back(ConstString(strm.GetString().c_str()));
399 strm.Clear();
400 if (category)
401 {
402 strm.Printf("+[%s(%s) %s]", class_name.GetCString(), category.GetCString(), selector.GetCString());
403 names.push_back(ConstString(strm.GetString().c_str()));
404 strm.Clear();
405 strm.Printf("-[%s(%s) %s]", class_name.GetCString(), category.GetCString(), selector.GetCString());
406 names.push_back(ConstString(strm.GetString().c_str()));
407 }
408 }
409 }
410 return names.size();
411}
412
413
Enrico Granataae2ae942012-09-04 18:47:54 +0000414bool
415ObjCLanguageRuntime::ClassDescriptor::IsPointerValid (lldb::addr_t value,
416 uint32_t ptr_size,
417 bool allow_NULLs,
418 bool allow_tagged,
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000419 bool check_version_specific) const
Enrico Granataae2ae942012-09-04 18:47:54 +0000420{
421 if (!value)
422 return allow_NULLs;
423 if ( (value % 2) == 1 && allow_tagged)
424 return true;
425 if ((value % ptr_size) == 0)
426 return (check_version_specific ? CheckPointer(value,ptr_size) : true);
427 else
428 return false;
429}
430
431ObjCLanguageRuntime::ObjCISA
Sean Callananc718b962012-09-11 21:44:01 +0000432ObjCLanguageRuntime::GetISA(const ConstString &name)
433{
Sean Callanan6fe8d362012-09-15 01:05:12 +0000434 UpdateISAToDescriptorMap();
Sean Callananc718b962012-09-11 21:44:01 +0000435 for (const ISAToDescriptorMap::value_type &val : m_isa_to_descriptor_cache)
436 if (val.second && val.second->GetClassName() == name)
437 return val.first;
Sean Callananc718b962012-09-11 21:44:01 +0000438 return 0;
439}
440
441ObjCLanguageRuntime::ObjCISA
Enrico Granataae2ae942012-09-04 18:47:54 +0000442ObjCLanguageRuntime::GetParentClass(ObjCLanguageRuntime::ObjCISA isa)
443{
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000444 ClassDescriptorSP objc_class_sp (GetClassDescriptor(isa));
445 if (objc_class_sp)
Enrico Granataae2ae942012-09-04 18:47:54 +0000446 {
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000447 ClassDescriptorSP objc_super_class_sp (objc_class_sp->GetSuperclass());
448 if (objc_super_class_sp)
449 return objc_super_class_sp->GetISA();
Enrico Granataae2ae942012-09-04 18:47:54 +0000450 }
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000451 return 0;
Enrico Granataae2ae942012-09-04 18:47:54 +0000452}
453
Enrico Granataae2ae942012-09-04 18:47:54 +0000454ConstString
455ObjCLanguageRuntime::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa)
456{
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000457 ClassDescriptorSP objc_class_sp (GetNonKVOClassDescriptor(isa));
458 if (objc_class_sp)
459 return objc_class_sp->GetClassName();
460 return ConstString();
Enrico Granataae2ae942012-09-04 18:47:54 +0000461}
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000462
463ObjCLanguageRuntime::ClassDescriptorSP
Greg Claytona5104372012-10-11 18:07:21 +0000464ObjCLanguageRuntime::GetClassDescriptor (const ConstString &class_name)
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000465{
Greg Claytona5104372012-10-11 18:07:21 +0000466 UpdateISAToDescriptorMap();
467 for (const ISAToDescriptorMap::value_type &val : m_isa_to_descriptor_cache)
468 if (val.second && val.second->GetClassName() == class_name)
469 return val.second;
470 return ClassDescriptorSP();
471
472}
473
474ObjCLanguageRuntime::ClassDescriptorSP
475ObjCLanguageRuntime::GetClassDescriptor (ValueObject& valobj)
476{
477 ClassDescriptorSP objc_class_sp;
478 // if we get an invalid VO (which might still happen when playing around
479 // with pointers returned by the expression parser, don't consider this
480 // a valid ObjC object)
481 if (valobj.GetValue().GetContextType() != Value::eContextTypeInvalid)
482 {
483 addr_t isa_pointer = valobj.GetPointerValue();
484 if (isa_pointer != LLDB_INVALID_ADDRESS)
485 {
486 ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
487
488 Process *process = exe_ctx.GetProcessPtr();
489 if (process)
490 {
491 Error error;
492 ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error);
493 if (isa != LLDB_INVALID_ADDRESS)
494 objc_class_sp = GetClassDescriptor (isa);
495 }
496 }
497 }
498 return objc_class_sp;
499}
500
501ObjCLanguageRuntime::ClassDescriptorSP
502ObjCLanguageRuntime::GetNonKVOClassDescriptor (ValueObject& valobj)
503{
504 ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp (GetClassDescriptor (valobj));
505 if (objc_class_sp)
506 {
507 if (!objc_class_sp->IsKVO())
508 return objc_class_sp;
509
510 ClassDescriptorSP non_kvo_objc_class_sp(objc_class_sp->GetSuperclass());
511 if (non_kvo_objc_class_sp && non_kvo_objc_class_sp->IsValid())
512 return non_kvo_objc_class_sp;
513 }
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000514 return ClassDescriptorSP();
515}
516
Greg Claytona5104372012-10-11 18:07:21 +0000517
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000518ObjCLanguageRuntime::ClassDescriptorSP
519ObjCLanguageRuntime::GetClassDescriptor (ObjCISA isa)
520{
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000521 if (isa)
522 {
Greg Claytona5104372012-10-11 18:07:21 +0000523 UpdateISAToDescriptorMap();
524 ObjCLanguageRuntime::ISAToDescriptorIterator pos = m_isa_to_descriptor_cache.find(isa);
525 if (pos != m_isa_to_descriptor_cache.end())
526 return pos->second;
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000527 }
Greg Claytona5104372012-10-11 18:07:21 +0000528 return ClassDescriptorSP();
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000529}
530
531ObjCLanguageRuntime::ClassDescriptorSP
532ObjCLanguageRuntime::GetNonKVOClassDescriptor (ObjCISA isa)
533{
534 if (isa)
535 {
536 ClassDescriptorSP objc_class_sp = GetClassDescriptor (isa);
537 if (objc_class_sp && objc_class_sp->IsValid())
538 {
Greg Claytona5104372012-10-11 18:07:21 +0000539 if (!objc_class_sp->IsKVO())
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000540 return objc_class_sp;
Greg Claytona5104372012-10-11 18:07:21 +0000541
542 ClassDescriptorSP non_kvo_objc_class_sp(objc_class_sp->GetSuperclass());
543 if (non_kvo_objc_class_sp && non_kvo_objc_class_sp->IsValid())
544 return non_kvo_objc_class_sp;
Greg Claytonbe2f3aa2012-10-09 17:51:53 +0000545 }
546 }
547 return ClassDescriptorSP();
548}
549
550
551