[Lldb-commits] [lldb] r280751 - *** This commit represents a complete reformatting of the LLDB source code

Kate Stone via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 6 13:58:36 PDT 2016


Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.cpp Tue Sep  6 15:57:50 2016
@@ -26,8 +26,8 @@
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
-#include "lldb/Target/Target.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Utility/ProcessStructReader.h"
 
 #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
@@ -38,964 +38,904 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-bool
-lldb_private::formatters::NSBundleSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    if (!strcmp(class_name,"NSBundle"))
-    {
-        uint64_t offset = 5 * ptr_size;
-        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, valobj.GetCompilerType().GetBasicTypeFromAST(lldb::eBasicTypeObjCID), true));
-        
-        StreamString summary_stream;
-        bool was_nsstring_ok = NSStringSummaryProvider(*text, summary_stream, options);
-        if (was_nsstring_ok && summary_stream.GetSize() > 0)
-        {
-            stream.Printf("%s",summary_stream.GetData());
-            return true;
-        }
-    }
-    
+bool lldb_private::formatters::NSBundleSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
     return false;
-}
 
-bool
-lldb_private::formatters::NSTimeZoneSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    if (!strcmp(class_name,"__NSTimeZone"))
-    {
-        uint64_t offset = ptr_size;
-        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, valobj.GetCompilerType(), true));
-        StreamString summary_stream;
-        bool was_nsstring_ok = NSStringSummaryProvider(*text, summary_stream, options);
-        if (was_nsstring_ok && summary_stream.GetSize() > 0)
-        {
-            stream.Printf("%s",summary_stream.GetData());
-            return true;
-        }
-    }
-    
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
     return false;
-}
 
-bool
-lldb_private::formatters::NSNotificationSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    if (!strcmp(class_name,"NSConcreteNotification"))
-    {
-        uint64_t offset = ptr_size;
-        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset, valobj.GetCompilerType(), true));
-        StreamString summary_stream;
-        bool was_nsstring_ok = NSStringSummaryProvider(*text, summary_stream, options);
-        if (was_nsstring_ok && summary_stream.GetSize() > 0)
-        {
-            stream.Printf("%s",summary_stream.GetData());
-            return true;
-        }
-    }
-    
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
     return false;
-}
 
-bool
-lldb_private::formatters::NSMachPortSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    uint64_t port_number = 0;
-    
-    if (!strcmp(class_name,"NSMachPort"))
-    {
-        uint64_t offset = (ptr_size == 4 ? 12 : 20);
-        Error error;
-        port_number = process_sp->ReadUnsignedIntegerFromMemory(offset+valobj_addr, 4, 0, error);
-        if (error.Success())
-        {
-            stream.Printf("mach port: %u",(uint32_t)(port_number & 0x00000000FFFFFFFF));
-            return true;
-        }
-    }
-    
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
     return false;
-}
 
-bool
-lldb_private::formatters::NSIndexSetSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    uint64_t count = 0;
-    
-    do {
-        if (!strcmp(class_name,"NSIndexSet") || !strcmp(class_name,"NSMutableIndexSet"))
-        {
-            Error error;
-            uint32_t mode = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr+ptr_size, 4, 0, error);
-            if (error.Fail())
-                return false;
-            // this means the set is empty - count = 0
-            if ((mode & 1) == 1)
-            {
-                count = 0;
-                break;
-            }
-            if ((mode & 2) == 2)
-                mode = 1; // this means the set only has one range
-            else
-                mode = 2; // this means the set has multiple ranges
-            if (mode == 1)
-            {
-                count = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr+3*ptr_size, ptr_size, 0, error);
-                if (error.Fail())
-                    return false;
-            }
-            else
-            {
-                // read a pointer to the data at 2*ptr_size
-                count = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr+2*ptr_size, ptr_size, 0, error);
-                if (error.Fail())
-                    return false;
-                // read the data at 2*ptr_size from the first location
-                count = process_sp->ReadUnsignedIntegerFromMemory(count+2*ptr_size, ptr_size, 0, error);
-                if (error.Fail())
-                    return false;
-            }
-        }
-        else
-            return false;
-    }  while (false);
-    stream.Printf("%" PRIu64 " index%s",
-                  count,
-                  (count == 1 ? "" : "es"));
-    return true;
-}
+  const char *class_name = descriptor->GetClassName().GetCString();
 
-static void
-NSNumber_FormatChar (ValueObject& valobj,
-                     Stream& stream,
-                     char value,
-                     lldb::LanguageType lang)
-{
-    static ConstString g_TypeHint("NSNumber:char");
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(lang))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%hhd%s",
-                  prefix.c_str(),
-                  value,
-                  suffix.c_str());
-}
-
-static void
-NSNumber_FormatShort (ValueObject& valobj,
-                      Stream& stream,
-                      short value,
-                      lldb::LanguageType lang)
-{
-    static ConstString g_TypeHint("NSNumber:short");
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(lang))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%hd%s",
-                  prefix.c_str(),
-                  value,
-                  suffix.c_str());
-}
-
-static void
-NSNumber_FormatInt (ValueObject& valobj,
-                    Stream& stream,
-                    int value,
-                    lldb::LanguageType lang)
-{
-    static ConstString g_TypeHint("NSNumber:int");
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(lang))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%d%s",
-                  prefix.c_str(),
-                  value,
-                  suffix.c_str());
-}
-
-static void
-NSNumber_FormatLong (ValueObject& valobj,
-                     Stream& stream,
-                     uint64_t value,
-                     lldb::LanguageType lang)
-{
-    static ConstString g_TypeHint("NSNumber:long");
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(lang))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%" PRId64 "%s",
-                  prefix.c_str(),
-                  value,
-                  suffix.c_str());
-}
-
-static void
-NSNumber_FormatFloat (ValueObject& valobj,
-                      Stream& stream,
-                      float value,
-                      lldb::LanguageType lang)
-{
-    static ConstString g_TypeHint("NSNumber:float");
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(lang))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%f%s",
-                  prefix.c_str(),
-                  value,
-                  suffix.c_str());
-}
-
-static void
-NSNumber_FormatDouble (ValueObject& valobj,
-                       Stream& stream,
-                       double value,
-                       lldb::LanguageType lang)
-{
-    static ConstString g_TypeHint("NSNumber:double");
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(lang))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%g%s",
-                  prefix.c_str(),
-                  value,
-                  suffix.c_str());
-}
-
-bool
-lldb_private::formatters::NSNumberSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    if (!strcmp(class_name, "__NSCFBoolean"))
-        return ObjCBooleanSummaryProvider(valobj, stream, options);
-
-    if (!strcmp(class_name,"NSNumber") || !strcmp(class_name,"__NSCFNumber"))
-    {
-        uint64_t value = 0;
-        uint64_t i_bits = 0;
-        if (descriptor->GetTaggedPointerInfo(&i_bits,&value))
-        {
-            switch (i_bits)
-            {
-                case 0:
-                    NSNumber_FormatChar(valobj, stream, (char)value, options.GetLanguage());
-                    break;
-                case 1:
-                case 4:
-                    NSNumber_FormatShort(valobj, stream, (short)value, options.GetLanguage());
-                    break;
-                case 2:
-                case 8:
-                    NSNumber_FormatInt(valobj, stream, (int)value, options.GetLanguage());
-                    break;
-                case 3:
-                case 12:
-                    NSNumber_FormatLong(valobj, stream, value, options.GetLanguage());
-                    break;
-                default:
-                    return false;
-            }
-            return true;
-        }
-        else
-        {
-            Error error;
-            uint8_t data_type = (process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, 1, 0, error) & 0x1F);
-            uint64_t data_location = valobj_addr + 2*ptr_size;
-            uint64_t value = 0;
-            if (error.Fail())
-                return false;
-            switch (data_type)
-            {
-                case 1: // 0B00001
-                    value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 1, 0, error);
-                    if (error.Fail())
-                        return false;
-                    NSNumber_FormatChar(valobj, stream, (char)value, options.GetLanguage());
-                    break;
-                case 2: // 0B0010
-                    value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 2, 0, error);
-                    if (error.Fail())
-                        return false;
-                    NSNumber_FormatShort(valobj, stream, (short)value, options.GetLanguage());
-                    break;
-                case 3: // 0B0011
-                    value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 4, 0, error);
-                    if (error.Fail())
-                        return false;
-                    NSNumber_FormatInt(valobj, stream, (int)value, options.GetLanguage());
-                    break;
-                case 17: // 0B10001
-                    data_location += 8;
-                    LLVM_FALLTHROUGH;
-                case 4: // 0B0100
-                    value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 8, 0, error);
-                    if (error.Fail())
-                        return false;
-                    NSNumber_FormatLong(valobj, stream, value, options.GetLanguage());
-                    break;
-                case 5: // 0B0101
-                {
-                    uint32_t flt_as_int = process_sp->ReadUnsignedIntegerFromMemory(data_location, 4, 0, error);
-                    if (error.Fail())
-                        return false;
-                    float flt_value = 0.0f;
-                    memcpy(&flt_value, &flt_as_int, sizeof(flt_as_int));
-                    NSNumber_FormatFloat(valobj, stream, flt_value, options.GetLanguage());
-                    break;
-                }
-                case 6: // 0B0110
-                {
-                    uint64_t dbl_as_lng = process_sp->ReadUnsignedIntegerFromMemory(data_location, 8, 0, error);
-                    if (error.Fail())
-                        return false;
-                    double dbl_value = 0.0;
-                    memcpy(&dbl_value, &dbl_as_lng, sizeof(dbl_as_lng));
-                    NSNumber_FormatDouble(valobj, stream, dbl_value, options.GetLanguage());
-                    break;
-                }
-                default:
-                    return false;
-            }
-            return true;
-        }
-    }
+  if (!class_name || !*class_name)
+    return false;
+
+  if (!strcmp(class_name, "NSBundle")) {
+    uint64_t offset = 5 * ptr_size;
+    ValueObjectSP text(valobj.GetSyntheticChildAtOffset(
+        offset,
+        valobj.GetCompilerType().GetBasicTypeFromAST(lldb::eBasicTypeObjCID),
+        true));
+
+    StreamString summary_stream;
+    bool was_nsstring_ok =
+        NSStringSummaryProvider(*text, summary_stream, options);
+    if (was_nsstring_ok && summary_stream.GetSize() > 0) {
+      stream.Printf("%s", summary_stream.GetData());
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool lldb_private::formatters::NSTimeZoneSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
+
+  if (!class_name || !*class_name)
+    return false;
+
+  if (!strcmp(class_name, "__NSTimeZone")) {
+    uint64_t offset = ptr_size;
+    ValueObjectSP text(valobj.GetSyntheticChildAtOffset(
+        offset, valobj.GetCompilerType(), true));
+    StreamString summary_stream;
+    bool was_nsstring_ok =
+        NSStringSummaryProvider(*text, summary_stream, options);
+    if (was_nsstring_ok && summary_stream.GetSize() > 0) {
+      stream.Printf("%s", summary_stream.GetData());
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool lldb_private::formatters::NSNotificationSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
 
+  if (!valobj_addr)
     return false;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
+
+  if (!class_name || !*class_name)
+    return false;
+
+  if (!strcmp(class_name, "NSConcreteNotification")) {
+    uint64_t offset = ptr_size;
+    ValueObjectSP text(valobj.GetSyntheticChildAtOffset(
+        offset, valobj.GetCompilerType(), true));
+    StreamString summary_stream;
+    bool was_nsstring_ok =
+        NSStringSummaryProvider(*text, summary_stream, options);
+    if (was_nsstring_ok && summary_stream.GetSize() > 0) {
+      stream.Printf("%s", summary_stream.GetData());
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool lldb_private::formatters::NSMachPortSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
+
+  if (!class_name || !*class_name)
+    return false;
+
+  uint64_t port_number = 0;
+
+  if (!strcmp(class_name, "NSMachPort")) {
+    uint64_t offset = (ptr_size == 4 ? 12 : 20);
+    Error error;
+    port_number = process_sp->ReadUnsignedIntegerFromMemory(
+        offset + valobj_addr, 4, 0, error);
+    if (error.Success()) {
+      stream.Printf("mach port: %u",
+                    (uint32_t)(port_number & 0x00000000FFFFFFFF));
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool lldb_private::formatters::NSIndexSetSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
+
+  if (!class_name || !*class_name)
+    return false;
+
+  uint64_t count = 0;
+
+  do {
+    if (!strcmp(class_name, "NSIndexSet") ||
+        !strcmp(class_name, "NSMutableIndexSet")) {
+      Error error;
+      uint32_t mode = process_sp->ReadUnsignedIntegerFromMemory(
+          valobj_addr + ptr_size, 4, 0, error);
+      if (error.Fail())
+        return false;
+      // this means the set is empty - count = 0
+      if ((mode & 1) == 1) {
+        count = 0;
+        break;
+      }
+      if ((mode & 2) == 2)
+        mode = 1; // this means the set only has one range
+      else
+        mode = 2; // this means the set has multiple ranges
+      if (mode == 1) {
+        count = process_sp->ReadUnsignedIntegerFromMemory(
+            valobj_addr + 3 * ptr_size, ptr_size, 0, error);
+        if (error.Fail())
+          return false;
+      } else {
+        // read a pointer to the data at 2*ptr_size
+        count = process_sp->ReadUnsignedIntegerFromMemory(
+            valobj_addr + 2 * ptr_size, ptr_size, 0, error);
+        if (error.Fail())
+          return false;
+        // read the data at 2*ptr_size from the first location
+        count = process_sp->ReadUnsignedIntegerFromMemory(count + 2 * ptr_size,
+                                                          ptr_size, 0, error);
+        if (error.Fail())
+          return false;
+      }
+    } else
+      return false;
+  } while (false);
+  stream.Printf("%" PRIu64 " index%s", count, (count == 1 ? "" : "es"));
+  return true;
 }
 
-bool
-lldb_private::formatters::NSURLSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    if (strcmp(class_name, "NSURL") == 0)
-    {
-        uint64_t offset_text = ptr_size + ptr_size + 8; // ISA + pointer + 8 bytes of data (even on 32bit)
-        uint64_t offset_base = offset_text + ptr_size;
-        CompilerType type(valobj.GetCompilerType());
-        ValueObjectSP text(valobj.GetSyntheticChildAtOffset(offset_text, type, true));
-        ValueObjectSP base(valobj.GetSyntheticChildAtOffset(offset_base, type, true));
-        if (!text)
-            return false;
-        if (text->GetValueAsUnsigned(0) == 0)
-            return false;
-        StreamString summary;
-        if (!NSStringSummaryProvider(*text, summary, options))
-            return false;
-        if (base && base->GetValueAsUnsigned(0))
-        {
-            if (summary.GetSize() > 0)
-                summary.GetString().resize(summary.GetSize()-1);
-            summary.Printf(" -- ");
-            StreamString base_summary;
-            if (NSURLSummaryProvider(*base, base_summary, options) && base_summary.GetSize() > 0)
-                summary.Printf("%s",base_summary.GetSize() > 2 ? base_summary.GetData() + 2 : base_summary.GetData());
-        }
-        if (summary.GetSize())
-        {
-            stream.Printf("%s",summary.GetData());
-            return true;
-        }
+static void NSNumber_FormatChar(ValueObject &valobj, Stream &stream, char value,
+                                lldb::LanguageType lang) {
+  static ConstString g_TypeHint("NSNumber:char");
+
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(lang)) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
     }
+  }
 
-    return false;
+  stream.Printf("%s%hhd%s", prefix.c_str(), value, suffix.c_str());
 }
 
-bool
-lldb_private::formatters::NSDateSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    uint64_t date_value_bits = 0;
-    double date_value = 0.0;
-    
-    ConstString class_name = descriptor->GetClassName();
-    
-    static const ConstString g_NSDate("NSDate");
-    static const ConstString g___NSDate("__NSDate");
-    static const ConstString g___NSTaggedDate("__NSTaggedDate");
-    static const ConstString g_NSCalendarDate("NSCalendarDate");
+static void NSNumber_FormatShort(ValueObject &valobj, Stream &stream,
+                                 short value, lldb::LanguageType lang) {
+  static ConstString g_TypeHint("NSNumber:short");
 
-    if (class_name.IsEmpty())
-        return false;
-    
-    if ((class_name == g_NSDate) ||
-        (class_name == g___NSDate) ||
-        (class_name == g___NSTaggedDate))
-    {
-        uint64_t info_bits=0,value_bits = 0;
-        if (descriptor->GetTaggedPointerInfo(&info_bits,&value_bits))
-        {
-            date_value_bits = ((value_bits << 8) | (info_bits << 4));
-            memcpy(&date_value, &date_value_bits, sizeof(date_value_bits));
-        }
-        else
-        {
-            llvm::Triple triple(process_sp->GetTarget().GetArchitecture().GetTriple());
-            uint32_t delta = (triple.isWatchOS() && triple.isWatchABI()) ? 8 : ptr_size;
-            Error error;
-            date_value_bits = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr+delta, 8, 0, error);
-            memcpy(&date_value, &date_value_bits, sizeof(date_value_bits));
-            if (error.Fail())
-                return false;
-        }
-    }
-    else if (class_name == g_NSCalendarDate)
-    {
-        Error error;
-        date_value_bits = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr+2*ptr_size, 8, 0, error);
-        memcpy(&date_value, &date_value_bits, sizeof(date_value_bits));
-        if (error.Fail())
-            return false;
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(lang)) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
     }
-    else
-        return false;
+  }
 
-    if (date_value == -63114076800)
-    {
-        stream.Printf("0001-12-30 00:00:00 +0000");
-        return true;
-    }
-    // this snippet of code assumes that time_t == seconds since Jan-1-1970
-    // this is generally true and POSIXly happy, but might break if a library
-    // vendor decides to get creative
-    time_t epoch = GetOSXEpoch();
-    epoch = epoch + (time_t)date_value;
-    tm *tm_date = gmtime(&epoch);
-    if (!tm_date)
-        return false;
-    std::string buffer(1024,0);
-    if (strftime (&buffer[0], 1023, "%Z", tm_date) == 0)
-        return false;
-    stream.Printf("%04d-%02d-%02d %02d:%02d:%02d %s", tm_date->tm_year+1900, tm_date->tm_mon+1, tm_date->tm_mday, tm_date->tm_hour, tm_date->tm_min, tm_date->tm_sec, buffer.c_str());
-    return true;
+  stream.Printf("%s%hd%s", prefix.c_str(), value, suffix.c_str());
 }
 
-bool
-lldb_private::formatters::ObjCClassSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptorFromISA(valobj.GetValueAsUnsigned(0)));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    ConstString class_name = descriptor->GetClassName();
-    
-    if (class_name.IsEmpty())
-        return false;
-    
-    if (ConstString cs = Mangled(class_name).GetDemangledName(lldb::eLanguageTypeUnknown))
-        class_name = cs;
-    
-    stream.Printf("%s",class_name.AsCString("<unknown class>"));
-    return true;
+static void NSNumber_FormatInt(ValueObject &valobj, Stream &stream, int value,
+                               lldb::LanguageType lang) {
+  static ConstString g_TypeHint("NSNumber:int");
+
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(lang)) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
+    }
+  }
+
+  stream.Printf("%s%d%s", prefix.c_str(), value, suffix.c_str());
 }
 
-class ObjCClassSyntheticChildrenFrontEnd : public SyntheticChildrenFrontEnd
-{
-public:
-    ObjCClassSyntheticChildrenFrontEnd (lldb::ValueObjectSP valobj_sp) :
-        SyntheticChildrenFrontEnd(*valobj_sp)
-    {
-    }
-    
-    ~ObjCClassSyntheticChildrenFrontEnd() override = default;
-
-    size_t
-    CalculateNumChildren() override
-    {
-        return 0;
-    }
-    
-    lldb::ValueObjectSP
-    GetChildAtIndex(size_t idx) override
-    {
-        return lldb::ValueObjectSP();
-    }
-    
-    bool
-    Update() override
-    {
-        return false;
+static void NSNumber_FormatLong(ValueObject &valobj, Stream &stream,
+                                uint64_t value, lldb::LanguageType lang) {
+  static ConstString g_TypeHint("NSNumber:long");
+
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(lang)) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
     }
-    
-    bool
-    MightHaveChildren() override
-    {
-        return false;
+  }
+
+  stream.Printf("%s%" PRId64 "%s", prefix.c_str(), value, suffix.c_str());
+}
+
+static void NSNumber_FormatFloat(ValueObject &valobj, Stream &stream,
+                                 float value, lldb::LanguageType lang) {
+  static ConstString g_TypeHint("NSNumber:float");
+
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(lang)) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
     }
-    
-    size_t
-    GetIndexOfChildWithName(const ConstString &name) override
-    {
-        return UINT32_MAX;
+  }
+
+  stream.Printf("%s%f%s", prefix.c_str(), value, suffix.c_str());
+}
+
+static void NSNumber_FormatDouble(ValueObject &valobj, Stream &stream,
+                                  double value, lldb::LanguageType lang) {
+  static ConstString g_TypeHint("NSNumber:double");
+
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(lang)) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
     }
-};
+  }
 
-SyntheticChildrenFrontEnd*
-lldb_private::formatters::ObjCClassSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
-{
-    return new ObjCClassSyntheticChildrenFrontEnd(valobj_sp);
+  stream.Printf("%s%g%s", prefix.c_str(), value, suffix.c_str());
 }
 
-template<bool needs_at>
-bool
-lldb_private::formatters::NSDataSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    bool is_64bit = (process_sp->GetAddressByteSize() == 8);
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
+bool lldb_private::formatters::NSNumberSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
+
+  if (!class_name || !*class_name)
+    return false;
+
+  if (!strcmp(class_name, "__NSCFBoolean"))
+    return ObjCBooleanSummaryProvider(valobj, stream, options);
+
+  if (!strcmp(class_name, "NSNumber") || !strcmp(class_name, "__NSCFNumber")) {
     uint64_t value = 0;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    if (!strcmp(class_name,"NSConcreteData") ||
-        !strcmp(class_name,"NSConcreteMutableData") ||
-        !strcmp(class_name,"__NSCFData"))
-    {
-        uint32_t offset = (is_64bit ? 16 : 8);
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + offset, is_64bit ? 8 : 4, 0, error);
+    uint64_t i_bits = 0;
+    if (descriptor->GetTaggedPointerInfo(&i_bits, &value)) {
+      switch (i_bits) {
+      case 0:
+        NSNumber_FormatChar(valobj, stream, (char)value, options.GetLanguage());
+        break;
+      case 1:
+      case 4:
+        NSNumber_FormatShort(valobj, stream, (short)value,
+                             options.GetLanguage());
+        break;
+      case 2:
+      case 8:
+        NSNumber_FormatInt(valobj, stream, (int)value, options.GetLanguage());
+        break;
+      case 3:
+      case 12:
+        NSNumber_FormatLong(valobj, stream, value, options.GetLanguage());
+        break;
+      default:
+        return false;
+      }
+      return true;
+    } else {
+      Error error;
+      uint8_t data_type = (process_sp->ReadUnsignedIntegerFromMemory(
+                               valobj_addr + ptr_size, 1, 0, error) &
+                           0x1F);
+      uint64_t data_location = valobj_addr + 2 * ptr_size;
+      uint64_t value = 0;
+      if (error.Fail())
+        return false;
+      switch (data_type) {
+      case 1: // 0B00001
+        value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 1, 0,
+                                                          error);
         if (error.Fail())
-            return false;
-    }
-    else if (!strcmp(class_name, "_NSInlineData"))
-    {
-        uint32_t offset = (is_64bit ? 8 : 4);
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + offset, 2, 0, error);
+          return false;
+        NSNumber_FormatChar(valobj, stream, (char)value, options.GetLanguage());
+        break;
+      case 2: // 0B0010
+        value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 2, 0,
+                                                          error);
         if (error.Fail())
-            return false;
-    }
-    else if (!strcmp(class_name, "_NSZeroData"))
-    {
-        value = 0;
-    }
-    else
-        return false;
-    
-    stream.Printf("%s%" PRIu64 " byte%s%s",
-                  (needs_at ? "@\"" : ""),
-                  value,
-                  (value != 1 ? "s" : ""),
-                  (needs_at ? "\"" : ""));
-    
+          return false;
+        NSNumber_FormatShort(valobj, stream, (short)value,
+                             options.GetLanguage());
+        break;
+      case 3: // 0B0011
+        value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 4, 0,
+                                                          error);
+        if (error.Fail())
+          return false;
+        NSNumber_FormatInt(valobj, stream, (int)value, options.GetLanguage());
+        break;
+      case 17: // 0B10001
+        data_location += 8;
+        LLVM_FALLTHROUGH;
+      case 4: // 0B0100
+        value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 8, 0,
+                                                          error);
+        if (error.Fail())
+          return false;
+        NSNumber_FormatLong(valobj, stream, value, options.GetLanguage());
+        break;
+      case 5: // 0B0101
+      {
+        uint32_t flt_as_int = process_sp->ReadUnsignedIntegerFromMemory(
+            data_location, 4, 0, error);
+        if (error.Fail())
+          return false;
+        float flt_value = 0.0f;
+        memcpy(&flt_value, &flt_as_int, sizeof(flt_as_int));
+        NSNumber_FormatFloat(valobj, stream, flt_value, options.GetLanguage());
+        break;
+      }
+      case 6: // 0B0110
+      {
+        uint64_t dbl_as_lng = process_sp->ReadUnsignedIntegerFromMemory(
+            data_location, 8, 0, error);
+        if (error.Fail())
+          return false;
+        double dbl_value = 0.0;
+        memcpy(&dbl_value, &dbl_as_lng, sizeof(dbl_as_lng));
+        NSNumber_FormatDouble(valobj, stream, dbl_value, options.GetLanguage());
+        break;
+      }
+      default:
+        return false;
+      }
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool lldb_private::formatters::NSURLSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
+
+  if (!class_name || !*class_name)
+    return false;
+
+  if (strcmp(class_name, "NSURL") == 0) {
+    uint64_t offset_text = ptr_size + ptr_size +
+                           8; // ISA + pointer + 8 bytes of data (even on 32bit)
+    uint64_t offset_base = offset_text + ptr_size;
+    CompilerType type(valobj.GetCompilerType());
+    ValueObjectSP text(
+        valobj.GetSyntheticChildAtOffset(offset_text, type, true));
+    ValueObjectSP base(
+        valobj.GetSyntheticChildAtOffset(offset_base, type, true));
+    if (!text)
+      return false;
+    if (text->GetValueAsUnsigned(0) == 0)
+      return false;
+    StreamString summary;
+    if (!NSStringSummaryProvider(*text, summary, options))
+      return false;
+    if (base && base->GetValueAsUnsigned(0)) {
+      if (summary.GetSize() > 0)
+        summary.GetString().resize(summary.GetSize() - 1);
+      summary.Printf(" -- ");
+      StreamString base_summary;
+      if (NSURLSummaryProvider(*base, base_summary, options) &&
+          base_summary.GetSize() > 0)
+        summary.Printf("%s", base_summary.GetSize() > 2
+                                 ? base_summary.GetData() + 2
+                                 : base_summary.GetData());
+    }
+    if (summary.GetSize()) {
+      stream.Printf("%s", summary.GetData());
+      return true;
+    }
+  }
+
+  return false;
+}
+
+bool lldb_private::formatters::NSDateSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  uint64_t date_value_bits = 0;
+  double date_value = 0.0;
+
+  ConstString class_name = descriptor->GetClassName();
+
+  static const ConstString g_NSDate("NSDate");
+  static const ConstString g___NSDate("__NSDate");
+  static const ConstString g___NSTaggedDate("__NSTaggedDate");
+  static const ConstString g_NSCalendarDate("NSCalendarDate");
+
+  if (class_name.IsEmpty())
+    return false;
+
+  if ((class_name == g_NSDate) || (class_name == g___NSDate) ||
+      (class_name == g___NSTaggedDate)) {
+    uint64_t info_bits = 0, value_bits = 0;
+    if (descriptor->GetTaggedPointerInfo(&info_bits, &value_bits)) {
+      date_value_bits = ((value_bits << 8) | (info_bits << 4));
+      memcpy(&date_value, &date_value_bits, sizeof(date_value_bits));
+    } else {
+      llvm::Triple triple(
+          process_sp->GetTarget().GetArchitecture().GetTriple());
+      uint32_t delta =
+          (triple.isWatchOS() && triple.isWatchABI()) ? 8 : ptr_size;
+      Error error;
+      date_value_bits = process_sp->ReadUnsignedIntegerFromMemory(
+          valobj_addr + delta, 8, 0, error);
+      memcpy(&date_value, &date_value_bits, sizeof(date_value_bits));
+      if (error.Fail())
+        return false;
+    }
+  } else if (class_name == g_NSCalendarDate) {
+    Error error;
+    date_value_bits = process_sp->ReadUnsignedIntegerFromMemory(
+        valobj_addr + 2 * ptr_size, 8, 0, error);
+    memcpy(&date_value, &date_value_bits, sizeof(date_value_bits));
+    if (error.Fail())
+      return false;
+  } else
+    return false;
+
+  if (date_value == -63114076800) {
+    stream.Printf("0001-12-30 00:00:00 +0000");
     return true;
+  }
+  // this snippet of code assumes that time_t == seconds since Jan-1-1970
+  // this is generally true and POSIXly happy, but might break if a library
+  // vendor decides to get creative
+  time_t epoch = GetOSXEpoch();
+  epoch = epoch + (time_t)date_value;
+  tm *tm_date = gmtime(&epoch);
+  if (!tm_date)
+    return false;
+  std::string buffer(1024, 0);
+  if (strftime(&buffer[0], 1023, "%Z", tm_date) == 0)
+    return false;
+  stream.Printf("%04d-%02d-%02d %02d:%02d:%02d %s", tm_date->tm_year + 1900,
+                tm_date->tm_mon + 1, tm_date->tm_mday, tm_date->tm_hour,
+                tm_date->tm_min, tm_date->tm_sec, buffer.c_str());
+  return true;
 }
 
-bool
-lldb_private::formatters::ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    const uint32_t type_info = valobj.GetCompilerType().GetTypeInfo();
-    
-    ValueObjectSP real_guy_sp = valobj.GetSP();
-    
-    if (type_info & eTypeIsPointer)
-    {
-        Error err;
-        real_guy_sp = valobj.Dereference(err);
-        if (err.Fail() || !real_guy_sp)
-            return false;
-    }
-    else if (type_info & eTypeIsReference)
-    {
-        real_guy_sp =  valobj.GetChildAtIndex(0, true);
-        if (!real_guy_sp)
-            return false;
-    }
-    uint8_t value = (real_guy_sp->GetValueAsUnsigned(0) & 0xFF);
-    switch (value)
-    {
-        case 0:
-            stream.Printf("NO");
-            break;
-        case 1:
-            stream.Printf("YES");
-            break;
-        default:
-            stream.Printf("%u",value);
-            break;
-    }
-    return true;
+bool lldb_private::formatters::ObjCClassSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptorFromISA(valobj.GetValueAsUnsigned(0)));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  ConstString class_name = descriptor->GetClassName();
+
+  if (class_name.IsEmpty())
+    return false;
+
+  if (ConstString cs =
+          Mangled(class_name).GetDemangledName(lldb::eLanguageTypeUnknown))
+    class_name = cs;
+
+  stream.Printf("%s", class_name.AsCString("<unknown class>"));
+  return true;
 }
 
-bool
-lldb_private::formatters::ObjCBooleanSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    lldb::addr_t valobj_ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-    if (valobj_ptr_value == LLDB_INVALID_ADDRESS)
-        return false;
+class ObjCClassSyntheticChildrenFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  ObjCClassSyntheticChildrenFrontEnd(lldb::ValueObjectSP valobj_sp)
+      : SyntheticChildrenFrontEnd(*valobj_sp) {}
 
-    ProcessSP process_sp(valobj.GetProcessSP());
-    if (!process_sp)
-        return false;
+  ~ObjCClassSyntheticChildrenFrontEnd() override = default;
 
-    if (AppleObjCRuntime *objc_runtime = (AppleObjCRuntime*)process_sp->GetObjCLanguageRuntime())
-    {
-        lldb::addr_t cf_true = LLDB_INVALID_ADDRESS,
-                     cf_false = LLDB_INVALID_ADDRESS;
-        objc_runtime->GetValuesForGlobalCFBooleans(cf_true, cf_false);
-        if (valobj_ptr_value == cf_true)
-        {
-            stream.PutCString("YES");
-            return true;
-        }
-        if (valobj_ptr_value == cf_false)
-        {
-            stream.PutCString("NO");
-            return true;
-        }
-    }
+  size_t CalculateNumChildren() override { return 0; }
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+    return lldb::ValueObjectSP();
+  }
+
+  bool Update() override { return false; }
+
+  bool MightHaveChildren() override { return false; }
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override {
+    return UINT32_MAX;
+  }
+};
+
+SyntheticChildrenFrontEnd *
+lldb_private::formatters::ObjCClassSyntheticFrontEndCreator(
+    CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
+  return new ObjCClassSyntheticChildrenFrontEnd(valobj_sp);
+}
+
+template <bool needs_at>
+bool lldb_private::formatters::NSDataSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  bool is_64bit = (process_sp->GetAddressByteSize() == 8);
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  uint64_t value = 0;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
 
+  if (!class_name || !*class_name)
     return false;
+
+  if (!strcmp(class_name, "NSConcreteData") ||
+      !strcmp(class_name, "NSConcreteMutableData") ||
+      !strcmp(class_name, "__NSCFData")) {
+    uint32_t offset = (is_64bit ? 16 : 8);
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(
+        valobj_addr + offset, is_64bit ? 8 : 4, 0, error);
+    if (error.Fail())
+      return false;
+  } else if (!strcmp(class_name, "_NSInlineData")) {
+    uint32_t offset = (is_64bit ? 8 : 4);
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + offset, 2,
+                                                      0, error);
+    if (error.Fail())
+      return false;
+  } else if (!strcmp(class_name, "_NSZeroData")) {
+    value = 0;
+  } else
+    return false;
+
+  stream.Printf("%s%" PRIu64 " byte%s%s", (needs_at ? "@\"" : ""), value,
+                (value != 1 ? "s" : ""), (needs_at ? "\"" : ""));
+
+  return true;
 }
 
-template <bool is_sel_ptr>
-bool
-lldb_private::formatters::ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    lldb::ValueObjectSP valobj_sp;
-    
-    CompilerType charstar (valobj.GetCompilerType().GetBasicTypeFromAST(eBasicTypeChar).GetPointerType());
-    
-    if (!charstar)
-        return false;
-    
-    ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
-    
-    if (is_sel_ptr)
-    {
-        lldb::addr_t data_address = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-        if (data_address == LLDB_INVALID_ADDRESS)
-            return false;
-        valobj_sp = ValueObject::CreateValueObjectFromAddress("text", data_address, exe_ctx, charstar);
-    }
-    else
-    {
-        DataExtractor data;
-        Error error;
-        valobj.GetData(data, error);
-        if (error.Fail())
-            return false;
-        valobj_sp = ValueObject::CreateValueObjectFromData("text", data, exe_ctx, charstar);
+bool lldb_private::formatters::ObjCBOOLSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  const uint32_t type_info = valobj.GetCompilerType().GetTypeInfo();
+
+  ValueObjectSP real_guy_sp = valobj.GetSP();
+
+  if (type_info & eTypeIsPointer) {
+    Error err;
+    real_guy_sp = valobj.Dereference(err);
+    if (err.Fail() || !real_guy_sp)
+      return false;
+  } else if (type_info & eTypeIsReference) {
+    real_guy_sp = valobj.GetChildAtIndex(0, true);
+    if (!real_guy_sp)
+      return false;
+  }
+  uint8_t value = (real_guy_sp->GetValueAsUnsigned(0) & 0xFF);
+  switch (value) {
+  case 0:
+    stream.Printf("NO");
+    break;
+  case 1:
+    stream.Printf("YES");
+    break;
+  default:
+    stream.Printf("%u", value);
+    break;
+  }
+  return true;
+}
+
+bool lldb_private::formatters::ObjCBooleanSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  lldb::addr_t valobj_ptr_value =
+      valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+  if (valobj_ptr_value == LLDB_INVALID_ADDRESS)
+    return false;
+
+  ProcessSP process_sp(valobj.GetProcessSP());
+  if (!process_sp)
+    return false;
+
+  if (AppleObjCRuntime *objc_runtime =
+          (AppleObjCRuntime *)process_sp->GetObjCLanguageRuntime()) {
+    lldb::addr_t cf_true = LLDB_INVALID_ADDRESS,
+                 cf_false = LLDB_INVALID_ADDRESS;
+    objc_runtime->GetValuesForGlobalCFBooleans(cf_true, cf_false);
+    if (valobj_ptr_value == cf_true) {
+      stream.PutCString("YES");
+      return true;
+    }
+    if (valobj_ptr_value == cf_false) {
+      stream.PutCString("NO");
+      return true;
     }
-    
-    if (!valobj_sp)
-        return false;
-    
-    stream.Printf("%s",valobj_sp->GetSummaryAsCString());
-    return true;
+  }
+
+  return false;
+}
+
+template <bool is_sel_ptr>
+bool lldb_private::formatters::ObjCSELSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  lldb::ValueObjectSP valobj_sp;
+
+  CompilerType charstar(valobj.GetCompilerType()
+                            .GetBasicTypeFromAST(eBasicTypeChar)
+                            .GetPointerType());
+
+  if (!charstar)
+    return false;
+
+  ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
+
+  if (is_sel_ptr) {
+    lldb::addr_t data_address = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+    if (data_address == LLDB_INVALID_ADDRESS)
+      return false;
+    valobj_sp = ValueObject::CreateValueObjectFromAddress("text", data_address,
+                                                          exe_ctx, charstar);
+  } else {
+    DataExtractor data;
+    Error error;
+    valobj.GetData(data, error);
+    if (error.Fail())
+      return false;
+    valobj_sp =
+        ValueObject::CreateValueObjectFromData("text", data, exe_ctx, charstar);
+  }
+
+  if (!valobj_sp)
+    return false;
+
+  stream.Printf("%s", valobj_sp->GetSummaryAsCString());
+  return true;
 }
 
 // POSIX has an epoch on Jan-1-1970, but Cocoa prefers Jan-1-2001
 // this call gives the POSIX equivalent of the Cocoa epoch
-time_t
-lldb_private::formatters::GetOSXEpoch ()
-{
-    static time_t epoch = 0;
-    if (!epoch)
-    {
+time_t lldb_private::formatters::GetOSXEpoch() {
+  static time_t epoch = 0;
+  if (!epoch) {
 #ifndef _WIN32
-        tzset();
-        tm tm_epoch;
-        tm_epoch.tm_sec = 0;
-        tm_epoch.tm_hour = 0;
-        tm_epoch.tm_min = 0;
-        tm_epoch.tm_mon = 0;
-        tm_epoch.tm_mday = 1;
-        tm_epoch.tm_year = 2001-1900;
-        tm_epoch.tm_isdst = -1;
-        tm_epoch.tm_gmtoff = 0;
-        tm_epoch.tm_zone = nullptr;
-        epoch = timegm(&tm_epoch);
+    tzset();
+    tm tm_epoch;
+    tm_epoch.tm_sec = 0;
+    tm_epoch.tm_hour = 0;
+    tm_epoch.tm_min = 0;
+    tm_epoch.tm_mon = 0;
+    tm_epoch.tm_mday = 1;
+    tm_epoch.tm_year = 2001 - 1900;
+    tm_epoch.tm_isdst = -1;
+    tm_epoch.tm_gmtoff = 0;
+    tm_epoch.tm_zone = nullptr;
+    epoch = timegm(&tm_epoch);
 #endif
-    }
-    return epoch;
+  }
+  return epoch;
 }
 
-template bool
-lldb_private::formatters::NSDataSummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&);
+template bool lldb_private::formatters::NSDataSummaryProvider<true>(
+    ValueObject &, Stream &, const TypeSummaryOptions &);
 
-template bool
-lldb_private::formatters::NSDataSummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&);
+template bool lldb_private::formatters::NSDataSummaryProvider<false>(
+    ValueObject &, Stream &, const TypeSummaryOptions &);
 
-template bool
-lldb_private::formatters::ObjCSELSummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&);
+template bool lldb_private::formatters::ObjCSELSummaryProvider<true>(
+    ValueObject &, Stream &, const TypeSummaryOptions &);
 
-template bool
-lldb_private::formatters::ObjCSELSummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&);
+template bool lldb_private::formatters::ObjCSELSummaryProvider<false>(
+    ValueObject &, Stream &, const TypeSummaryOptions &);

Modified: lldb/trunk/source/Plugins/Language/ObjC/Cocoa.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/Cocoa.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/Cocoa.h (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/Cocoa.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- Cocoa.h ---------------------------------------------------*- C++ -*-===//
+//===-- Cocoa.h ---------------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,92 +18,96 @@
 #include "lldb/Target/ObjCLanguageRuntime.h"
 
 namespace lldb_private {
-    namespace formatters
-    {
-        bool
-        NSIndexSetSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSArraySummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        template<bool needs_at>
-        bool
-        NSDataSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSNumberSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSNotificationSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSTimeZoneSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSMachPortSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSDateSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSBundleSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSURLSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        extern template bool
-        NSDataSummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
-        
-        extern template bool
-        NSDataSummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
-        
-        SyntheticChildrenFrontEnd* NSArraySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-        
-        SyntheticChildrenFrontEnd* NSIndexPathSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-        
-        bool
-        ObjCClassSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        SyntheticChildrenFrontEnd* ObjCClassSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-        
-        bool
-        ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
-        bool
-        ObjCBooleanSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        template <bool is_sel_ptr>
-        bool
-        ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        extern template bool
-        ObjCSELSummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&);
-        
-        extern template bool
-        ObjCSELSummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&);
-        
-        bool
-        NSError_SummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSException_SummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        SyntheticChildrenFrontEnd*
-        NSErrorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp);
-        
-        SyntheticChildrenFrontEnd*
-        NSExceptionSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp);
-        
-        class NSArray_Additionals
-        {
-        public:
-            static std::map<ConstString, CXXFunctionSummaryFormat::Callback>&
-            GetAdditionalSummaries ();
-            
-            static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>&
-            GetAdditionalSynthetics ();
-        };
-    } // namespace formatters
+namespace formatters {
+bool NSIndexSetSummaryProvider(ValueObject &valobj, Stream &stream,
+                               const TypeSummaryOptions &options);
+
+bool NSArraySummaryProvider(ValueObject &valobj, Stream &stream,
+                            const TypeSummaryOptions &options);
+
+template <bool needs_at>
+bool NSDataSummaryProvider(ValueObject &valobj, Stream &stream,
+                           const TypeSummaryOptions &options);
+
+bool NSNumberSummaryProvider(ValueObject &valobj, Stream &stream,
+                             const TypeSummaryOptions &options);
+
+bool NSNotificationSummaryProvider(ValueObject &valobj, Stream &stream,
+                                   const TypeSummaryOptions &options);
+
+bool NSTimeZoneSummaryProvider(ValueObject &valobj, Stream &stream,
+                               const TypeSummaryOptions &options);
+
+bool NSMachPortSummaryProvider(ValueObject &valobj, Stream &stream,
+                               const TypeSummaryOptions &options);
+
+bool NSDateSummaryProvider(ValueObject &valobj, Stream &stream,
+                           const TypeSummaryOptions &options);
+
+bool NSBundleSummaryProvider(ValueObject &valobj, Stream &stream,
+                             const TypeSummaryOptions &options);
+
+bool NSURLSummaryProvider(ValueObject &valobj, Stream &stream,
+                          const TypeSummaryOptions &options);
+
+extern template bool NSDataSummaryProvider<true>(ValueObject &, Stream &,
+                                                 const TypeSummaryOptions &);
+
+extern template bool NSDataSummaryProvider<false>(ValueObject &, Stream &,
+                                                  const TypeSummaryOptions &);
+
+SyntheticChildrenFrontEnd *
+NSArraySyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP);
+
+SyntheticChildrenFrontEnd *
+NSIndexPathSyntheticFrontEndCreator(CXXSyntheticChildren *,
+                                    lldb::ValueObjectSP);
+
+bool ObjCClassSummaryProvider(ValueObject &valobj, Stream &stream,
+                              const TypeSummaryOptions &options);
+
+SyntheticChildrenFrontEnd *
+ObjCClassSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP);
+
+bool ObjCBOOLSummaryProvider(ValueObject &valobj, Stream &stream,
+                             const TypeSummaryOptions &options);
+
+bool ObjCBooleanSummaryProvider(ValueObject &valobj, Stream &stream,
+                                const TypeSummaryOptions &options);
+
+template <bool is_sel_ptr>
+bool ObjCSELSummaryProvider(ValueObject &valobj, Stream &stream,
+                            const TypeSummaryOptions &options);
+
+extern template bool ObjCSELSummaryProvider<true>(ValueObject &, Stream &,
+                                                  const TypeSummaryOptions &);
+
+extern template bool ObjCSELSummaryProvider<false>(ValueObject &, Stream &,
+                                                   const TypeSummaryOptions &);
+
+bool NSError_SummaryProvider(ValueObject &valobj, Stream &stream,
+                             const TypeSummaryOptions &options);
+
+bool NSException_SummaryProvider(ValueObject &valobj, Stream &stream,
+                                 const TypeSummaryOptions &options);
+
+SyntheticChildrenFrontEnd *
+NSErrorSyntheticFrontEndCreator(CXXSyntheticChildren *,
+                                lldb::ValueObjectSP valobj_sp);
+
+SyntheticChildrenFrontEnd *
+NSExceptionSyntheticFrontEndCreator(CXXSyntheticChildren *,
+                                    lldb::ValueObjectSP valobj_sp);
+
+class NSArray_Additionals {
+public:
+  static std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
+  GetAdditionalSummaries();
+
+  static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
+  GetAdditionalSynthetics();
+};
+} // namespace formatters
 } // namespace lldb_private
 
 #endif // liblldb_Cocoa_h_

Modified: lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- CoreMedia.cpp --------------------------------------------*- C++ -*-===//
+//===-- CoreMedia.cpp --------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -18,72 +19,77 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-bool
-lldb_private::formatters::CMTimeSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    CompilerType type = valobj.GetCompilerType();
-    if (!type.IsValid())
-        return false;
-
-    TypeSystem *type_system = valobj.GetExecutionContextRef().GetTargetSP()->GetScratchTypeSystemForLanguage(nullptr, lldb::eLanguageTypeC);
-    if (!type_system)
-        return false;
-    
-    // fetch children by offset to compensate for potential lack of debug info
-    auto int64_ty = type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 64);
-    auto int32_ty = type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 32);
-    
-    auto value_sp(valobj.GetSyntheticChildAtOffset(0, int64_ty, true));
-    auto timescale_sp(valobj.GetSyntheticChildAtOffset(8, int32_ty, true));
-    auto flags_sp(valobj.GetSyntheticChildAtOffset(12, int32_ty, true));
-    
-    if (!value_sp || !timescale_sp || !flags_sp)
-        return false;
-    
-    auto value = value_sp->GetValueAsUnsigned(0);
-    auto timescale = (int32_t)timescale_sp->GetValueAsUnsigned(0); // the timescale specifies the fraction of a second each unit in the numerator occupies
-    auto flags = Flags(flags_sp->GetValueAsUnsigned(0) & 0x00000000000000FF); // the flags I need sit in the LSB
-    
-    const unsigned int FlagPositiveInf = 4;
-    const unsigned int FlagNegativeInf = 8;
-    const unsigned int FlagIndefinite = 16;
-    
-    if (flags.AnySet(FlagIndefinite))
-    {
-        stream.Printf("indefinite");
-        return true;
-    }
-    
-    if (flags.AnySet(FlagPositiveInf))
-    {
-        stream.Printf("+oo");
-        return true;
-    }
-    
-    if (flags.AnySet(FlagNegativeInf))
-    {
-        stream.Printf("-oo");
-        return true;
-    }
-    
-    if (timescale == 0)
-        return false;
-    
-    switch (timescale)
-    {
-        case 0:
-            return false;
-        case 1:
-            stream.Printf("%" PRId64 " seconds", value);
-            return true;
-        case 2:
-            stream.Printf("%" PRId64 " half seconds", value);
-            return true;
-        case 3:
-            stream.Printf("%" PRId64 " third%sof a second", value, value == 1 ? " " : "s ");
-            return true;
-        default:
-            stream.Printf("%" PRId64 " %" PRId32 "th%sof a second", value, timescale, value == 1 ? " " : "s ");
-            return true;
-    }
+bool lldb_private::formatters::CMTimeSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  CompilerType type = valobj.GetCompilerType();
+  if (!type.IsValid())
+    return false;
+
+  TypeSystem *type_system =
+      valobj.GetExecutionContextRef()
+          .GetTargetSP()
+          ->GetScratchTypeSystemForLanguage(nullptr, lldb::eLanguageTypeC);
+  if (!type_system)
+    return false;
+
+  // fetch children by offset to compensate for potential lack of debug info
+  auto int64_ty =
+      type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 64);
+  auto int32_ty =
+      type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 32);
+
+  auto value_sp(valobj.GetSyntheticChildAtOffset(0, int64_ty, true));
+  auto timescale_sp(valobj.GetSyntheticChildAtOffset(8, int32_ty, true));
+  auto flags_sp(valobj.GetSyntheticChildAtOffset(12, int32_ty, true));
+
+  if (!value_sp || !timescale_sp || !flags_sp)
+    return false;
+
+  auto value = value_sp->GetValueAsUnsigned(0);
+  auto timescale = (int32_t)timescale_sp->GetValueAsUnsigned(
+      0); // the timescale specifies the fraction of a second each unit in the
+          // numerator occupies
+  auto flags = Flags(flags_sp->GetValueAsUnsigned(0) &
+                     0x00000000000000FF); // the flags I need sit in the LSB
+
+  const unsigned int FlagPositiveInf = 4;
+  const unsigned int FlagNegativeInf = 8;
+  const unsigned int FlagIndefinite = 16;
+
+  if (flags.AnySet(FlagIndefinite)) {
+    stream.Printf("indefinite");
+    return true;
+  }
+
+  if (flags.AnySet(FlagPositiveInf)) {
+    stream.Printf("+oo");
+    return true;
+  }
+
+  if (flags.AnySet(FlagNegativeInf)) {
+    stream.Printf("-oo");
+    return true;
+  }
+
+  if (timescale == 0)
+    return false;
+
+  switch (timescale) {
+  case 0:
+    return false;
+  case 1:
+    stream.Printf("%" PRId64 " seconds", value);
+    return true;
+  case 2:
+    stream.Printf("%" PRId64 " half seconds", value);
+    return true;
+  case 3:
+    stream.Printf("%" PRId64 " third%sof a second", value,
+                  value == 1 ? " " : "s ");
+    return true;
+  default:
+    stream.Printf("%" PRId64 " %" PRId32 "th%sof a second", value, timescale,
+                  value == 1 ? " " : "s ");
+    return true;
+  }
 }

Modified: lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.h (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/CoreMedia.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- CoreMedia.h -----------------------------------------------*- C++ -*-===//
+//===-- CoreMedia.h -----------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,12 +16,11 @@
 #include "lldb/DataFormatters/TypeSummary.h"
 
 namespace lldb_private {
-    namespace formatters
-    {
-        
-        bool
-        CMTimeSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-    } // namespace formatters
+namespace formatters {
+
+bool CMTimeSummaryProvider(ValueObject &valobj, Stream &stream,
+                           const TypeSummaryOptions &options);
+} // namespace formatters
 } // namespace lldb_private
 
 #endif // liblldb_CF_h_

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSArray.cpp Tue Sep  6 15:57:50 2016
@@ -15,6 +15,7 @@
 // Project includes
 #include "Cocoa.h"
 
+#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
 #include "lldb/Core/DataBufferHeap.h"
 #include "lldb/Core/Error.h"
 #include "lldb/Core/Stream.h"
@@ -26,801 +27,683 @@
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
-#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
 #include "lldb/Target/Target.h"
 
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-namespace  lldb_private {
-    namespace formatters {
-        std::map<ConstString, CXXFunctionSummaryFormat::Callback>&
-        NSArray_Additionals::GetAdditionalSummaries ()
-        {
-            static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
-            return g_map;
-        }
-        
-        std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>&
-        NSArray_Additionals::GetAdditionalSynthetics ()
-        {
-            static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> g_map;
-            return g_map;
-        }
-        
-        class NSArrayMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSArrayMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-            ~NSArrayMSyntheticFrontEnd() override = default;
-
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override = 0;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-            
-        protected:
-            virtual lldb::addr_t
-            GetDataAddress () = 0;
-            
-            virtual uint64_t
-            GetUsedCount () = 0;
-            
-            virtual uint64_t
-            GetOffset () = 0;
-            
-            virtual uint64_t
-            GetSize () = 0;
-            
-            ExecutionContextRef m_exe_ctx_ref;
-            uint8_t m_ptr_size;
-            CompilerType m_id_type;
-        };
-        
-        class NSArrayMSyntheticFrontEnd_109 : public NSArrayMSyntheticFrontEnd
-        {
-        public:
-            NSArrayMSyntheticFrontEnd_109 (lldb::ValueObjectSP valobj_sp);
-
-            ~NSArrayMSyntheticFrontEnd_109() override;
-
-            bool
-            Update() override;
-            
-        protected:
-            lldb::addr_t
-            GetDataAddress() override;
-            
-            uint64_t
-            GetUsedCount() override;
-            
-            uint64_t
-            GetOffset() override;
-            
-            uint64_t
-            GetSize() override;
-            
-        private:
-            struct DataDescriptor_32
-            {
-                uint32_t _used;
-                uint32_t _priv1 : 2;
-                uint32_t _size : 30;
-                uint32_t _priv2 : 2;
-                uint32_t _offset : 30;
-                uint32_t _priv3;
-                uint32_t _data;
-            };
-
-            struct DataDescriptor_64
-            {
-                uint64_t _used;
-                uint64_t _priv1 : 2;
-                uint64_t _size : 62;
-                uint64_t _priv2 : 2;
-                uint64_t _offset : 62;
-                uint32_t _priv3;
-                uint64_t _data;
-            };
-
-            DataDescriptor_32 *m_data_32;
-            DataDescriptor_64 *m_data_64;
-        };
-        
-        class NSArrayMSyntheticFrontEnd_1010 : public NSArrayMSyntheticFrontEnd
-        {
-        public:
-            NSArrayMSyntheticFrontEnd_1010 (lldb::ValueObjectSP valobj_sp);
-
-            ~NSArrayMSyntheticFrontEnd_1010() override;
-
-            bool
-            Update() override;
-            
-        protected:
-            lldb::addr_t
-            GetDataAddress() override;
-            
-            uint64_t
-            GetUsedCount() override;
-            
-            uint64_t
-            GetOffset() override;
-            
-            uint64_t
-            GetSize() override;
-            
-        private:
-            struct DataDescriptor_32
-            {
-                uint32_t _used;
-                uint32_t _offset;
-                uint32_t _size : 28;
-                uint64_t _priv1 : 4;
-                uint32_t _priv2;
-                uint32_t _data;
-            };
-
-            struct DataDescriptor_64
-            {
-                uint64_t _used;
-                uint64_t _offset;
-                uint64_t _size : 60;
-                uint64_t _priv1 : 4;
-                uint32_t _priv2;
-                uint64_t _data;
-            };
-
-            DataDescriptor_32 *m_data_32;
-            DataDescriptor_64 *m_data_64;
-        };
-        
-        class NSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSArrayISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-            ~NSArrayISyntheticFrontEnd() override = default;
-
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-
-        private:
-            ExecutionContextRef m_exe_ctx_ref;
-            uint8_t m_ptr_size;
-            uint64_t m_items;
-            lldb::addr_t m_data_ptr;
-            CompilerType m_id_type;
-        };
-        
-        class NSArray0SyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSArray0SyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-            ~NSArray0SyntheticFrontEnd() override = default;
-
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-        };
-
-        class NSArray1SyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSArray1SyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-            
-            ~NSArray1SyntheticFrontEnd() override = default;
-            
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-        };
-    } // namespace formatters
-} // namespace lldb_private
-
-bool
-lldb_private::formatters::NSArraySummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    static ConstString g_TypeHint("NSArray");
-    
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    uint64_t value = 0;
-    
-    ConstString class_name(descriptor->GetClassName());
-    
-    static const ConstString g_NSArrayI("__NSArrayI");
-    static const ConstString g_NSArrayM("__NSArrayM");
-    static const ConstString g_NSArray0("__NSArray0");
-    static const ConstString g_NSArray1("__NSSingleObjectArrayI");
-    static const ConstString g_NSArrayCF("__NSCFArray");
-    
-    if (class_name.IsEmpty())
-        return false;
-    
-    if (class_name == g_NSArrayI)
-    {
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error);
-        if (error.Fail())
-            return false;
-    }
-    else if (class_name == g_NSArrayM)
-    {
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error);
-        if (error.Fail())
-            return false;
-    }
-    else if (class_name == g_NSArray0)
-    {
-        value = 0;
-    }
-    else if (class_name == g_NSArray1)
-    {
-        value = 1;
-    }
-    else if (class_name == g_NSArrayCF)
-    {
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + 2 * ptr_size, ptr_size, 0, error);
-        if (error.Fail())
-            return false;
-    }
-    else
-    {
-        auto& map(NSArray_Additionals::GetAdditionalSummaries());
-        auto iter = map.find(class_name), end = map.end();
-        if (iter != end)
-            return iter->second(valobj, stream, options);
-        else
-            return false;
-    }
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(options.GetLanguage()))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%" PRIu64 " %s%s%s",
-                  prefix.c_str(),
-                  value,
-                  "element",
-                  value == 1 ? "" : "s",
-                  suffix.c_str());
-    return true;
-}
-
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::NSArrayMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-SyntheticChildrenFrontEnd(*valobj_sp),
-m_exe_ctx_ref(),
-m_ptr_size(8),
-m_id_type()
-{
-    if (valobj_sp)
-    {
-        clang::ASTContext *ast = valobj_sp->GetExecutionContextRef().GetTargetSP()->GetScratchClangASTContext()->getASTContext();
-        if (ast)
-            m_id_type = CompilerType(ast, ast->ObjCBuiltinIdTy);
-        if (valobj_sp->GetProcessSP())
-            m_ptr_size = valobj_sp->GetProcessSP()->GetAddressByteSize();
-    }
+namespace lldb_private {
+namespace formatters {
+std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
+NSArray_Additionals::GetAdditionalSummaries() {
+  static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
+  return g_map;
 }
 
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::NSArrayMSyntheticFrontEnd_109 (lldb::ValueObjectSP valobj_sp) :
-    NSArrayMSyntheticFrontEnd(valobj_sp),
-    m_data_32(nullptr),
-    m_data_64(nullptr)
-{
+std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
+NSArray_Additionals::GetAdditionalSynthetics() {
+  static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>
+      g_map;
+  return g_map;
 }
 
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::NSArrayMSyntheticFrontEnd_1010 (lldb::ValueObjectSP valobj_sp) :
-    NSArrayMSyntheticFrontEnd(valobj_sp),
-    m_data_32(nullptr),
-    m_data_64(nullptr)
-{
-}
+class NSArrayMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSArrayMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSArrayMSyntheticFrontEnd() override = default;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override = 0;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+protected:
+  virtual lldb::addr_t GetDataAddress() = 0;
+
+  virtual uint64_t GetUsedCount() = 0;
+
+  virtual uint64_t GetOffset() = 0;
+
+  virtual uint64_t GetSize() = 0;
+
+  ExecutionContextRef m_exe_ctx_ref;
+  uint8_t m_ptr_size;
+  CompilerType m_id_type;
+};
+
+class NSArrayMSyntheticFrontEnd_109 : public NSArrayMSyntheticFrontEnd {
+public:
+  NSArrayMSyntheticFrontEnd_109(lldb::ValueObjectSP valobj_sp);
+
+  ~NSArrayMSyntheticFrontEnd_109() override;
+
+  bool Update() override;
+
+protected:
+  lldb::addr_t GetDataAddress() override;
+
+  uint64_t GetUsedCount() override;
+
+  uint64_t GetOffset() override;
+
+  uint64_t GetSize() override;
+
+private:
+  struct DataDescriptor_32 {
+    uint32_t _used;
+    uint32_t _priv1 : 2;
+    uint32_t _size : 30;
+    uint32_t _priv2 : 2;
+    uint32_t _offset : 30;
+    uint32_t _priv3;
+    uint32_t _data;
+  };
+
+  struct DataDescriptor_64 {
+    uint64_t _used;
+    uint64_t _priv1 : 2;
+    uint64_t _size : 62;
+    uint64_t _priv2 : 2;
+    uint64_t _offset : 62;
+    uint32_t _priv3;
+    uint64_t _data;
+  };
+
+  DataDescriptor_32 *m_data_32;
+  DataDescriptor_64 *m_data_64;
+};
+
+class NSArrayMSyntheticFrontEnd_1010 : public NSArrayMSyntheticFrontEnd {
+public:
+  NSArrayMSyntheticFrontEnd_1010(lldb::ValueObjectSP valobj_sp);
+
+  ~NSArrayMSyntheticFrontEnd_1010() override;
+
+  bool Update() override;
+
+protected:
+  lldb::addr_t GetDataAddress() override;
+
+  uint64_t GetUsedCount() override;
+
+  uint64_t GetOffset() override;
+
+  uint64_t GetSize() override;
+
+private:
+  struct DataDescriptor_32 {
+    uint32_t _used;
+    uint32_t _offset;
+    uint32_t _size : 28;
+    uint64_t _priv1 : 4;
+    uint32_t _priv2;
+    uint32_t _data;
+  };
+
+  struct DataDescriptor_64 {
+    uint64_t _used;
+    uint64_t _offset;
+    uint64_t _size : 60;
+    uint64_t _priv1 : 4;
+    uint32_t _priv2;
+    uint64_t _data;
+  };
+
+  DataDescriptor_32 *m_data_32;
+  DataDescriptor_64 *m_data_64;
+};
+
+class NSArrayISyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSArrayISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSArrayISyntheticFrontEnd() override = default;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  ExecutionContextRef m_exe_ctx_ref;
+  uint8_t m_ptr_size;
+  uint64_t m_items;
+  lldb::addr_t m_data_ptr;
+  CompilerType m_id_type;
+};
+
+class NSArray0SyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSArray0SyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSArray0SyntheticFrontEnd() override = default;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+};
+
+class NSArray1SyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSArray1SyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSArray1SyntheticFrontEnd() override = default;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+};
+} // namespace formatters
+} // namespace lldb_private
+
+bool lldb_private::formatters::NSArraySummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  static ConstString g_TypeHint("NSArray");
+
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  uint64_t value = 0;
+
+  ConstString class_name(descriptor->GetClassName());
+
+  static const ConstString g_NSArrayI("__NSArrayI");
+  static const ConstString g_NSArrayM("__NSArrayM");
+  static const ConstString g_NSArray0("__NSArray0");
+  static const ConstString g_NSArray1("__NSSingleObjectArrayI");
+  static const ConstString g_NSArrayCF("__NSCFArray");
+
+  if (class_name.IsEmpty())
+    return false;
+
+  if (class_name == g_NSArrayI) {
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+                                                      ptr_size, 0, error);
+    if (error.Fail())
+      return false;
+  } else if (class_name == g_NSArrayM) {
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+                                                      ptr_size, 0, error);
+    if (error.Fail())
+      return false;
+  } else if (class_name == g_NSArray0) {
+    value = 0;
+  } else if (class_name == g_NSArray1) {
+    value = 1;
+  } else if (class_name == g_NSArrayCF) {
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(
+        valobj_addr + 2 * ptr_size, ptr_size, 0, error);
+    if (error.Fail())
+      return false;
+  } else {
+    auto &map(NSArray_Additionals::GetAdditionalSummaries());
+    auto iter = map.find(class_name), end = map.end();
+    if (iter != end)
+      return iter->second(valobj, stream, options);
+    else
+      return false;
+  }
+
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
+    }
+  }
+
+  stream.Printf("%s%" PRIu64 " %s%s%s", prefix.c_str(), value, "element",
+                value == 1 ? "" : "s", suffix.c_str());
+  return true;
+}
+
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::NSArrayMSyntheticFrontEnd(
+    lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
+      m_id_type() {
+  if (valobj_sp) {
+    clang::ASTContext *ast = valobj_sp->GetExecutionContextRef()
+                                 .GetTargetSP()
+                                 ->GetScratchClangASTContext()
+                                 ->getASTContext();
+    if (ast)
+      m_id_type = CompilerType(ast, ast->ObjCBuiltinIdTy);
+    if (valobj_sp->GetProcessSP())
+      m_ptr_size = valobj_sp->GetProcessSP()->GetAddressByteSize();
+  }
+}
+
+lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::
+    NSArrayMSyntheticFrontEnd_109(lldb::ValueObjectSP valobj_sp)
+    : NSArrayMSyntheticFrontEnd(valobj_sp), m_data_32(nullptr),
+      m_data_64(nullptr) {}
+
+lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::
+    NSArrayMSyntheticFrontEnd_1010(lldb::ValueObjectSP valobj_sp)
+    : NSArrayMSyntheticFrontEnd(valobj_sp), m_data_32(nullptr),
+      m_data_64(nullptr) {}
 
 size_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::CalculateNumChildren ()
-{
-    return GetUsedCount();
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::CalculateNumChildren() {
+  return GetUsedCount();
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    if (idx >= CalculateNumChildren())
-        return lldb::ValueObjectSP();
-    lldb::addr_t object_at_idx = GetDataAddress();
-    size_t pyhs_idx = idx;
-    pyhs_idx += GetOffset();
-    if (GetSize() <= pyhs_idx)
-        pyhs_idx -= GetSize();
-    object_at_idx += (pyhs_idx * m_ptr_size);
-    StreamString idx_name;
-    idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-    return CreateValueObjectFromAddress(idx_name.GetData(),
-                                        object_at_idx,
-                                        m_exe_ctx_ref,
-                                        m_id_type);
-}
-
-bool
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::Update()
-{
-    ValueObjectSP valobj_sp = m_backend.GetSP();
-    m_ptr_size = 0;
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
-    if (!valobj_sp)
-        return false;
-    m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
-    Error error;
-    error.Clear();
-    lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return false;
-    m_ptr_size = process_sp->GetAddressByteSize();
-    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
-    if (m_ptr_size == 4)
-    {
-        m_data_32 = new DataDescriptor_32();
-        process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
-    }
-    else
-    {
-        m_data_64 = new DataDescriptor_64();
-        process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
-    }
-    if (error.Fail())
-        return false;
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetChildAtIndex(
+    size_t idx) {
+  if (idx >= CalculateNumChildren())
+    return lldb::ValueObjectSP();
+  lldb::addr_t object_at_idx = GetDataAddress();
+  size_t pyhs_idx = idx;
+  pyhs_idx += GetOffset();
+  if (GetSize() <= pyhs_idx)
+    pyhs_idx -= GetSize();
+  object_at_idx += (pyhs_idx * m_ptr_size);
+  StreamString idx_name;
+  idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+  return CreateValueObjectFromAddress(idx_name.GetData(), object_at_idx,
+                                      m_exe_ctx_ref, m_id_type);
+}
+
+bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::Update() {
+  ValueObjectSP valobj_sp = m_backend.GetSP();
+  m_ptr_size = 0;
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
+  if (!valobj_sp)
+    return false;
+  m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+  Error error;
+  error.Clear();
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
     return false;
+  m_ptr_size = process_sp->GetAddressByteSize();
+  uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
+  if (m_ptr_size == 4) {
+    m_data_32 = new DataDescriptor_32();
+    process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+                           error);
+  } else {
+    m_data_64 = new DataDescriptor_64();
+    process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+                           error);
+  }
+  if (error.Fail())
+    return false;
+  return false;
 }
 
-bool
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::Update()
-{
-    ValueObjectSP valobj_sp = m_backend.GetSP();
-    m_ptr_size = 0;
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
-    if (!valobj_sp)
-        return false;
-    m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
-    Error error;
-    error.Clear();
-    lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return false;
-    m_ptr_size = process_sp->GetAddressByteSize();
-    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
-    if (m_ptr_size == 4)
-    {
-        m_data_32 = new DataDescriptor_32();
-        process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
-    }
-    else
-    {
-        m_data_64 = new DataDescriptor_64();
-        process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
-    }
-    if (error.Fail())
-        return false;
+bool lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::Update() {
+  ValueObjectSP valobj_sp = m_backend.GetSP();
+  m_ptr_size = 0;
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
+  if (!valobj_sp)
+    return false;
+  m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+  Error error;
+  error.Clear();
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
+    return false;
+  m_ptr_size = process_sp->GetAddressByteSize();
+  uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
+  if (m_ptr_size == 4) {
+    m_data_32 = new DataDescriptor_32();
+    process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+                           error);
+  } else {
+    m_data_64 = new DataDescriptor_64();
+    process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+                           error);
+  }
+  if (error.Fail())
     return false;
+  return false;
 }
 
-bool
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::MightHaveChildren ()
-{
-    return true;
+bool lldb_private::formatters::NSArrayMSyntheticFrontEnd::MightHaveChildren() {
+  return true;
 }
 
 size_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    const char* item_name = name.GetCString();
-    uint32_t idx = ExtractIndexFromString(item_name);
-    if (idx < UINT32_MAX && idx >= CalculateNumChildren())
-        return UINT32_MAX;
-    return idx;
+lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetIndexOfChildWithName(
+    const ConstString &name) {
+  const char *item_name = name.GetCString();
+  uint32_t idx = ExtractIndexFromString(item_name);
+  if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+    return UINT32_MAX;
+  return idx;
 }
 
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::~NSArrayMSyntheticFrontEnd_109()
-{
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
+lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::
+    ~NSArrayMSyntheticFrontEnd_109() {
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
 }
 
 lldb::addr_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetDataAddress ()
-{
-    if (!m_data_32 && !m_data_64)
-        return LLDB_INVALID_ADDRESS;
-    return m_data_32 ? m_data_32->_data :
-    m_data_64->_data;
+lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetDataAddress() {
+  if (!m_data_32 && !m_data_64)
+    return LLDB_INVALID_ADDRESS;
+  return m_data_32 ? m_data_32->_data : m_data_64->_data;
 }
 
 uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetUsedCount ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return m_data_32 ? m_data_32->_used :
-    m_data_64->_used;
+lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetUsedCount() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return m_data_32 ? m_data_32->_used : m_data_64->_used;
 }
 
-uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetOffset ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return m_data_32 ? m_data_32->_offset :
-    m_data_64->_offset;
+uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetOffset() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return m_data_32 ? m_data_32->_offset : m_data_64->_offset;
 }
 
-uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetSize ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return m_data_32 ? m_data_32->_size :
-    m_data_64->_size;
+uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_109::GetSize() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return m_data_32 ? m_data_32->_size : m_data_64->_size;
 }
 
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::~NSArrayMSyntheticFrontEnd_1010()
-{
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
+lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::
+    ~NSArrayMSyntheticFrontEnd_1010() {
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
 }
 
 lldb::addr_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetDataAddress ()
-{
-    if (!m_data_32 && !m_data_64)
-        return LLDB_INVALID_ADDRESS;
-    return m_data_32 ? m_data_32->_data :
-    m_data_64->_data;
+lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetDataAddress() {
+  if (!m_data_32 && !m_data_64)
+    return LLDB_INVALID_ADDRESS;
+  return m_data_32 ? m_data_32->_data : m_data_64->_data;
 }
 
 uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetUsedCount ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return m_data_32 ? m_data_32->_used :
-    m_data_64->_used;
+lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetUsedCount() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return m_data_32 ? m_data_32->_used : m_data_64->_used;
 }
 
-uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetOffset ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return m_data_32 ? m_data_32->_offset :
-    m_data_64->_offset;
+uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetOffset() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return m_data_32 ? m_data_32->_offset : m_data_64->_offset;
 }
 
-uint64_t
-lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetSize ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return m_data_32 ? m_data_32->_size :
-    m_data_64->_size;
-}
-
-lldb_private::formatters::NSArrayISyntheticFrontEnd::NSArrayISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd(*valobj_sp),
-    m_exe_ctx_ref(),
-    m_ptr_size(8),
-    m_items(0),
-    m_data_ptr(0)
-{
-    if (valobj_sp)
-    {
-        CompilerType type = valobj_sp->GetCompilerType();
-        if (type)
-        {
-            ClangASTContext *ast = valobj_sp->GetExecutionContextRef().GetTargetSP()->GetScratchClangASTContext();
-            if (ast)
-                m_id_type = CompilerType(ast->getASTContext(), ast->getASTContext()->ObjCBuiltinIdTy);
-        }
+uint64_t lldb_private::formatters::NSArrayMSyntheticFrontEnd_1010::GetSize() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return m_data_32 ? m_data_32->_size : m_data_64->_size;
+}
+
+lldb_private::formatters::NSArrayISyntheticFrontEnd::NSArrayISyntheticFrontEnd(
+    lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
+      m_items(0), m_data_ptr(0) {
+  if (valobj_sp) {
+    CompilerType type = valobj_sp->GetCompilerType();
+    if (type) {
+      ClangASTContext *ast = valobj_sp->GetExecutionContextRef()
+                                 .GetTargetSP()
+                                 ->GetScratchClangASTContext();
+      if (ast)
+        m_id_type = CompilerType(ast->getASTContext(),
+                                 ast->getASTContext()->ObjCBuiltinIdTy);
     }
+  }
 }
 
 size_t
-lldb_private::formatters::NSArrayISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    const char* item_name = name.GetCString();
-    uint32_t idx = ExtractIndexFromString(item_name);
-    if (idx < UINT32_MAX && idx >= CalculateNumChildren())
-        return UINT32_MAX;
-    return idx;
+lldb_private::formatters::NSArrayISyntheticFrontEnd::GetIndexOfChildWithName(
+    const ConstString &name) {
+  const char *item_name = name.GetCString();
+  uint32_t idx = ExtractIndexFromString(item_name);
+  if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+    return UINT32_MAX;
+  return idx;
 }
 
 size_t
-lldb_private::formatters::NSArrayISyntheticFrontEnd::CalculateNumChildren ()
-{
-    return m_items;
+lldb_private::formatters::NSArrayISyntheticFrontEnd::CalculateNumChildren() {
+  return m_items;
 }
 
-bool
-lldb_private::formatters::NSArrayISyntheticFrontEnd::Update()
-{
-    m_ptr_size = 0;
-    m_items = 0;
-    m_data_ptr = 0;
-    ValueObjectSP valobj_sp = m_backend.GetSP();
-    if (!valobj_sp)
-        return false;
-    m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
-    Error error;
-    error.Clear();
-    lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return false;
-    m_ptr_size = process_sp->GetAddressByteSize();
-    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
-    m_items = process_sp->ReadPointerFromMemory(data_location, error);
-    if (error.Fail())
-        return false;
-    m_data_ptr = data_location+m_ptr_size;
+bool lldb_private::formatters::NSArrayISyntheticFrontEnd::Update() {
+  m_ptr_size = 0;
+  m_items = 0;
+  m_data_ptr = 0;
+  ValueObjectSP valobj_sp = m_backend.GetSP();
+  if (!valobj_sp)
+    return false;
+  m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+  Error error;
+  error.Clear();
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
+    return false;
+  m_ptr_size = process_sp->GetAddressByteSize();
+  uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
+  m_items = process_sp->ReadPointerFromMemory(data_location, error);
+  if (error.Fail())
     return false;
+  m_data_ptr = data_location + m_ptr_size;
+  return false;
 }
 
-bool
-lldb_private::formatters::NSArrayISyntheticFrontEnd::MightHaveChildren ()
-{
-    return true;
+bool lldb_private::formatters::NSArrayISyntheticFrontEnd::MightHaveChildren() {
+  return true;
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSArrayISyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    if (idx >= CalculateNumChildren())
-        return lldb::ValueObjectSP();
-    lldb::addr_t object_at_idx = m_data_ptr;
-    object_at_idx += (idx * m_ptr_size);
-    ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
-    if (!process_sp)
-        return lldb::ValueObjectSP();
-    Error error;
-    if (error.Fail())
-        return lldb::ValueObjectSP();
-    StreamString idx_name;
-    idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-    return CreateValueObjectFromAddress(idx_name.GetData(),
-                                        object_at_idx,
-                                        m_exe_ctx_ref,
-                                        m_id_type);
+lldb_private::formatters::NSArrayISyntheticFrontEnd::GetChildAtIndex(
+    size_t idx) {
+  if (idx >= CalculateNumChildren())
+    return lldb::ValueObjectSP();
+  lldb::addr_t object_at_idx = m_data_ptr;
+  object_at_idx += (idx * m_ptr_size);
+  ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
+  if (!process_sp)
+    return lldb::ValueObjectSP();
+  Error error;
+  if (error.Fail())
+    return lldb::ValueObjectSP();
+  StreamString idx_name;
+  idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+  return CreateValueObjectFromAddress(idx_name.GetData(), object_at_idx,
+                                      m_exe_ctx_ref, m_id_type);
 }
 
-lldb_private::formatters::NSArray0SyntheticFrontEnd::NSArray0SyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd(*valobj_sp)
-{
-}
+lldb_private::formatters::NSArray0SyntheticFrontEnd::NSArray0SyntheticFrontEnd(
+    lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp) {}
 
 size_t
-lldb_private::formatters::NSArray0SyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    return UINT32_MAX;
+lldb_private::formatters::NSArray0SyntheticFrontEnd::GetIndexOfChildWithName(
+    const ConstString &name) {
+  return UINT32_MAX;
 }
 
 size_t
-lldb_private::formatters::NSArray0SyntheticFrontEnd::CalculateNumChildren ()
-{
-    return 0;
+lldb_private::formatters::NSArray0SyntheticFrontEnd::CalculateNumChildren() {
+  return 0;
 }
 
-bool
-lldb_private::formatters::NSArray0SyntheticFrontEnd::Update()
-{
-    return false;
+bool lldb_private::formatters::NSArray0SyntheticFrontEnd::Update() {
+  return false;
 }
 
-bool
-lldb_private::formatters::NSArray0SyntheticFrontEnd::MightHaveChildren ()
-{
-    return false;
+bool lldb_private::formatters::NSArray0SyntheticFrontEnd::MightHaveChildren() {
+  return false;
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSArray0SyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    return lldb::ValueObjectSP();
+lldb_private::formatters::NSArray0SyntheticFrontEnd::GetChildAtIndex(
+    size_t idx) {
+  return lldb::ValueObjectSP();
 }
 
-lldb_private::formatters::NSArray1SyntheticFrontEnd::NSArray1SyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-SyntheticChildrenFrontEnd (*valobj_sp.get())
-{
-}
+lldb_private::formatters::NSArray1SyntheticFrontEnd::NSArray1SyntheticFrontEnd(
+    lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp.get()) {}
 
 size_t
-lldb_private::formatters::NSArray1SyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    static const ConstString g_zero("[0]");
-    
-    if (name == g_zero)
-        return 0;
-    
-    return UINT32_MAX;
+lldb_private::formatters::NSArray1SyntheticFrontEnd::GetIndexOfChildWithName(
+    const ConstString &name) {
+  static const ConstString g_zero("[0]");
+
+  if (name == g_zero)
+    return 0;
+
+  return UINT32_MAX;
 }
 
 size_t
-lldb_private::formatters::NSArray1SyntheticFrontEnd::CalculateNumChildren ()
-{
-    return 1;
+lldb_private::formatters::NSArray1SyntheticFrontEnd::CalculateNumChildren() {
+  return 1;
 }
 
-bool
-lldb_private::formatters::NSArray1SyntheticFrontEnd::Update()
-{
-    return false;
+bool lldb_private::formatters::NSArray1SyntheticFrontEnd::Update() {
+  return false;
 }
 
-bool
-lldb_private::formatters::NSArray1SyntheticFrontEnd::MightHaveChildren ()
-{
-    return true;
+bool lldb_private::formatters::NSArray1SyntheticFrontEnd::MightHaveChildren() {
+  return true;
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSArray1SyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    static const ConstString g_zero("[0]");
-    
-    if (idx == 0)
-    {
-        CompilerType id_type(m_backend.GetTargetSP()->GetScratchClangASTContext()->GetBasicType(lldb::eBasicTypeObjCID));
-        return m_backend.GetSyntheticChildAtOffset(m_backend.GetProcessSP()->GetAddressByteSize(), id_type, true, g_zero);
-    }
-    return lldb::ValueObjectSP();
-}
+lldb_private::formatters::NSArray1SyntheticFrontEnd::GetChildAtIndex(
+    size_t idx) {
+  static const ConstString g_zero("[0]");
+
+  if (idx == 0) {
+    CompilerType id_type(
+        m_backend.GetTargetSP()->GetScratchClangASTContext()->GetBasicType(
+            lldb::eBasicTypeObjCID));
+    return m_backend.GetSyntheticChildAtOffset(
+        m_backend.GetProcessSP()->GetAddressByteSize(), id_type, true, g_zero);
+  }
+  return lldb::ValueObjectSP();
+}
+
+SyntheticChildrenFrontEnd *
+lldb_private::formatters::NSArraySyntheticFrontEndCreator(
+    CXXSyntheticChildren *synth, lldb::ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+    return nullptr;
 
-SyntheticChildrenFrontEnd* lldb_private::formatters::NSArraySyntheticFrontEndCreator (CXXSyntheticChildren* synth, lldb::ValueObjectSP valobj_sp)
-{
-    if (!valobj_sp)
-        return nullptr;
-    
-    lldb::ProcessSP process_sp (valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return nullptr;
-    AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(process_sp->GetObjCLanguageRuntime());
-    if (!runtime)
-        return nullptr;
-    
-    CompilerType valobj_type(valobj_sp->GetCompilerType());
-    Flags flags(valobj_type.GetTypeInfo());
-    
-    if (flags.IsClear(eTypeIsPointer))
-    {
-        Error error;
-        valobj_sp = valobj_sp->AddressOf(error);
-        if (error.Fail() || !valobj_sp)
-            return nullptr;
-    }
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(*valobj_sp));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return nullptr;
-    
-    ConstString class_name(descriptor->GetClassName());
-    
-    static const ConstString g_NSArrayI("__NSArrayI");
-    static const ConstString g_NSArrayM("__NSArrayM");
-    static const ConstString g_NSArray0("__NSArray0");
-    static const ConstString g_NSArray1("__NSSingleObjectArrayI");
-    
-    if (class_name.IsEmpty())
-        return nullptr;
-    
-    if (class_name == g_NSArrayI)
-    {
-        return (new NSArrayISyntheticFrontEnd(valobj_sp));
-    }
-    else if (class_name == g_NSArray0)
-    {
-        return (new NSArray0SyntheticFrontEnd(valobj_sp));
-    }
-    else if (class_name == g_NSArray1)
-    {
-        return (new NSArray1SyntheticFrontEnd(valobj_sp));
-    }
-    else if (class_name == g_NSArrayM)
-    {
-        if (runtime->GetFoundationVersion() >= 1100)
-            return (new NSArrayMSyntheticFrontEnd_1010(valobj_sp));
-        else
-            return (new NSArrayMSyntheticFrontEnd_109(valobj_sp));
-    }
-    else
-    {
-        auto& map(NSArray_Additionals::GetAdditionalSynthetics());
-        auto iter = map.find(class_name), end = map.end();
-        if (iter != end)
-            return iter->second(synth, valobj_sp);
-    }
-    
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
+    return nullptr;
+  AppleObjCRuntime *runtime = llvm::dyn_cast_or_null<AppleObjCRuntime>(
+      process_sp->GetObjCLanguageRuntime());
+  if (!runtime)
     return nullptr;
+
+  CompilerType valobj_type(valobj_sp->GetCompilerType());
+  Flags flags(valobj_type.GetTypeInfo());
+
+  if (flags.IsClear(eTypeIsPointer)) {
+    Error error;
+    valobj_sp = valobj_sp->AddressOf(error);
+    if (error.Fail() || !valobj_sp)
+      return nullptr;
+  }
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(*valobj_sp));
+
+  if (!descriptor || !descriptor->IsValid())
+    return nullptr;
+
+  ConstString class_name(descriptor->GetClassName());
+
+  static const ConstString g_NSArrayI("__NSArrayI");
+  static const ConstString g_NSArrayM("__NSArrayM");
+  static const ConstString g_NSArray0("__NSArray0");
+  static const ConstString g_NSArray1("__NSSingleObjectArrayI");
+
+  if (class_name.IsEmpty())
+    return nullptr;
+
+  if (class_name == g_NSArrayI) {
+    return (new NSArrayISyntheticFrontEnd(valobj_sp));
+  } else if (class_name == g_NSArray0) {
+    return (new NSArray0SyntheticFrontEnd(valobj_sp));
+  } else if (class_name == g_NSArray1) {
+    return (new NSArray1SyntheticFrontEnd(valobj_sp));
+  } else if (class_name == g_NSArrayM) {
+    if (runtime->GetFoundationVersion() >= 1100)
+      return (new NSArrayMSyntheticFrontEnd_1010(valobj_sp));
+    else
+      return (new NSArrayMSyntheticFrontEnd_109(valobj_sp));
+  } else {
+    auto &map(NSArray_Additionals::GetAdditionalSynthetics());
+    auto iter = map.find(class_name), end = map.end();
+    if (iter != end)
+      return iter->second(synth, valobj_sp);
+  }
+
+  return nullptr;
 }

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.cpp Tue Sep  6 15:57:50 2016
@@ -34,768 +34,689 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-std::map<ConstString, CXXFunctionSummaryFormat::Callback>&
-NSDictionary_Additionals::GetAdditionalSummaries ()
-{
-    static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
-    return g_map;
-}
-
-std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>&
-NSDictionary_Additionals::GetAdditionalSynthetics ()
-{
-    static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> g_map;
-    return g_map;
-}
-
-static CompilerType
-GetLLDBNSPairType (TargetSP target_sp)
-{
-    CompilerType compiler_type;
-    
-    ClangASTContext *target_ast_context = target_sp->GetScratchClangASTContext();
-    
-    if (target_ast_context)
-    {
-        ConstString g___lldb_autogen_nspair("__lldb_autogen_nspair");
-        
-        compiler_type = target_ast_context->GetTypeForIdentifier<clang::CXXRecordDecl>(g___lldb_autogen_nspair);
-        
-        if (!compiler_type)
-        {
-            compiler_type = target_ast_context->CreateRecordType(nullptr, lldb::eAccessPublic, g___lldb_autogen_nspair.GetCString(), clang::TTK_Struct, lldb::eLanguageTypeC);
-            
-            if (compiler_type)
-            {
-                ClangASTContext::StartTagDeclarationDefinition(compiler_type);
-                CompilerType id_compiler_type = target_ast_context->GetBasicType (eBasicTypeObjCID);
-                ClangASTContext::AddFieldToRecordType(compiler_type, "key", id_compiler_type, lldb::eAccessPublic, 0);
-                ClangASTContext::AddFieldToRecordType(compiler_type, "value", id_compiler_type, lldb::eAccessPublic, 0);
-                ClangASTContext::CompleteTagDeclarationDefinition(compiler_type);
-            }
-        }
+std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
+NSDictionary_Additionals::GetAdditionalSummaries() {
+  static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
+  return g_map;
+}
+
+std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
+NSDictionary_Additionals::GetAdditionalSynthetics() {
+  static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>
+      g_map;
+  return g_map;
+}
+
+static CompilerType GetLLDBNSPairType(TargetSP target_sp) {
+  CompilerType compiler_type;
+
+  ClangASTContext *target_ast_context = target_sp->GetScratchClangASTContext();
+
+  if (target_ast_context) {
+    ConstString g___lldb_autogen_nspair("__lldb_autogen_nspair");
+
+    compiler_type =
+        target_ast_context->GetTypeForIdentifier<clang::CXXRecordDecl>(
+            g___lldb_autogen_nspair);
+
+    if (!compiler_type) {
+      compiler_type = target_ast_context->CreateRecordType(
+          nullptr, lldb::eAccessPublic, g___lldb_autogen_nspair.GetCString(),
+          clang::TTK_Struct, lldb::eLanguageTypeC);
+
+      if (compiler_type) {
+        ClangASTContext::StartTagDeclarationDefinition(compiler_type);
+        CompilerType id_compiler_type =
+            target_ast_context->GetBasicType(eBasicTypeObjCID);
+        ClangASTContext::AddFieldToRecordType(
+            compiler_type, "key", id_compiler_type, lldb::eAccessPublic, 0);
+        ClangASTContext::AddFieldToRecordType(
+            compiler_type, "value", id_compiler_type, lldb::eAccessPublic, 0);
+        ClangASTContext::CompleteTagDeclarationDefinition(compiler_type);
+      }
     }
-    return compiler_type;
+  }
+  return compiler_type;
 }
 
 namespace lldb_private {
-    namespace  formatters {
-        class NSDictionaryISyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSDictionaryISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-            ~NSDictionaryISyntheticFrontEnd() override;
-
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-
-        private:
-            struct DataDescriptor_32
-            {
-                uint32_t _used : 26;
-                uint32_t _szidx : 6;
-            };
-
-            struct DataDescriptor_64
-            {
-                uint64_t _used : 58;
-                uint32_t _szidx : 6;
-            };
-
-            struct DictionaryItemDescriptor
-            {
-                lldb::addr_t key_ptr;
-                lldb::addr_t val_ptr;
-                lldb::ValueObjectSP valobj_sp;
-            };
-
-            ExecutionContextRef m_exe_ctx_ref;
-            uint8_t m_ptr_size;
-            lldb::ByteOrder m_order;
-            DataDescriptor_32 *m_data_32;
-            DataDescriptor_64 *m_data_64;
-            lldb::addr_t m_data_ptr;
-            CompilerType m_pair_type;
-            std::vector<DictionaryItemDescriptor> m_children;
-        };
-
-        class NSDictionary1SyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSDictionary1SyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-            
-            ~NSDictionary1SyntheticFrontEnd() override = default;
-            
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-            
-        private:
-            ValueObjectSP m_pair;
-        };
-        
-        class NSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSDictionaryMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-            ~NSDictionaryMSyntheticFrontEnd() override;
-
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-
-        private:
-            struct DataDescriptor_32
-            {
-                uint32_t _used : 26;
-                uint32_t _kvo : 1;
-                uint32_t _size;
-                uint32_t _mutations;
-                uint32_t _objs_addr;
-                uint32_t _keys_addr;
-            };
-
-            struct DataDescriptor_64
-            {
-                uint64_t _used : 58;
-                uint32_t _kvo : 1;
-                uint64_t _size;
-                uint64_t _mutations;
-                uint64_t _objs_addr;
-                uint64_t _keys_addr;
-            };
-
-            struct DictionaryItemDescriptor
-            {
-                lldb::addr_t key_ptr;
-                lldb::addr_t val_ptr;
-                lldb::ValueObjectSP valobj_sp;
-            };
-
-            ExecutionContextRef m_exe_ctx_ref;
-            uint8_t m_ptr_size;
-            lldb::ByteOrder m_order;
-            DataDescriptor_32 *m_data_32;
-            DataDescriptor_64 *m_data_64;
-            CompilerType m_pair_type;
-            std::vector<DictionaryItemDescriptor> m_children;
-        };
-    } // namespace formatters
+namespace formatters {
+class NSDictionaryISyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSDictionaryISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSDictionaryISyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  struct DataDescriptor_32 {
+    uint32_t _used : 26;
+    uint32_t _szidx : 6;
+  };
+
+  struct DataDescriptor_64 {
+    uint64_t _used : 58;
+    uint32_t _szidx : 6;
+  };
+
+  struct DictionaryItemDescriptor {
+    lldb::addr_t key_ptr;
+    lldb::addr_t val_ptr;
+    lldb::ValueObjectSP valobj_sp;
+  };
+
+  ExecutionContextRef m_exe_ctx_ref;
+  uint8_t m_ptr_size;
+  lldb::ByteOrder m_order;
+  DataDescriptor_32 *m_data_32;
+  DataDescriptor_64 *m_data_64;
+  lldb::addr_t m_data_ptr;
+  CompilerType m_pair_type;
+  std::vector<DictionaryItemDescriptor> m_children;
+};
+
+class NSDictionary1SyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSDictionary1SyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSDictionary1SyntheticFrontEnd() override = default;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  ValueObjectSP m_pair;
+};
+
+class NSDictionaryMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSDictionaryMSyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  struct DataDescriptor_32 {
+    uint32_t _used : 26;
+    uint32_t _kvo : 1;
+    uint32_t _size;
+    uint32_t _mutations;
+    uint32_t _objs_addr;
+    uint32_t _keys_addr;
+  };
+
+  struct DataDescriptor_64 {
+    uint64_t _used : 58;
+    uint32_t _kvo : 1;
+    uint64_t _size;
+    uint64_t _mutations;
+    uint64_t _objs_addr;
+    uint64_t _keys_addr;
+  };
+
+  struct DictionaryItemDescriptor {
+    lldb::addr_t key_ptr;
+    lldb::addr_t val_ptr;
+    lldb::ValueObjectSP valobj_sp;
+  };
+
+  ExecutionContextRef m_exe_ctx_ref;
+  uint8_t m_ptr_size;
+  lldb::ByteOrder m_order;
+  DataDescriptor_32 *m_data_32;
+  DataDescriptor_64 *m_data_64;
+  CompilerType m_pair_type;
+  std::vector<DictionaryItemDescriptor> m_children;
+};
+} // namespace formatters
 } // namespace lldb_private
 
-template<bool name_entries>
-bool
-lldb_private::formatters::NSDictionarySummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    static ConstString g_TypeHint("NSDictionary");
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    bool is_64bit = (ptr_size == 8);
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    uint64_t value = 0;
-    
-    ConstString class_name(descriptor->GetClassName());
-
-    static const ConstString g_DictionaryI("__NSDictionaryI");
-    static const ConstString g_DictionaryM("__NSDictionaryM");
-    static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
-    
-    if (class_name.IsEmpty())
-        return false;
-
-    if (class_name == g_DictionaryI)
-    {
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error);
-        if (error.Fail())
-            return false;
-        value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
-    }
-    else if (class_name == g_DictionaryM)
-    {
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error);
-        if (error.Fail())
-            return false;
-        value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
-    }
-    else if (class_name == g_Dictionary1)
-    {
-        value = 1;
-    }
-    /*else if (!strcmp(class_name,"__NSCFDictionary"))
-     {
-     Error error;
-     value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ? 20 : 12), 4, 0, error);
-     if (error.Fail())
-     return false;
-     if (is_64bit)
-     value &= ~0x0f1f000000000000UL;
-     }*/
-    else
-    {
-        auto& map(NSDictionary_Additionals::GetAdditionalSummaries());
-        auto iter = map.find(class_name), end = map.end();
-        if (iter != end)
-            return iter->second(valobj, stream, options);
-        else
-            return false;
-    }
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(options.GetLanguage()))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%" PRIu64 " %s%s%s",
-                  prefix.c_str(),
-                  value,
-                  "key/value pair",
-                  value == 1 ? "" : "s",
-                  suffix.c_str());
-    return true;
-}
-
-SyntheticChildrenFrontEnd* lldb_private::formatters::NSDictionarySyntheticFrontEndCreator (CXXSyntheticChildren* synth, lldb::ValueObjectSP valobj_sp)
-{
-    lldb::ProcessSP process_sp (valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return nullptr;
-    ObjCLanguageRuntime *runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    if (!runtime)
-        return nullptr;
-    
-    CompilerType valobj_type(valobj_sp->GetCompilerType());
-    Flags flags(valobj_type.GetTypeInfo());
-    
-    if (flags.IsClear(eTypeIsPointer))
-    {
-        Error error;
-        valobj_sp = valobj_sp->AddressOf(error);
-        if (error.Fail() || !valobj_sp)
-            return nullptr;
-    }
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(*valobj_sp));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return nullptr;
-    
-    ConstString class_name(descriptor->GetClassName());
-    
-    static const ConstString g_DictionaryI("__NSDictionaryI");
-    static const ConstString g_DictionaryM("__NSDictionaryM");
-    static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
-    
-    if (class_name.IsEmpty())
-        return nullptr;
-    
-    if (class_name == g_DictionaryI)
-    {
-        return (new NSDictionaryISyntheticFrontEnd(valobj_sp));
-    }
-    else if (class_name == g_DictionaryM)
-    {
-        return (new NSDictionaryMSyntheticFrontEnd(valobj_sp));
-    }
-    else if (class_name == g_Dictionary1)
-    {
-        return (new NSDictionary1SyntheticFrontEnd(valobj_sp));
-    }
+template <bool name_entries>
+bool lldb_private::formatters::NSDictionarySummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  static ConstString g_TypeHint("NSDictionary");
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+  bool is_64bit = (ptr_size == 8);
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  uint64_t value = 0;
+
+  ConstString class_name(descriptor->GetClassName());
+
+  static const ConstString g_DictionaryI("__NSDictionaryI");
+  static const ConstString g_DictionaryM("__NSDictionaryM");
+  static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
+
+  if (class_name.IsEmpty())
+    return false;
+
+  if (class_name == g_DictionaryI) {
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+                                                      ptr_size, 0, error);
+    if (error.Fail())
+      return false;
+    value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
+  } else if (class_name == g_DictionaryM) {
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+                                                      ptr_size, 0, error);
+    if (error.Fail())
+      return false;
+    value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
+  } else if (class_name == g_Dictionary1) {
+    value = 1;
+  }
+  /*else if (!strcmp(class_name,"__NSCFDictionary"))
+   {
+   Error error;
+   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ?
+   20 : 12), 4, 0, error);
+   if (error.Fail())
+   return false;
+   if (is_64bit)
+   value &= ~0x0f1f000000000000UL;
+   }*/
+  else {
+    auto &map(NSDictionary_Additionals::GetAdditionalSummaries());
+    auto iter = map.find(class_name), end = map.end();
+    if (iter != end)
+      return iter->second(valobj, stream, options);
     else
-    {
-        auto& map(NSDictionary_Additionals::GetAdditionalSynthetics());
-        auto iter = map.find(class_name), end = map.end();
-        if (iter != end)
-            return iter->second(synth, valobj_sp);
-    }
-    
+      return false;
+  }
+
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
+    }
+  }
+
+  stream.Printf("%s%" PRIu64 " %s%s%s", prefix.c_str(), value, "key/value pair",
+                value == 1 ? "" : "s", suffix.c_str());
+  return true;
+}
+
+SyntheticChildrenFrontEnd *
+lldb_private::formatters::NSDictionarySyntheticFrontEndCreator(
+    CXXSyntheticChildren *synth, lldb::ValueObjectSP valobj_sp) {
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
+    return nullptr;
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+  if (!runtime)
     return nullptr;
-}
 
-lldb_private::formatters::NSDictionaryISyntheticFrontEnd::NSDictionaryISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd(*valobj_sp),
-    m_exe_ctx_ref(),
-    m_ptr_size(8),
-    m_order(lldb::eByteOrderInvalid),
-    m_data_32(nullptr),
-    m_data_64(nullptr),
-    m_pair_type()
-{
-}
-
-lldb_private::formatters::NSDictionaryISyntheticFrontEnd::~NSDictionaryISyntheticFrontEnd ()
-{
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
-}
-
-size_t
-lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    const char* item_name = name.GetCString();
-    uint32_t idx = ExtractIndexFromString(item_name);
-    if (idx < UINT32_MAX && idx >= CalculateNumChildren())
-        return UINT32_MAX;
-    return idx;
-}
-
-size_t
-lldb_private::formatters::NSDictionaryISyntheticFrontEnd::CalculateNumChildren ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return (m_data_32 ? m_data_32->_used : m_data_64->_used);
-}
-
-bool
-lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update()
-{
-    m_children.clear();
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
-    m_ptr_size = 0;
-    ValueObjectSP valobj_sp = m_backend.GetSP();
-    if (!valobj_sp)
-        return false;
-    m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+  CompilerType valobj_type(valobj_sp->GetCompilerType());
+  Flags flags(valobj_type.GetTypeInfo());
+
+  if (flags.IsClear(eTypeIsPointer)) {
     Error error;
-    error.Clear();
-    lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return false;
-    m_ptr_size = process_sp->GetAddressByteSize();
-    m_order = process_sp->GetByteOrder();
-    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
-    if (m_ptr_size == 4)
-    {
-        m_data_32 = new DataDescriptor_32();
-        process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
-    }
-    else
-    {
-        m_data_64 = new DataDescriptor_64();
-        process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
-    }
-    if (error.Fail())
-        return false;
-    m_data_ptr = data_location + m_ptr_size;
+    valobj_sp = valobj_sp->AddressOf(error);
+    if (error.Fail() || !valobj_sp)
+      return nullptr;
+  }
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(*valobj_sp));
+
+  if (!descriptor || !descriptor->IsValid())
+    return nullptr;
+
+  ConstString class_name(descriptor->GetClassName());
+
+  static const ConstString g_DictionaryI("__NSDictionaryI");
+  static const ConstString g_DictionaryM("__NSDictionaryM");
+  static const ConstString g_Dictionary1("__NSSingleEntryDictionaryI");
+
+  if (class_name.IsEmpty())
+    return nullptr;
+
+  if (class_name == g_DictionaryI) {
+    return (new NSDictionaryISyntheticFrontEnd(valobj_sp));
+  } else if (class_name == g_DictionaryM) {
+    return (new NSDictionaryMSyntheticFrontEnd(valobj_sp));
+  } else if (class_name == g_Dictionary1) {
+    return (new NSDictionary1SyntheticFrontEnd(valobj_sp));
+  } else {
+    auto &map(NSDictionary_Additionals::GetAdditionalSynthetics());
+    auto iter = map.find(class_name), end = map.end();
+    if (iter != end)
+      return iter->second(synth, valobj_sp);
+  }
+
+  return nullptr;
+}
+
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
+    NSDictionaryISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
+      m_order(lldb::eByteOrderInvalid), m_data_32(nullptr), m_data_64(nullptr),
+      m_pair_type() {}
+
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
+    ~NSDictionaryISyntheticFrontEnd() {
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
+}
+
+size_t lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
+    GetIndexOfChildWithName(const ConstString &name) {
+  const char *item_name = name.GetCString();
+  uint32_t idx = ExtractIndexFromString(item_name);
+  if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+    return UINT32_MAX;
+  return idx;
+}
+
+size_t lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
+    CalculateNumChildren() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return (m_data_32 ? m_data_32->_used : m_data_64->_used);
+}
+
+bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::Update() {
+  m_children.clear();
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
+  m_ptr_size = 0;
+  ValueObjectSP valobj_sp = m_backend.GetSP();
+  if (!valobj_sp)
+    return false;
+  m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+  Error error;
+  error.Clear();
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
+    return false;
+  m_ptr_size = process_sp->GetAddressByteSize();
+  m_order = process_sp->GetByteOrder();
+  uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
+  if (m_ptr_size == 4) {
+    m_data_32 = new DataDescriptor_32();
+    process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+                           error);
+  } else {
+    m_data_64 = new DataDescriptor_64();
+    process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+                           error);
+  }
+  if (error.Fail())
     return false;
+  m_data_ptr = data_location + m_ptr_size;
+  return false;
 }
 
-bool
-lldb_private::formatters::NSDictionaryISyntheticFrontEnd::MightHaveChildren ()
-{
-    return true;
+bool lldb_private::formatters::NSDictionaryISyntheticFrontEnd::
+    MightHaveChildren() {
+  return true;
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    uint32_t num_children = CalculateNumChildren();
-    
-    if (idx >= num_children)
+lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex(
+    size_t idx) {
+  uint32_t num_children = CalculateNumChildren();
+
+  if (idx >= num_children)
+    return lldb::ValueObjectSP();
+
+  if (m_children.empty()) {
+    // do the scan phase
+    lldb::addr_t key_at_idx = 0, val_at_idx = 0;
+
+    uint32_t tries = 0;
+    uint32_t test_idx = 0;
+
+    while (tries < num_children) {
+      key_at_idx = m_data_ptr + (2 * test_idx * m_ptr_size);
+      val_at_idx = key_at_idx + m_ptr_size;
+      ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
+      if (!process_sp)
         return lldb::ValueObjectSP();
-    
-    if (m_children.empty())
-    {
-        // do the scan phase
-        lldb::addr_t key_at_idx = 0, val_at_idx = 0;
-        
-        uint32_t tries = 0;
-        uint32_t test_idx = 0;
-        
-        while(tries < num_children)
-        {
-            key_at_idx = m_data_ptr + (2*test_idx * m_ptr_size);
-            val_at_idx = key_at_idx + m_ptr_size;
-            ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
-            if (!process_sp)
-                return lldb::ValueObjectSP();
-            Error error;
-            key_at_idx = process_sp->ReadPointerFromMemory(key_at_idx, error);
-            if (error.Fail())
-                return lldb::ValueObjectSP();
-            val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx, error);
-            if (error.Fail())
-                return lldb::ValueObjectSP();
-            
-            test_idx++;
-            
-            if (!key_at_idx || !val_at_idx)
-                continue;
-            tries++;
-            
-            DictionaryItemDescriptor descriptor = {key_at_idx,val_at_idx,lldb::ValueObjectSP()};
-            
-            m_children.push_back(descriptor);
-        }
-    }
-    
-    if (idx >= m_children.size()) // should never happen
+      Error error;
+      key_at_idx = process_sp->ReadPointerFromMemory(key_at_idx, error);
+      if (error.Fail())
+        return lldb::ValueObjectSP();
+      val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx, error);
+      if (error.Fail())
         return lldb::ValueObjectSP();
-    
-    DictionaryItemDescriptor &dict_item = m_children[idx];
-    if (!dict_item.valobj_sp)
-    {
-        if (!m_pair_type.IsValid())
-        {
-            TargetSP target_sp(m_backend.GetTargetSP());
-            if (!target_sp)
-                return ValueObjectSP();
-            m_pair_type = GetLLDBNSPairType(target_sp);
-        }
-        if (!m_pair_type.IsValid())
-            return ValueObjectSP();
-        
-        DataBufferSP buffer_sp(new DataBufferHeap(2*m_ptr_size,0));
-        
-        if (m_ptr_size == 8)
-        {
-            uint64_t *data_ptr = (uint64_t *)buffer_sp->GetBytes();
-            *data_ptr = dict_item.key_ptr;
-            *(data_ptr+1) = dict_item.val_ptr;
-        }
-        else
-        {
-            uint32_t *data_ptr = (uint32_t *)buffer_sp->GetBytes();
-            *data_ptr = dict_item.key_ptr;
-            *(data_ptr+1) = dict_item.val_ptr;
-        }
-        
-        StreamString idx_name;
-        idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-        DataExtractor data(buffer_sp, m_order, m_ptr_size);
-        dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetData(),
-                                                        data,
-                                                        m_exe_ctx_ref,
-                                                        m_pair_type);
+
+      test_idx++;
+
+      if (!key_at_idx || !val_at_idx)
+        continue;
+      tries++;
+
+      DictionaryItemDescriptor descriptor = {key_at_idx, val_at_idx,
+                                             lldb::ValueObjectSP()};
+
+      m_children.push_back(descriptor);
     }
-    return dict_item.valobj_sp;
+  }
+
+  if (idx >= m_children.size()) // should never happen
+    return lldb::ValueObjectSP();
+
+  DictionaryItemDescriptor &dict_item = m_children[idx];
+  if (!dict_item.valobj_sp) {
+    if (!m_pair_type.IsValid()) {
+      TargetSP target_sp(m_backend.GetTargetSP());
+      if (!target_sp)
+        return ValueObjectSP();
+      m_pair_type = GetLLDBNSPairType(target_sp);
+    }
+    if (!m_pair_type.IsValid())
+      return ValueObjectSP();
+
+    DataBufferSP buffer_sp(new DataBufferHeap(2 * m_ptr_size, 0));
+
+    if (m_ptr_size == 8) {
+      uint64_t *data_ptr = (uint64_t *)buffer_sp->GetBytes();
+      *data_ptr = dict_item.key_ptr;
+      *(data_ptr + 1) = dict_item.val_ptr;
+    } else {
+      uint32_t *data_ptr = (uint32_t *)buffer_sp->GetBytes();
+      *data_ptr = dict_item.key_ptr;
+      *(data_ptr + 1) = dict_item.val_ptr;
+    }
+
+    StreamString idx_name;
+    idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+    DataExtractor data(buffer_sp, m_order, m_ptr_size);
+    dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetData(), data,
+                                                    m_exe_ctx_ref, m_pair_type);
+  }
+  return dict_item.valobj_sp;
 }
 
-lldb_private::formatters::NSDictionary1SyntheticFrontEnd::NSDictionary1SyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-SyntheticChildrenFrontEnd(*valobj_sp.get()),
-m_pair(nullptr)
-{
-}
-
-size_t
-lldb_private::formatters::NSDictionary1SyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    static const ConstString g_zero("[0]");
-    
-    if (name == g_zero)
-        return 0;
-    
-    return UINT32_MAX;
+lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
+    NSDictionary1SyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp.get()), m_pair(nullptr) {}
+
+size_t lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
+    GetIndexOfChildWithName(const ConstString &name) {
+  static const ConstString g_zero("[0]");
+
+  if (name == g_zero)
+    return 0;
+
+  return UINT32_MAX;
 }
 
-size_t
-lldb_private::formatters::NSDictionary1SyntheticFrontEnd::CalculateNumChildren ()
-{
-    return 1;
+size_t lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
+    CalculateNumChildren() {
+  return 1;
 }
 
-bool
-lldb_private::formatters::NSDictionary1SyntheticFrontEnd::Update()
-{
-    m_pair.reset();
-    return false;
+bool lldb_private::formatters::NSDictionary1SyntheticFrontEnd::Update() {
+  m_pair.reset();
+  return false;
 }
 
-bool
-lldb_private::formatters::NSDictionary1SyntheticFrontEnd::MightHaveChildren ()
-{
-    return true;
+bool lldb_private::formatters::NSDictionary1SyntheticFrontEnd::
+    MightHaveChildren() {
+  return true;
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSDictionary1SyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    if (idx != 0)
-        return lldb::ValueObjectSP();
-    
-    if (m_pair.get())
-        return m_pair;
-    
-    auto process_sp(m_backend.GetProcessSP());
-    if (!process_sp)
-        return nullptr;
-    
-    auto ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t key_ptr = m_backend.GetValueAsUnsigned(LLDB_INVALID_ADDRESS) + ptr_size;
-    lldb::addr_t value_ptr = key_ptr + ptr_size;
-    
-    Error error;
-    
-    lldb::addr_t value_at_idx = process_sp->ReadPointerFromMemory(key_ptr, error);
-    if (error.Fail())
-        return nullptr;
-    lldb::addr_t key_at_idx = process_sp->ReadPointerFromMemory(value_ptr, error);
-    if (error.Fail())
-        return nullptr;
-    
-    auto pair_type = GetLLDBNSPairType(process_sp->GetTarget().shared_from_this());
-    
-    DataBufferSP buffer_sp(new DataBufferHeap(2*ptr_size,0));
-    
-    if (ptr_size == 8)
-    {
-        uint64_t *data_ptr = (uint64_t *)buffer_sp->GetBytes();
-        *data_ptr = key_at_idx;
-        *(data_ptr+1) = value_at_idx;
-    }
-    else
-    {
-        uint32_t *data_ptr = (uint32_t *)buffer_sp->GetBytes();
-        *data_ptr = key_ptr;
-        *(data_ptr+1) = value_ptr;
-    }
-    
-    DataExtractor data(buffer_sp, process_sp->GetByteOrder(), ptr_size);
-    m_pair = CreateValueObjectFromData("[0]",
-                                       data,
-                                       m_backend.GetExecutionContextRef(),
-                                       pair_type);
+lldb_private::formatters::NSDictionary1SyntheticFrontEnd::GetChildAtIndex(
+    size_t idx) {
+  if (idx != 0)
+    return lldb::ValueObjectSP();
 
-    
+  if (m_pair.get())
     return m_pair;
+
+  auto process_sp(m_backend.GetProcessSP());
+  if (!process_sp)
+    return nullptr;
+
+  auto ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t key_ptr =
+      m_backend.GetValueAsUnsigned(LLDB_INVALID_ADDRESS) + ptr_size;
+  lldb::addr_t value_ptr = key_ptr + ptr_size;
+
+  Error error;
+
+  lldb::addr_t value_at_idx = process_sp->ReadPointerFromMemory(key_ptr, error);
+  if (error.Fail())
+    return nullptr;
+  lldb::addr_t key_at_idx = process_sp->ReadPointerFromMemory(value_ptr, error);
+  if (error.Fail())
+    return nullptr;
+
+  auto pair_type =
+      GetLLDBNSPairType(process_sp->GetTarget().shared_from_this());
+
+  DataBufferSP buffer_sp(new DataBufferHeap(2 * ptr_size, 0));
+
+  if (ptr_size == 8) {
+    uint64_t *data_ptr = (uint64_t *)buffer_sp->GetBytes();
+    *data_ptr = key_at_idx;
+    *(data_ptr + 1) = value_at_idx;
+  } else {
+    uint32_t *data_ptr = (uint32_t *)buffer_sp->GetBytes();
+    *data_ptr = key_ptr;
+    *(data_ptr + 1) = value_ptr;
+  }
+
+  DataExtractor data(buffer_sp, process_sp->GetByteOrder(), ptr_size);
+  m_pair = CreateValueObjectFromData(
+      "[0]", data, m_backend.GetExecutionContextRef(), pair_type);
+
+  return m_pair;
+}
+
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
+    NSDictionaryMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
+      m_order(lldb::eByteOrderInvalid), m_data_32(nullptr), m_data_64(nullptr),
+      m_pair_type() {}
+
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
+    ~NSDictionaryMSyntheticFrontEnd() {
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
+}
+
+size_t lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
+    GetIndexOfChildWithName(const ConstString &name) {
+  const char *item_name = name.GetCString();
+  uint32_t idx = ExtractIndexFromString(item_name);
+  if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+    return UINT32_MAX;
+  return idx;
 }
 
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::NSDictionaryMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd(*valobj_sp),
-    m_exe_ctx_ref(),
-    m_ptr_size(8),
-    m_order(lldb::eByteOrderInvalid),
-    m_data_32(nullptr),
-    m_data_64(nullptr),
-    m_pair_type()
-{
-}
-
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::~NSDictionaryMSyntheticFrontEnd ()
-{
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
-}
-
-size_t
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    const char* item_name = name.GetCString();
-    uint32_t idx = ExtractIndexFromString(item_name);
-    if (idx < UINT32_MAX && idx >= CalculateNumChildren())
-        return UINT32_MAX;
-    return idx;
-}
-
-size_t
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::CalculateNumChildren ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return (m_data_32 ? m_data_32->_used : m_data_64->_used);
-}
-
-bool
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::Update()
-{
-    m_children.clear();
-    ValueObjectSP valobj_sp = m_backend.GetSP();
-    m_ptr_size = 0;
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
-    if (!valobj_sp)
-        return false;
-    m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
-    Error error;
-    error.Clear();
-    lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return false;
-    m_ptr_size = process_sp->GetAddressByteSize();
-    m_order = process_sp->GetByteOrder();
-    uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
-    if (m_ptr_size == 4)
-    {
-        m_data_32 = new DataDescriptor_32();
-        process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
-    }
-    else
-    {
-        m_data_64 = new DataDescriptor_64();
-        process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
-    }
-    if (error.Fail())
-        return false;
+size_t lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
+    CalculateNumChildren() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return (m_data_32 ? m_data_32->_used : m_data_64->_used);
+}
+
+bool lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::Update() {
+  m_children.clear();
+  ValueObjectSP valobj_sp = m_backend.GetSP();
+  m_ptr_size = 0;
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
+  if (!valobj_sp)
+    return false;
+  m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+  Error error;
+  error.Clear();
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
     return false;
+  m_ptr_size = process_sp->GetAddressByteSize();
+  m_order = process_sp->GetByteOrder();
+  uint64_t data_location = valobj_sp->GetValueAsUnsigned(0) + m_ptr_size;
+  if (m_ptr_size == 4) {
+    m_data_32 = new DataDescriptor_32();
+    process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+                           error);
+  } else {
+    m_data_64 = new DataDescriptor_64();
+    process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+                           error);
+  }
+  if (error.Fail())
+    return false;
+  return false;
 }
 
-bool
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::MightHaveChildren ()
-{
-    return true;
+bool lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::
+    MightHaveChildren() {
+  return true;
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    lldb::addr_t m_keys_ptr = (m_data_32 ? m_data_32->_keys_addr : m_data_64->_keys_addr);
-    lldb::addr_t m_values_ptr = (m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
-    
-    uint32_t num_children = CalculateNumChildren();
-    
-    if (idx >= num_children)
+lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex(
+    size_t idx) {
+  lldb::addr_t m_keys_ptr =
+      (m_data_32 ? m_data_32->_keys_addr : m_data_64->_keys_addr);
+  lldb::addr_t m_values_ptr =
+      (m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
+
+  uint32_t num_children = CalculateNumChildren();
+
+  if (idx >= num_children)
+    return lldb::ValueObjectSP();
+
+  if (m_children.empty()) {
+    // do the scan phase
+    lldb::addr_t key_at_idx = 0, val_at_idx = 0;
+
+    uint32_t tries = 0;
+    uint32_t test_idx = 0;
+
+    while (tries < num_children) {
+      key_at_idx = m_keys_ptr + (test_idx * m_ptr_size);
+      val_at_idx = m_values_ptr + (test_idx * m_ptr_size);
+      ;
+      ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
+      if (!process_sp)
         return lldb::ValueObjectSP();
-    
-    if (m_children.empty())
-    {
-        // do the scan phase
-        lldb::addr_t key_at_idx = 0, val_at_idx = 0;
-        
-        uint32_t tries = 0;
-        uint32_t test_idx = 0;
-        
-        while(tries < num_children)
-        {
-            key_at_idx = m_keys_ptr + (test_idx * m_ptr_size);
-            val_at_idx = m_values_ptr + (test_idx * m_ptr_size);;
-            ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
-            if (!process_sp)
-                return lldb::ValueObjectSP();
-            Error error;
-            key_at_idx = process_sp->ReadPointerFromMemory(key_at_idx, error);
-            if (error.Fail())
-                return lldb::ValueObjectSP();
-            val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx, error);
-            if (error.Fail())
-                return lldb::ValueObjectSP();
-            
-            test_idx++;
-            
-            if (!key_at_idx || !val_at_idx)
-                continue;
-            tries++;
-            
-            DictionaryItemDescriptor descriptor = {key_at_idx,val_at_idx,lldb::ValueObjectSP()};
-            
-            m_children.push_back(descriptor);
-        }
-    }
-    
-    if (idx >= m_children.size()) // should never happen
+      Error error;
+      key_at_idx = process_sp->ReadPointerFromMemory(key_at_idx, error);
+      if (error.Fail())
         return lldb::ValueObjectSP();
-    
-    DictionaryItemDescriptor &dict_item = m_children[idx];
-    if (!dict_item.valobj_sp)
-    {
-        if (!m_pair_type.IsValid())
-        {
-            TargetSP target_sp(m_backend.GetTargetSP());
-            if (!target_sp)
-                return ValueObjectSP();
-            m_pair_type = GetLLDBNSPairType(target_sp);
-        }
-        if (!m_pair_type.IsValid())
-            return ValueObjectSP();
-        
-        DataBufferSP buffer_sp(new DataBufferHeap(2*m_ptr_size,0));
-        
-        if (m_ptr_size == 8)
-        {
-            uint64_t *data_ptr = (uint64_t *)buffer_sp->GetBytes();
-            *data_ptr = dict_item.key_ptr;
-            *(data_ptr+1) = dict_item.val_ptr;
-        }
-        else
-        {
-            uint32_t *data_ptr = (uint32_t *)buffer_sp->GetBytes();
-            *data_ptr = dict_item.key_ptr;
-            *(data_ptr+1) = dict_item.val_ptr;
-        }
-        
-        StreamString idx_name;
-        idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-        DataExtractor data(buffer_sp, m_order, m_ptr_size);
-        dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetData(),
-                                                        data,
-                                                        m_exe_ctx_ref,
-                                                        m_pair_type);
+      val_at_idx = process_sp->ReadPointerFromMemory(val_at_idx, error);
+      if (error.Fail())
+        return lldb::ValueObjectSP();
+
+      test_idx++;
+
+      if (!key_at_idx || !val_at_idx)
+        continue;
+      tries++;
+
+      DictionaryItemDescriptor descriptor = {key_at_idx, val_at_idx,
+                                             lldb::ValueObjectSP()};
+
+      m_children.push_back(descriptor);
+    }
+  }
+
+  if (idx >= m_children.size()) // should never happen
+    return lldb::ValueObjectSP();
+
+  DictionaryItemDescriptor &dict_item = m_children[idx];
+  if (!dict_item.valobj_sp) {
+    if (!m_pair_type.IsValid()) {
+      TargetSP target_sp(m_backend.GetTargetSP());
+      if (!target_sp)
+        return ValueObjectSP();
+      m_pair_type = GetLLDBNSPairType(target_sp);
     }
-    return dict_item.valobj_sp;
+    if (!m_pair_type.IsValid())
+      return ValueObjectSP();
+
+    DataBufferSP buffer_sp(new DataBufferHeap(2 * m_ptr_size, 0));
+
+    if (m_ptr_size == 8) {
+      uint64_t *data_ptr = (uint64_t *)buffer_sp->GetBytes();
+      *data_ptr = dict_item.key_ptr;
+      *(data_ptr + 1) = dict_item.val_ptr;
+    } else {
+      uint32_t *data_ptr = (uint32_t *)buffer_sp->GetBytes();
+      *data_ptr = dict_item.key_ptr;
+      *(data_ptr + 1) = dict_item.val_ptr;
+    }
+
+    StreamString idx_name;
+    idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+    DataExtractor data(buffer_sp, m_order, m_ptr_size);
+    dict_item.valobj_sp = CreateValueObjectFromData(idx_name.GetData(), data,
+                                                    m_exe_ctx_ref, m_pair_type);
+  }
+  return dict_item.valobj_sp;
 }
 
-template bool
-lldb_private::formatters::NSDictionarySummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&);
+template bool lldb_private::formatters::NSDictionarySummaryProvider<true>(
+    ValueObject &, Stream &, const TypeSummaryOptions &);
 
-template bool
-lldb_private::formatters::NSDictionarySummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&);
+template bool lldb_private::formatters::NSDictionarySummaryProvider<false>(
+    ValueObject &, Stream &, const TypeSummaryOptions &);

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.h (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSDictionary.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- NSDictionary.h ---------------------------------------------------*- C++ -*-===//
+//===-- NSDictionary.h ---------------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -19,30 +20,32 @@
 #include <map>
 
 namespace lldb_private {
-    namespace formatters
-    {
-        template<bool name_entries>
-        bool
-        NSDictionarySummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-
-        extern template bool
-        NSDictionarySummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
-        
-        extern template bool
-        NSDictionarySummaryProvider<false> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
-        
-        SyntheticChildrenFrontEnd* NSDictionarySyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-        
-        class NSDictionary_Additionals
-        {
-        public:
-            static std::map<ConstString, CXXFunctionSummaryFormat::Callback>&
-            GetAdditionalSummaries ();
-            
-            static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>&
-            GetAdditionalSynthetics ();
-        };
-    } // namespace formatters
+namespace formatters {
+template <bool name_entries>
+bool NSDictionarySummaryProvider(ValueObject &valobj, Stream &stream,
+                                 const TypeSummaryOptions &options);
+
+extern template bool
+NSDictionarySummaryProvider<true>(ValueObject &, Stream &,
+                                  const TypeSummaryOptions &);
+
+extern template bool
+NSDictionarySummaryProvider<false>(ValueObject &, Stream &,
+                                   const TypeSummaryOptions &);
+
+SyntheticChildrenFrontEnd *
+NSDictionarySyntheticFrontEndCreator(CXXSyntheticChildren *,
+                                     lldb::ValueObjectSP);
+
+class NSDictionary_Additionals {
+public:
+  static std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
+  GetAdditionalSummaries();
+
+  static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
+  GetAdditionalSynthetics();
+};
+} // namespace formatters
 } // namespace lldb_private
 
 #endif // liblldb_NSDictionary_h_

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSError.cpp Tue Sep  6 15:57:50 2016
@@ -34,196 +34,187 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-static lldb::addr_t
-DerefToNSErrorPointer (ValueObject& valobj)
-{
-    CompilerType valobj_type(valobj.GetCompilerType());
-    Flags type_flags(valobj_type.GetTypeInfo());
-    if (type_flags.AllClear(eTypeHasValue))
-    {
-        if (valobj.IsBaseClass() && valobj.GetParent())
-            return valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-    }
-    else
-    {
-        lldb::addr_t ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-        if (type_flags.AllSet(eTypeIsPointer))
-        {
-            CompilerType pointee_type(valobj_type.GetPointeeType());
-            Flags pointee_flags(pointee_type.GetTypeInfo());
-            if (pointee_flags.AllSet(eTypeIsPointer))
-            {
-                if (ProcessSP process_sp = valobj.GetProcessSP())
-                {
-                    Error error;
-                    ptr_value = process_sp->ReadPointerFromMemory(ptr_value, error);
-                }
-            }
+static lldb::addr_t DerefToNSErrorPointer(ValueObject &valobj) {
+  CompilerType valobj_type(valobj.GetCompilerType());
+  Flags type_flags(valobj_type.GetTypeInfo());
+  if (type_flags.AllClear(eTypeHasValue)) {
+    if (valobj.IsBaseClass() && valobj.GetParent())
+      return valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+  } else {
+    lldb::addr_t ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+    if (type_flags.AllSet(eTypeIsPointer)) {
+      CompilerType pointee_type(valobj_type.GetPointeeType());
+      Flags pointee_flags(pointee_type.GetTypeInfo());
+      if (pointee_flags.AllSet(eTypeIsPointer)) {
+        if (ProcessSP process_sp = valobj.GetProcessSP()) {
+          Error error;
+          ptr_value = process_sp->ReadPointerFromMemory(ptr_value, error);
         }
-        return ptr_value;
+      }
     }
-    
-    return LLDB_INVALID_ADDRESS;
+    return ptr_value;
+  }
+
+  return LLDB_INVALID_ADDRESS;
+}
+
+bool lldb_private::formatters::NSError_SummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp(valobj.GetProcessSP());
+  if (!process_sp)
+    return false;
+
+  lldb::addr_t ptr_value = DerefToNSErrorPointer(valobj);
+  if (ptr_value == LLDB_INVALID_ADDRESS)
+    return false;
+
+  size_t ptr_size = process_sp->GetAddressByteSize();
+  lldb::addr_t code_location = ptr_value + 2 * ptr_size;
+  lldb::addr_t domain_location = ptr_value + 3 * ptr_size;
+
+  Error error;
+  uint64_t code = process_sp->ReadUnsignedIntegerFromMemory(code_location,
+                                                            ptr_size, 0, error);
+  if (error.Fail())
+    return false;
+
+  lldb::addr_t domain_str_value =
+      process_sp->ReadPointerFromMemory(domain_location, error);
+  if (error.Fail() || domain_str_value == LLDB_INVALID_ADDRESS)
+    return false;
+
+  if (!domain_str_value) {
+    stream.Printf("domain: nil - code: %" PRIu64, code);
+    return true;
+  }
+
+  InferiorSizedWord isw(domain_str_value, *process_sp);
+
+  ValueObjectSP domain_str_sp = ValueObject::CreateValueObjectFromData(
+      "domain_str", isw.GetAsData(process_sp->GetByteOrder()),
+      valobj.GetExecutionContextRef(), process_sp->GetTarget()
+                                           .GetScratchClangASTContext()
+                                           ->GetBasicType(lldb::eBasicTypeVoid)
+                                           .GetPointerType());
+
+  if (!domain_str_sp)
+    return false;
+
+  StreamString domain_str_summary;
+  if (NSStringSummaryProvider(*domain_str_sp, domain_str_summary, options) &&
+      !domain_str_summary.Empty()) {
+    stream.Printf("domain: %s - code: %" PRIu64, domain_str_summary.GetData(),
+                  code);
+    return true;
+  } else {
+    stream.Printf("domain: nil - code: %" PRIu64, code);
+    return true;
+  }
 }
 
-bool
-lldb_private::formatters::NSError_SummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp(valobj.GetProcessSP());
+class NSErrorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSErrorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+      : SyntheticChildrenFrontEnd(*valobj_sp) {}
+
+  ~NSErrorSyntheticFrontEnd() override = default;
+  // no need to delete m_child_ptr - it's kept alive by the cluster manager on
+  // our behalf
+
+  size_t CalculateNumChildren() override {
+    if (m_child_ptr)
+      return 1;
+    if (m_child_sp)
+      return 1;
+    return 0;
+  }
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+    if (idx != 0)
+      return lldb::ValueObjectSP();
+
+    if (m_child_ptr)
+      return m_child_ptr->GetSP();
+    return m_child_sp;
+  }
+
+  bool Update() override {
+    m_child_ptr = nullptr;
+    m_child_sp.reset();
+
+    ProcessSP process_sp(m_backend.GetProcessSP());
     if (!process_sp)
-        return false;
-    
-    lldb::addr_t ptr_value = DerefToNSErrorPointer(valobj);
-    if (ptr_value == LLDB_INVALID_ADDRESS)
-        return false;
+      return false;
+
+    lldb::addr_t userinfo_location = DerefToNSErrorPointer(m_backend);
+    if (userinfo_location == LLDB_INVALID_ADDRESS)
+      return false;
 
     size_t ptr_size = process_sp->GetAddressByteSize();
-    lldb::addr_t code_location = ptr_value + 2 * ptr_size;
-    lldb::addr_t domain_location = ptr_value + 3 * ptr_size;
-    
-    Error error;
-    uint64_t code = process_sp->ReadUnsignedIntegerFromMemory(code_location, ptr_size, 0, error);
-    if (error.Fail())
-        return false;
-    
-    lldb::addr_t domain_str_value = process_sp->ReadPointerFromMemory(domain_location, error);
-    if (error.Fail() || domain_str_value == LLDB_INVALID_ADDRESS)
-        return false;
-    
-    if (!domain_str_value)
-    {
-        stream.Printf("domain: nil - code: %" PRIu64, code);
-        return true;
-    }
-    
-    InferiorSizedWord isw(domain_str_value, *process_sp);
-    
-    ValueObjectSP domain_str_sp = ValueObject::CreateValueObjectFromData("domain_str", isw.GetAsData(process_sp->GetByteOrder()), valobj.GetExecutionContextRef(), process_sp->GetTarget().GetScratchClangASTContext()->GetBasicType(lldb::eBasicTypeVoid).GetPointerType());
-    
-    if (!domain_str_sp)
-        return false;
-    
-    StreamString domain_str_summary;
-    if (NSStringSummaryProvider(*domain_str_sp, domain_str_summary, options) && !domain_str_summary.Empty())
-    {
-        stream.Printf("domain: %s - code: %" PRIu64, domain_str_summary.GetData(), code);
-        return true;
-    }
-    else
-    {
-        stream.Printf("domain: nil - code: %" PRIu64, code);
-        return true;
-    }
-}
 
-class NSErrorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-{
-public:
-    NSErrorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd(*valobj_sp)
-    {}
-
-    ~NSErrorSyntheticFrontEnd() override = default;
-    // no need to delete m_child_ptr - it's kept alive by the cluster manager on our behalf
-
-    size_t
-    CalculateNumChildren() override
-    {
-        if (m_child_ptr)
-            return 1;
-        if (m_child_sp)
-            return 1;
-        return 0;
-    }
-    
-    lldb::ValueObjectSP
-    GetChildAtIndex(size_t idx) override
-    {
-        if (idx != 0)
-            return lldb::ValueObjectSP();
-        
-        if (m_child_ptr)
-            return m_child_ptr->GetSP();
-        return m_child_sp;
-    }
-    
-    bool
-    Update() override
-    {
-        m_child_ptr = nullptr;
-        m_child_sp.reset();
-        
-        ProcessSP process_sp(m_backend.GetProcessSP());
-        if (!process_sp)
-            return false;
-        
-        lldb::addr_t userinfo_location = DerefToNSErrorPointer(m_backend);
-        if (userinfo_location == LLDB_INVALID_ADDRESS)
-            return false;
-        
-        size_t ptr_size = process_sp->GetAddressByteSize();
-
-        userinfo_location += 4 * ptr_size;
-        Error error;
-        lldb::addr_t userinfo = process_sp->ReadPointerFromMemory(userinfo_location, error);
-        if (userinfo == LLDB_INVALID_ADDRESS || error.Fail())
-            return false;
-        InferiorSizedWord isw(userinfo,*process_sp);
-        m_child_sp = CreateValueObjectFromData("_userInfo",
-                                               isw.GetAsData(process_sp->GetByteOrder()),
-                                               m_backend.GetExecutionContextRef(),
-                                               process_sp->GetTarget().GetScratchClangASTContext()->GetBasicType(lldb::eBasicTypeObjCID));
-        return false;
-    }
-    
-    bool
-    MightHaveChildren() override
-    {
-        return true;
-    }
-    
-    size_t
-    GetIndexOfChildWithName(const ConstString &name) override
-    {
-        static ConstString g___userInfo("_userInfo");
-        if (name == g___userInfo)
-            return 0;
-        return UINT32_MAX;
-    }
+    userinfo_location += 4 * ptr_size;
+    Error error;
+    lldb::addr_t userinfo =
+        process_sp->ReadPointerFromMemory(userinfo_location, error);
+    if (userinfo == LLDB_INVALID_ADDRESS || error.Fail())
+      return false;
+    InferiorSizedWord isw(userinfo, *process_sp);
+    m_child_sp = CreateValueObjectFromData(
+        "_userInfo", isw.GetAsData(process_sp->GetByteOrder()),
+        m_backend.GetExecutionContextRef(),
+        process_sp->GetTarget().GetScratchClangASTContext()->GetBasicType(
+            lldb::eBasicTypeObjCID));
+    return false;
+  }
+
+  bool MightHaveChildren() override { return true; }
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override {
+    static ConstString g___userInfo("_userInfo");
+    if (name == g___userInfo)
+      return 0;
+    return UINT32_MAX;
+  }
 
 private:
-    // the child here can be "real" (i.e. an actual child of the root) or synthetized from raw memory
-    // if the former, I need to store a plain pointer to it - or else a loop of references will cause this entire hierarchy of values to leak
-    // if the latter, then I need to store a SharedPointer to it - so that it only goes away when everyone else in the cluster goes away
-    // oh joy!
-    ValueObject* m_child_ptr;
-    ValueObjectSP m_child_sp;
+  // the child here can be "real" (i.e. an actual child of the root) or
+  // synthetized from raw memory
+  // if the former, I need to store a plain pointer to it - or else a loop of
+  // references will cause this entire hierarchy of values to leak
+  // if the latter, then I need to store a SharedPointer to it - so that it only
+  // goes away when everyone else in the cluster goes away
+  // oh joy!
+  ValueObject *m_child_ptr;
+  ValueObjectSP m_child_sp;
 };
 
-SyntheticChildrenFrontEnd*
-lldb_private::formatters::NSErrorSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
-{
-    lldb::ProcessSP process_sp (valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return nullptr;
-    ObjCLanguageRuntime *runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    if (!runtime)
-        return nullptr;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(*valobj_sp.get()));
-    
-    if (!descriptor.get() || !descriptor->IsValid())
-        return nullptr;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return nullptr;
-    
-    if (!strcmp(class_name,"NSError"))
-        return (new NSErrorSyntheticFrontEnd(valobj_sp));
-    else if (!strcmp(class_name,"__NSCFError"))
-        return (new NSErrorSyntheticFrontEnd(valobj_sp));
-    
+SyntheticChildrenFrontEnd *
+lldb_private::formatters::NSErrorSyntheticFrontEndCreator(
+    CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
     return nullptr;
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+  if (!runtime)
+    return nullptr;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(*valobj_sp.get()));
+
+  if (!descriptor.get() || !descriptor->IsValid())
+    return nullptr;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
+
+  if (!class_name || !*class_name)
+    return nullptr;
+
+  if (!strcmp(class_name, "NSError"))
+    return (new NSErrorSyntheticFrontEnd(valobj_sp));
+  else if (!strcmp(class_name, "__NSCFError"))
+    return (new NSErrorSyntheticFrontEnd(valobj_sp));
+
+  return nullptr;
 }

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSException.cpp Tue Sep  6 15:57:50 2016
@@ -34,186 +34,183 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-bool
-lldb_private::formatters::NSException_SummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    ProcessSP process_sp(valobj.GetProcessSP());
+bool lldb_private::formatters::NSException_SummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  ProcessSP process_sp(valobj.GetProcessSP());
+  if (!process_sp)
+    return false;
+
+  lldb::addr_t ptr_value = LLDB_INVALID_ADDRESS;
+
+  CompilerType valobj_type(valobj.GetCompilerType());
+  Flags type_flags(valobj_type.GetTypeInfo());
+  if (type_flags.AllClear(eTypeHasValue)) {
+    if (valobj.IsBaseClass() && valobj.GetParent())
+      ptr_value = valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+  } else
+    ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+
+  if (ptr_value == LLDB_INVALID_ADDRESS)
+    return false;
+  size_t ptr_size = process_sp->GetAddressByteSize();
+  lldb::addr_t name_location = ptr_value + 1 * ptr_size;
+  lldb::addr_t reason_location = ptr_value + 2 * ptr_size;
+
+  Error error;
+  lldb::addr_t name = process_sp->ReadPointerFromMemory(name_location, error);
+  if (error.Fail() || name == LLDB_INVALID_ADDRESS)
+    return false;
+
+  lldb::addr_t reason =
+      process_sp->ReadPointerFromMemory(reason_location, error);
+  if (error.Fail() || reason == LLDB_INVALID_ADDRESS)
+    return false;
+
+  InferiorSizedWord name_isw(name, *process_sp);
+  InferiorSizedWord reason_isw(reason, *process_sp);
+
+  CompilerType voidstar = process_sp->GetTarget()
+                              .GetScratchClangASTContext()
+                              ->GetBasicType(lldb::eBasicTypeVoid)
+                              .GetPointerType();
+
+  ValueObjectSP name_sp = ValueObject::CreateValueObjectFromData(
+      "name_str", name_isw.GetAsData(process_sp->GetByteOrder()),
+      valobj.GetExecutionContextRef(), voidstar);
+  ValueObjectSP reason_sp = ValueObject::CreateValueObjectFromData(
+      "reason_str", reason_isw.GetAsData(process_sp->GetByteOrder()),
+      valobj.GetExecutionContextRef(), voidstar);
+
+  if (!name_sp || !reason_sp)
+    return false;
+
+  StreamString name_str_summary;
+  StreamString reason_str_summary;
+  if (NSStringSummaryProvider(*name_sp, name_str_summary, options) &&
+      NSStringSummaryProvider(*reason_sp, reason_str_summary, options) &&
+      !name_str_summary.Empty() && !reason_str_summary.Empty()) {
+    stream.Printf("name: %s - reason: %s", name_str_summary.GetData(),
+                  reason_str_summary.GetData());
+    return true;
+  } else
+    return false;
+}
+
+class NSExceptionSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSExceptionSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+      : SyntheticChildrenFrontEnd(*valobj_sp) {}
+
+  ~NSExceptionSyntheticFrontEnd() override = default;
+  // no need to delete m_child_ptr - it's kept alive by the cluster manager on
+  // our behalf
+
+  size_t CalculateNumChildren() override {
+    if (m_child_ptr)
+      return 1;
+    if (m_child_sp)
+      return 1;
+    return 0;
+  }
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+    if (idx != 0)
+      return lldb::ValueObjectSP();
+
+    if (m_child_ptr)
+      return m_child_ptr->GetSP();
+    return m_child_sp;
+  }
+
+  bool Update() override {
+    m_child_ptr = nullptr;
+    m_child_sp.reset();
+
+    ProcessSP process_sp(m_backend.GetProcessSP());
     if (!process_sp)
-        return false;
-    
-    lldb::addr_t ptr_value = LLDB_INVALID_ADDRESS;
-    
-    CompilerType valobj_type(valobj.GetCompilerType());
+      return false;
+
+    lldb::addr_t userinfo_location = LLDB_INVALID_ADDRESS;
+
+    CompilerType valobj_type(m_backend.GetCompilerType());
     Flags type_flags(valobj_type.GetTypeInfo());
-    if (type_flags.AllClear(eTypeHasValue))
-    {
-        if (valobj.IsBaseClass() && valobj.GetParent())
-            ptr_value = valobj.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-    }
-    else
-        ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-    
-    if (ptr_value == LLDB_INVALID_ADDRESS)
-        return false;
+    if (type_flags.AllClear(eTypeHasValue)) {
+      if (m_backend.IsBaseClass() && m_backend.GetParent())
+        userinfo_location =
+            m_backend.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+    } else
+      userinfo_location = m_backend.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+
+    if (userinfo_location == LLDB_INVALID_ADDRESS)
+      return false;
+
     size_t ptr_size = process_sp->GetAddressByteSize();
-    lldb::addr_t name_location = ptr_value + 1 * ptr_size;
-    lldb::addr_t reason_location = ptr_value + 2 * ptr_size;
-    
-    Error error;
-    lldb::addr_t name = process_sp->ReadPointerFromMemory(name_location, error);
-    if (error.Fail() || name == LLDB_INVALID_ADDRESS)
-        return false;
-    
-    lldb::addr_t reason = process_sp->ReadPointerFromMemory(reason_location, error);
-    if (error.Fail() || reason == LLDB_INVALID_ADDRESS)
-        return false;
-    
-    InferiorSizedWord name_isw(name, *process_sp);
-    InferiorSizedWord reason_isw(reason, *process_sp);
-    
-    CompilerType voidstar = process_sp->GetTarget().GetScratchClangASTContext()->GetBasicType(lldb::eBasicTypeVoid).GetPointerType();
-    
-    ValueObjectSP name_sp = ValueObject::CreateValueObjectFromData("name_str", name_isw.GetAsData(process_sp->GetByteOrder()), valobj.GetExecutionContextRef(), voidstar);
-    ValueObjectSP reason_sp = ValueObject::CreateValueObjectFromData("reason_str", reason_isw.GetAsData(process_sp->GetByteOrder()), valobj.GetExecutionContextRef(), voidstar);
-    
-    if (!name_sp || !reason_sp)
-        return false;
-    
-    StreamString name_str_summary;
-    StreamString reason_str_summary;
-    if (NSStringSummaryProvider(*name_sp, name_str_summary, options) &&
-        NSStringSummaryProvider(*reason_sp, reason_str_summary, options) &&
-        !name_str_summary.Empty() &&
-        !reason_str_summary.Empty())
-    {
-        stream.Printf("name: %s - reason: %s", name_str_summary.GetData(), reason_str_summary.GetData());
-        return true;
-    }
-    else
-        return false;
-}
 
-class NSExceptionSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-{
-public:
-    NSExceptionSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd(*valobj_sp)
-    {}
-
-    ~NSExceptionSyntheticFrontEnd() override = default;
-    // no need to delete m_child_ptr - it's kept alive by the cluster manager on our behalf
-
-    size_t
-    CalculateNumChildren() override
-    {
-        if (m_child_ptr)
-            return 1;
-        if (m_child_sp)
-            return 1;
-        return 0;
-    }
-    
-    lldb::ValueObjectSP
-    GetChildAtIndex(size_t idx) override
-    {
-        if (idx != 0)
-            return lldb::ValueObjectSP();
-        
-        if (m_child_ptr)
-            return m_child_ptr->GetSP();
-        return m_child_sp;
-    }
-    
-    bool
-    Update() override
-    {
-        m_child_ptr = nullptr;
-        m_child_sp.reset();
-        
-        ProcessSP process_sp(m_backend.GetProcessSP());
-        if (!process_sp)
-            return false;
-        
-        lldb::addr_t userinfo_location = LLDB_INVALID_ADDRESS;
-        
-        CompilerType valobj_type(m_backend.GetCompilerType());
-        Flags type_flags(valobj_type.GetTypeInfo());
-        if (type_flags.AllClear(eTypeHasValue))
-        {
-            if (m_backend.IsBaseClass() && m_backend.GetParent())
-                userinfo_location = m_backend.GetParent()->GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-        }
-        else
-            userinfo_location = m_backend.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-        
-        if (userinfo_location == LLDB_INVALID_ADDRESS)
-            return false;
-        
-        size_t ptr_size = process_sp->GetAddressByteSize();
-        
-        userinfo_location += 3 * ptr_size;
-        Error error;
-        lldb::addr_t userinfo = process_sp->ReadPointerFromMemory(userinfo_location, error);
-        if (userinfo == LLDB_INVALID_ADDRESS || error.Fail())
-            return false;
-        InferiorSizedWord isw(userinfo,*process_sp);
-        m_child_sp = CreateValueObjectFromData("userInfo",
-                                               isw.GetAsData(process_sp->GetByteOrder()),
-                                               m_backend.GetExecutionContextRef(),
-                                               process_sp->GetTarget().GetScratchClangASTContext()->GetBasicType(lldb::eBasicTypeObjCID));
-        return false;
-    }
-    
-    bool
-    MightHaveChildren() override
-    {
-        return true;
-    }
-    
-    size_t
-    GetIndexOfChildWithName(const ConstString &name) override
-    {
-        static ConstString g___userInfo("userInfo");
-        if (name == g___userInfo)
-            return 0;
-        return UINT32_MAX;
-    }
+    userinfo_location += 3 * ptr_size;
+    Error error;
+    lldb::addr_t userinfo =
+        process_sp->ReadPointerFromMemory(userinfo_location, error);
+    if (userinfo == LLDB_INVALID_ADDRESS || error.Fail())
+      return false;
+    InferiorSizedWord isw(userinfo, *process_sp);
+    m_child_sp = CreateValueObjectFromData(
+        "userInfo", isw.GetAsData(process_sp->GetByteOrder()),
+        m_backend.GetExecutionContextRef(),
+        process_sp->GetTarget().GetScratchClangASTContext()->GetBasicType(
+            lldb::eBasicTypeObjCID));
+    return false;
+  }
+
+  bool MightHaveChildren() override { return true; }
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override {
+    static ConstString g___userInfo("userInfo");
+    if (name == g___userInfo)
+      return 0;
+    return UINT32_MAX;
+  }
 
 private:
-    // the child here can be "real" (i.e. an actual child of the root) or synthetized from raw memory
-    // if the former, I need to store a plain pointer to it - or else a loop of references will cause this entire hierarchy of values to leak
-    // if the latter, then I need to store a SharedPointer to it - so that it only goes away when everyone else in the cluster goes away
-    // oh joy!
-    ValueObject* m_child_ptr;
-    ValueObjectSP m_child_sp;
+  // the child here can be "real" (i.e. an actual child of the root) or
+  // synthetized from raw memory
+  // if the former, I need to store a plain pointer to it - or else a loop of
+  // references will cause this entire hierarchy of values to leak
+  // if the latter, then I need to store a SharedPointer to it - so that it only
+  // goes away when everyone else in the cluster goes away
+  // oh joy!
+  ValueObject *m_child_ptr;
+  ValueObjectSP m_child_sp;
 };
 
-SyntheticChildrenFrontEnd*
-lldb_private::formatters::NSExceptionSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
-{
-    lldb::ProcessSP process_sp (valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return nullptr;
-    ObjCLanguageRuntime *runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    if (!runtime)
-        return nullptr;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(*valobj_sp.get()));
-    
-    if (!descriptor.get() || !descriptor->IsValid())
-        return nullptr;
-    
-    const char* class_name = descriptor->GetClassName().GetCString();
-    
-    if (!class_name || !*class_name)
-        return nullptr;
-    
-    if (!strcmp(class_name,"NSException"))
-        return (new NSExceptionSyntheticFrontEnd(valobj_sp));
-    else if (!strcmp(class_name,"NSCFException"))
-        return (new NSExceptionSyntheticFrontEnd(valobj_sp));
-    else if (!strcmp(class_name,"__NSCFException"))
-        return (new NSExceptionSyntheticFrontEnd(valobj_sp));
-    
+SyntheticChildrenFrontEnd *
+lldb_private::formatters::NSExceptionSyntheticFrontEndCreator(
+    CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
+    return nullptr;
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+  if (!runtime)
+    return nullptr;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(*valobj_sp.get()));
+
+  if (!descriptor.get() || !descriptor->IsValid())
     return nullptr;
+
+  const char *class_name = descriptor->GetClassName().GetCString();
+
+  if (!class_name || !*class_name)
+    return nullptr;
+
+  if (!strcmp(class_name, "NSException"))
+    return (new NSExceptionSyntheticFrontEnd(valobj_sp));
+  else if (!strcmp(class_name, "NSCFException"))
+    return (new NSExceptionSyntheticFrontEnd(valobj_sp));
+  else if (!strcmp(class_name, "__NSCFException"))
+    return (new NSExceptionSyntheticFrontEnd(valobj_sp));
+
+  return nullptr;
 }

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSIndexPath.cpp Tue Sep  6 15:57:50 2016
@@ -26,371 +26,299 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-static constexpr size_t
-PACKED_INDEX_SHIFT_64(size_t i)
-{
-    return (60 - (13 * (4-i)));
+static constexpr size_t PACKED_INDEX_SHIFT_64(size_t i) {
+  return (60 - (13 * (4 - i)));
 }
 
-static constexpr size_t
-PACKED_INDEX_SHIFT_32(size_t i)
-{
-    return (32 - (13 * (2-i)));
+static constexpr size_t PACKED_INDEX_SHIFT_32(size_t i) {
+  return (32 - (13 * (2 - i)));
 }
 
-class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-{
+class NSIndexPathSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
 public:
-    NSIndexPathSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd (*valobj_sp.get()),
-    m_descriptor_sp(nullptr),
-    m_impl(),
-    m_ptr_size(0),
-    m_uint_star_type()
-    {
-        m_ptr_size = m_backend.GetTargetSP()->GetArchitecture().GetAddressByteSize();
+  NSIndexPathSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+      : SyntheticChildrenFrontEnd(*valobj_sp.get()), m_descriptor_sp(nullptr),
+        m_impl(), m_ptr_size(0), m_uint_star_type() {
+    m_ptr_size =
+        m_backend.GetTargetSP()->GetArchitecture().GetAddressByteSize();
+  }
+
+  ~NSIndexPathSyntheticFrontEnd() override = default;
+
+  size_t CalculateNumChildren() override { return m_impl.GetNumIndexes(); }
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+    return m_impl.GetIndexAtIndex(idx, m_uint_star_type);
+  }
+
+  bool Update() override {
+    m_impl.Clear();
+
+    TypeSystem *type_system = m_backend.GetCompilerType().GetTypeSystem();
+    if (!type_system)
+      return false;
+
+    ClangASTContext *ast = m_backend.GetExecutionContextRef()
+                               .GetTargetSP()
+                               ->GetScratchClangASTContext();
+    if (!ast)
+      return false;
+
+    m_uint_star_type = ast->GetPointerSizedIntType(false);
+
+    static ConstString g__indexes("_indexes");
+    static ConstString g__length("_length");
+
+    ProcessSP process_sp = m_backend.GetProcessSP();
+    if (!process_sp)
+      return false;
+
+    ObjCLanguageRuntime *runtime =
+        (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+            lldb::eLanguageTypeObjC);
+
+    if (!runtime)
+      return false;
+
+    ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+        runtime->GetClassDescriptor(m_backend));
+
+    if (!descriptor.get() || !descriptor->IsValid())
+      return false;
+
+    uint64_t info_bits(0), value_bits(0), payload(0);
+
+    if (descriptor->GetTaggedPointerInfo(&info_bits, &value_bits, &payload)) {
+      m_impl.m_inlined.SetIndexes(payload, *process_sp);
+      m_impl.m_mode = Mode::Inlined;
+    } else {
+      ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor _indexes_id;
+      ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor _length_id;
+
+      bool has_indexes(false), has_length(false);
+
+      for (size_t x = 0; x < descriptor->GetNumIVars(); x++) {
+        const auto &ivar = descriptor->GetIVarAtIndex(x);
+        if (ivar.m_name == g__indexes) {
+          _indexes_id = ivar;
+          has_indexes = true;
+        } else if (ivar.m_name == g__length) {
+          _length_id = ivar;
+          has_length = true;
+        }
+
+        if (has_length && has_indexes)
+          break;
+      }
+
+      if (has_length && has_indexes) {
+        m_impl.m_outsourced.m_indexes =
+            m_backend
+                .GetSyntheticChildAtOffset(_indexes_id.m_offset,
+                                           m_uint_star_type.GetPointerType(),
+                                           true)
+                .get();
+        ValueObjectSP length_sp(m_backend.GetSyntheticChildAtOffset(
+            _length_id.m_offset, m_uint_star_type, true));
+        if (length_sp) {
+          m_impl.m_outsourced.m_count = length_sp->GetValueAsUnsigned(0);
+          if (m_impl.m_outsourced.m_indexes)
+            m_impl.m_mode = Mode::Outsourced;
+        }
+      }
     }
+    return false;
+  }
+
+  bool MightHaveChildren() override {
+    if (m_impl.m_mode == Mode::Invalid)
+      return false;
+    return true;
+  }
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override {
+    const char *item_name = name.GetCString();
+    uint32_t idx = ExtractIndexFromString(item_name);
+    if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+      return UINT32_MAX;
+    return idx;
+  }
+
+  lldb::ValueObjectSP GetSyntheticValue() override { return nullptr; }
 
-    ~NSIndexPathSyntheticFrontEnd() override = default;
+protected:
+  ObjCLanguageRuntime::ClassDescriptorSP m_descriptor_sp;
+
+  enum class Mode { Inlined, Outsourced, Invalid };
 
-    size_t
-    CalculateNumChildren() override
-    {
-        return m_impl.GetNumIndexes();
+  struct Impl {
+    size_t GetNumIndexes() {
+      switch (m_mode) {
+      case Mode::Inlined:
+        return m_inlined.GetNumIndexes();
+      case Mode::Outsourced:
+        return m_outsourced.m_count;
+      default:
+        return 0;
+      }
     }
-    
-    lldb::ValueObjectSP
-    GetChildAtIndex(size_t idx) override
-    {
-        return m_impl.GetIndexAtIndex(idx, m_uint_star_type);
+
+    lldb::ValueObjectSP GetIndexAtIndex(size_t idx,
+                                        const CompilerType &desired_type) {
+      if (idx >= GetNumIndexes())
+        return nullptr;
+      switch (m_mode) {
+      default:
+        return nullptr;
+      case Mode::Inlined:
+        return m_inlined.GetIndexAtIndex(idx, desired_type);
+      case Mode::Outsourced:
+        return m_outsourced.GetIndexAtIndex(idx);
+      }
     }
-    
-    bool
-    Update() override
-    {
-        m_impl.Clear();
-        
-        TypeSystem* type_system = m_backend.GetCompilerType().GetTypeSystem();
-        if (!type_system)
-            return false;
-
-        ClangASTContext *ast = m_backend.GetExecutionContextRef().GetTargetSP()->GetScratchClangASTContext();
-        if (!ast)
-            return false;
-
-        m_uint_star_type = ast->GetPointerSizedIntType(false);
-        
-        static ConstString g__indexes("_indexes");
-        static ConstString g__length("_length");
-
-        ProcessSP process_sp = m_backend.GetProcessSP();
-        if (!process_sp)
-            return false;
-        
-        ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-        
-        if (!runtime)
-            return false;
-        
-        ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(m_backend));
-        
-        if (!descriptor.get() || !descriptor->IsValid())
-            return false;
-        
-        uint64_t info_bits(0),value_bits(0),payload(0);
-        
-        if (descriptor->GetTaggedPointerInfo(&info_bits, &value_bits, &payload))
-        {
-            m_impl.m_inlined.SetIndexes(payload, *process_sp);
-            m_impl.m_mode = Mode::Inlined;
+
+    struct InlinedIndexes {
+    public:
+      void SetIndexes(uint64_t value, Process &p) {
+        m_indexes = value;
+        _lengthForInlinePayload(p.GetAddressByteSize());
+        m_process = &p;
+      }
+
+      size_t GetNumIndexes() { return m_count; }
+
+      lldb::ValueObjectSP GetIndexAtIndex(size_t idx,
+                                          const CompilerType &desired_type) {
+        if (!m_process)
+          return nullptr;
+
+        std::pair<uint64_t, bool> value(_indexAtPositionForInlinePayload(idx));
+        if (!value.second)
+          return nullptr;
+
+        Value v;
+        if (m_ptr_size == 8) {
+          Scalar scalar((unsigned long long)value.first);
+          v = Value(scalar);
+        } else {
+          Scalar scalar((unsigned int)value.first);
+          v = Value(scalar);
         }
+
+        v.SetCompilerType(desired_type);
+
+        StreamString idx_name;
+        idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+
+        return ValueObjectConstResult::Create(m_process, v,
+                                              ConstString(idx_name.GetData()));
+      }
+
+      void Clear() {
+        m_indexes = 0;
+        m_count = 0;
+        m_ptr_size = 0;
+        m_process = nullptr;
+      }
+
+      InlinedIndexes()
+          : m_indexes(0), m_count(0), m_ptr_size(0), m_process(nullptr) {}
+
+    private:
+      uint64_t m_indexes;
+      size_t m_count;
+      uint32_t m_ptr_size;
+      Process *m_process;
+
+      // cfr. Foundation for the details of this code
+      size_t _lengthForInlinePayload(uint32_t ptr_size) {
+        m_ptr_size = ptr_size;
+        if (m_ptr_size == 8)
+          m_count = ((m_indexes >> 3) & 0x7);
         else
-        {
-            ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor _indexes_id;
-            ObjCLanguageRuntime::ClassDescriptor::iVarDescriptor _length_id;
-            
-            bool has_indexes(false),has_length(false);
-            
-            for (size_t x = 0;
-                 x < descriptor->GetNumIVars();
-                 x++)
-            {
-                const auto& ivar = descriptor->GetIVarAtIndex(x);
-                if (ivar.m_name == g__indexes)
-                {
-                    _indexes_id = ivar;
-                    has_indexes = true;
-                }
-                else if (ivar.m_name == g__length)
-                {
-                    _length_id = ivar;
-                    has_length = true;
-                }
-                
-                if (has_length && has_indexes)
-                    break;
-            }
-            
-            if (has_length && has_indexes)
-            {
-                m_impl.m_outsourced.m_indexes = m_backend.GetSyntheticChildAtOffset(_indexes_id.m_offset,
-                                                                                    m_uint_star_type.GetPointerType(),
-                                                                                    true).get();
-                ValueObjectSP length_sp(m_backend.GetSyntheticChildAtOffset(_length_id.m_offset,
-                                                                            m_uint_star_type,
-                                                                            true));
-                if (length_sp)
-                {
-                    m_impl.m_outsourced.m_count = length_sp->GetValueAsUnsigned(0);
-                    if (m_impl.m_outsourced.m_indexes)
-                        m_impl.m_mode = Mode::Outsourced;
-                }
-            }
+          m_count = ((m_indexes >> 3) & 0x3);
+        return m_count;
+      }
+
+      std::pair<uint64_t, bool> _indexAtPositionForInlinePayload(size_t pos) {
+        static const uint64_t PACKED_INDEX_MASK = ((1 << 13) - 1);
+        if (m_ptr_size == 8) {
+          switch (pos) {
+          case 3:
+          case 2:
+          case 1:
+          case 0:
+            return {(m_indexes >> PACKED_INDEX_SHIFT_64(pos)) &
+                        PACKED_INDEX_MASK,
+                    true};
+          default:
+            return {0, false};
+          }
+        } else {
+          switch (pos) {
+          case 0:
+          case 1:
+            return {(m_indexes >> PACKED_INDEX_SHIFT_32(pos)) &
+                        PACKED_INDEX_MASK,
+                    true};
+          default:
+            return {0, false};
+          }
+        }
+        return {0, false};
+      }
+    };
+
+    struct OutsourcedIndexes {
+      lldb::ValueObjectSP GetIndexAtIndex(size_t idx) {
+        if (m_indexes) {
+          ValueObjectSP index_sp(m_indexes->GetSyntheticArrayMember(idx, true));
+          return index_sp;
         }
-        return false;
-    }
-    
-    bool
-    MightHaveChildren() override
-    {
-        if (m_impl.m_mode == Mode::Invalid)
-            return false;
-        return true;
-    }
-    
-    size_t
-    GetIndexOfChildWithName(const ConstString &name) override
-    {
-        const char* item_name = name.GetCString();
-        uint32_t idx = ExtractIndexFromString(item_name);
-        if (idx < UINT32_MAX && idx >= CalculateNumChildren())
-            return UINT32_MAX;
-        return idx;
-    }
-    
-    lldb::ValueObjectSP
-    GetSyntheticValue() override
-    {
         return nullptr;
-    }
+      }
 
-protected:
-    ObjCLanguageRuntime::ClassDescriptorSP m_descriptor_sp;
-    
-    enum class Mode {
-        Inlined,
-        Outsourced,
-        Invalid
+      void Clear() {
+        m_indexes = nullptr;
+        m_count = 0;
+      }
+
+      OutsourcedIndexes() : m_indexes(nullptr), m_count(0) {}
+
+      ValueObject *m_indexes;
+      size_t m_count;
     };
-    
-    struct Impl
-    {
-        size_t
-        GetNumIndexes ()
-        {
-            switch (m_mode)
-            {
-                case Mode::Inlined:
-                    return m_inlined.GetNumIndexes();
-                case Mode::Outsourced:
-                    return m_outsourced.m_count;
-                default:
-                    return 0;
-            }
-        }
-        
-        lldb::ValueObjectSP
-        GetIndexAtIndex (size_t idx, const CompilerType& desired_type)
-        {
-            if (idx >= GetNumIndexes())
-                return nullptr;
-            switch (m_mode)
-            {
-                default: return nullptr;
-                case Mode::Inlined:
-                    return m_inlined.GetIndexAtIndex (idx, desired_type);
-                case Mode::Outsourced:
-                    return m_outsourced.GetIndexAtIndex (idx);
-            }
-        }
-        
-        struct InlinedIndexes
-        {
-        public:
-            void SetIndexes(uint64_t value, Process& p)
-            {
-                m_indexes = value;
-                _lengthForInlinePayload(p.GetAddressByteSize());
-                m_process = &p;
-            }
-            
-            size_t
-            GetNumIndexes ()
-            {
-                return m_count;
-            }
-            
-            lldb::ValueObjectSP
-            GetIndexAtIndex (size_t idx, const CompilerType& desired_type)
-            {
-                if (!m_process)
-                    return nullptr;
-
-                std::pair<uint64_t, bool> value(_indexAtPositionForInlinePayload(idx));
-                if (!value.second)
-                    return nullptr;
-                
-                Value v;
-                if (m_ptr_size == 8)
-                {
-                    Scalar scalar( (unsigned long long)value.first );
-                    v = Value(scalar);
-                }
-                else
-                {
-                    Scalar scalar( (unsigned int)value.first );
-                    v = Value(scalar);
-                }
-                
-                v.SetCompilerType(desired_type);
-                
-                StreamString idx_name;
-                idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-                
-                return ValueObjectConstResult::Create(m_process, v, ConstString(idx_name.GetData()));
-            }
-            
-            void
-            Clear ()
-            {
-                m_indexes = 0;
-                m_count = 0;
-                m_ptr_size = 0;
-                m_process = nullptr;
-            }
-            
-            InlinedIndexes () :
-            m_indexes(0),
-            m_count(0),
-            m_ptr_size(0),
-            m_process(nullptr)
-            {
-            }
-            
-        private:
-            uint64_t m_indexes;
-            size_t m_count;
-            uint32_t m_ptr_size;
-            Process *m_process;
-            
-            // cfr. Foundation for the details of this code
-            size_t _lengthForInlinePayload(uint32_t ptr_size) {
-                m_ptr_size = ptr_size;
-                if (m_ptr_size == 8)
-                    m_count = ((m_indexes >> 3) & 0x7);
-                else
-                    m_count = ((m_indexes >> 3) & 0x3);
-                return m_count;
-            }
-            
-            std::pair<uint64_t, bool>
-            _indexAtPositionForInlinePayload(size_t pos)
-            {
-                static const uint64_t PACKED_INDEX_MASK = ((1 << 13) - 1);
-                if (m_ptr_size == 8)
-                {
-                    switch (pos)
-                    {
-                        case 3:
-                        case 2:
-                        case 1:
-                        case 0:
-                            return {(m_indexes >> PACKED_INDEX_SHIFT_64(pos)) & PACKED_INDEX_MASK,true};
-                        default:
-                            return {0,false};
-                    }
-                }
-                else
-                {
-                    switch (pos)
-                    {
-                        case 0:
-                        case 1:
-                            return {(m_indexes >> PACKED_INDEX_SHIFT_32(pos)) & PACKED_INDEX_MASK,true};
-                        default:
-                            return {0,false};
-                    }
-                }
-                return {0,false};
-            }
-            
-        };
-
-        struct OutsourcedIndexes
-        {
-            lldb::ValueObjectSP
-            GetIndexAtIndex (size_t idx)
-            {
-                if (m_indexes)
-                {
-                    ValueObjectSP index_sp(m_indexes->GetSyntheticArrayMember(idx, true));
-                    return index_sp;
-                }
-                return nullptr;
-            }
-            
-            void
-            Clear ()
-            {
-                m_indexes = nullptr;
-                m_count = 0;
-            }
-            
-            OutsourcedIndexes () :
-            m_indexes(nullptr),
-            m_count(0)
-            {
-            }
-            
-            ValueObject *m_indexes;
-            size_t m_count;
-        };
-        
-        union
-        {
-            struct InlinedIndexes m_inlined;
-            struct OutsourcedIndexes m_outsourced;
-        };
-        
-        void
-        Clear ()
-        {
-            m_mode = Mode::Invalid;
-            m_inlined.Clear();
-            m_outsourced.Clear();
-        }
-        
-        Impl() :
-        m_mode(Mode::Invalid)
-        {
-        }
-        
-        Mode m_mode;
-    } m_impl;
-    
-    uint32_t m_ptr_size;
-    CompilerType m_uint_star_type;
+
+    union {
+      struct InlinedIndexes m_inlined;
+      struct OutsourcedIndexes m_outsourced;
+    };
+
+    void Clear() {
+      m_mode = Mode::Invalid;
+      m_inlined.Clear();
+      m_outsourced.Clear();
+    }
+
+    Impl() : m_mode(Mode::Invalid) {}
+
+    Mode m_mode;
+  } m_impl;
+
+  uint32_t m_ptr_size;
+  CompilerType m_uint_star_type;
 };
 
 namespace lldb_private {
-    namespace formatters {
-        
-        SyntheticChildrenFrontEnd* NSIndexPathSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
-        {
-            if (valobj_sp)
-                return new NSIndexPathSyntheticFrontEnd(valobj_sp);
-            return nullptr;
-        }
+namespace formatters {
+
+SyntheticChildrenFrontEnd *
+NSIndexPathSyntheticFrontEndCreator(CXXSyntheticChildren *,
+                                    lldb::ValueObjectSP valobj_sp) {
+  if (valobj_sp)
+    return new NSIndexPathSyntheticFrontEnd(valobj_sp);
+  return nullptr;
+}
 
-    } // namespace formatters
+} // namespace formatters
 } // namespace lldb_private

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSSet.cpp Tue Sep  6 15:57:50 2016
@@ -29,636 +29,572 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-std::map<ConstString, CXXFunctionSummaryFormat::Callback>&
-NSSet_Additionals::GetAdditionalSummaries ()
-{
-    static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
-    return g_map;
+std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
+NSSet_Additionals::GetAdditionalSummaries() {
+  static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
+  return g_map;
 }
 
-std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>&
-NSSet_Additionals::GetAdditionalSynthetics ()
-{
-    static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> g_map;
-    return g_map;
+std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
+NSSet_Additionals::GetAdditionalSynthetics() {
+  static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>
+      g_map;
+  return g_map;
 }
 
 namespace lldb_private {
-    namespace formatters {
-        class NSSetISyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSSetISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-            ~NSSetISyntheticFrontEnd() override;
-
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-
-        private:
-            struct DataDescriptor_32
-            {
-                uint32_t _used : 26;
-                uint32_t _szidx : 6;
-            };
-
-            struct DataDescriptor_64
-            {
-                uint64_t _used : 58;
-                uint32_t _szidx : 6;
-            };
-
-            struct SetItemDescriptor
-            {
-                lldb::addr_t item_ptr;
-                lldb::ValueObjectSP valobj_sp;
-            };
-
-            ExecutionContextRef m_exe_ctx_ref;
-            uint8_t m_ptr_size;
-            DataDescriptor_32 *m_data_32;
-            DataDescriptor_64 *m_data_64;
-            lldb::addr_t m_data_ptr;
-            std::vector<SetItemDescriptor> m_children;
-        };
-        
-        class NSSetMSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSSetMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-            ~NSSetMSyntheticFrontEnd() override;
-
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-
-        private:
-            struct DataDescriptor_32
-            {
-                uint32_t _used : 26;
-                uint32_t _size;
-                uint32_t _mutations;
-                uint32_t _objs_addr;
-            };
-
-            struct DataDescriptor_64
-            {
-                uint64_t _used : 58;
-                uint64_t _size;
-                uint64_t _mutations;
-                uint64_t _objs_addr;
-            };
-
-            struct SetItemDescriptor
-            {
-                lldb::addr_t item_ptr;
-                lldb::ValueObjectSP valobj_sp;
-            };
-
-            ExecutionContextRef m_exe_ctx_ref;
-            uint8_t m_ptr_size;
-            DataDescriptor_32 *m_data_32;
-            DataDescriptor_64 *m_data_64;
-            std::vector<SetItemDescriptor> m_children;
-        };
-        
-        class NSSetCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            NSSetCodeRunningSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
-
-            ~NSSetCodeRunningSyntheticFrontEnd() override;
-
-            size_t
-            CalculateNumChildren() override;
-            
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override;
-            
-            bool
-            Update() override;
-            
-            bool
-            MightHaveChildren() override;
-            
-            size_t
-            GetIndexOfChildWithName(const ConstString &name) override;
-        };
-    } // namespace formatters
+namespace formatters {
+class NSSetISyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSSetISyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSSetISyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  struct DataDescriptor_32 {
+    uint32_t _used : 26;
+    uint32_t _szidx : 6;
+  };
+
+  struct DataDescriptor_64 {
+    uint64_t _used : 58;
+    uint32_t _szidx : 6;
+  };
+
+  struct SetItemDescriptor {
+    lldb::addr_t item_ptr;
+    lldb::ValueObjectSP valobj_sp;
+  };
+
+  ExecutionContextRef m_exe_ctx_ref;
+  uint8_t m_ptr_size;
+  DataDescriptor_32 *m_data_32;
+  DataDescriptor_64 *m_data_64;
+  lldb::addr_t m_data_ptr;
+  std::vector<SetItemDescriptor> m_children;
+};
+
+class NSSetMSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSSetMSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSSetMSyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+
+private:
+  struct DataDescriptor_32 {
+    uint32_t _used : 26;
+    uint32_t _size;
+    uint32_t _mutations;
+    uint32_t _objs_addr;
+  };
+
+  struct DataDescriptor_64 {
+    uint64_t _used : 58;
+    uint64_t _size;
+    uint64_t _mutations;
+    uint64_t _objs_addr;
+  };
+
+  struct SetItemDescriptor {
+    lldb::addr_t item_ptr;
+    lldb::ValueObjectSP valobj_sp;
+  };
+
+  ExecutionContextRef m_exe_ctx_ref;
+  uint8_t m_ptr_size;
+  DataDescriptor_32 *m_data_32;
+  DataDescriptor_64 *m_data_64;
+  std::vector<SetItemDescriptor> m_children;
+};
+
+class NSSetCodeRunningSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  NSSetCodeRunningSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp);
+
+  ~NSSetCodeRunningSyntheticFrontEnd() override;
+
+  size_t CalculateNumChildren() override;
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+  bool Update() override;
+
+  bool MightHaveChildren() override;
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override;
+};
+} // namespace formatters
 } // namespace lldb_private
 
-template<bool cf_style>
-bool
-lldb_private::formatters::NSSetSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    static ConstString g_TypeHint("NSSet");
-    
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    bool is_64bit = (ptr_size == 8);
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    uint64_t value = 0;
-    
-    ConstString class_name_cs = descriptor->GetClassName();
-    const char* class_name = class_name_cs.GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    if (!strcmp(class_name,"__NSSetI"))
-    {
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error);
-        if (error.Fail())
-            return false;
-        value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
-    }
-    else if (!strcmp(class_name,"__NSSetM"))
-    {
-        Error error;
-        value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error);
-        if (error.Fail())
-            return false;
-        value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
-    }
-    /*else if (!strcmp(class_name,"__NSCFSet"))
-     {
-     Error error;
-     value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ? 20 : 12), 4, 0, error);
-     if (error.Fail())
-     return false;
-     if (is_64bit)
-     value &= ~0x1fff000000000000UL;
-     }
-     else if (!strcmp(class_name,"NSCountedSet"))
-     {
-     Error error;
-     value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size, ptr_size, 0, error);
-     if (error.Fail())
-     return false;
-     value = process_sp->ReadUnsignedIntegerFromMemory(value + (is_64bit ? 20 : 12), 4, 0, error);
-     if (error.Fail())
-     return false;
-     if (is_64bit)
-     value &= ~0x1fff000000000000UL;
-     }*/
-    else
-    {
-        auto& map(NSSet_Additionals::GetAdditionalSummaries());
-        auto iter = map.find(class_name_cs), end = map.end();
-        if (iter != end)
-            return iter->second(valobj, stream, options);
-        else
-            return false;
-    }
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(options.GetLanguage()))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    stream.Printf("%s%" PRIu64 " %s%s%s",
-                  prefix.c_str(),
-                  value,
-                  "element",
-                  value == 1 ? "" : "s",
-                  suffix.c_str());
-    return true;
-}
-
-SyntheticChildrenFrontEnd* lldb_private::formatters::NSSetSyntheticFrontEndCreator (CXXSyntheticChildren* synth, lldb::ValueObjectSP valobj_sp)
-{
-    lldb::ProcessSP process_sp (valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return nullptr;
-    ObjCLanguageRuntime *runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    if (!runtime)
-        return nullptr;
-    
-    CompilerType valobj_type(valobj_sp->GetCompilerType());
-    Flags flags(valobj_type.GetTypeInfo());
-    
-    if (flags.IsClear(eTypeIsPointer))
-    {
-        Error error;
-        valobj_sp = valobj_sp->AddressOf(error);
-        if (error.Fail() || !valobj_sp)
-            return nullptr;
-    }
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(*valobj_sp));
-    
-    if (!descriptor || !descriptor->IsValid())
-        return nullptr;
-    
-    ConstString class_name_cs = descriptor->GetClassName();
-    const char* class_name = class_name_cs.GetCString();
-    
-    if (!class_name || !*class_name)
-        return nullptr;
-    
-    if (!strcmp(class_name,"__NSSetI"))
-    {
-        return (new NSSetISyntheticFrontEnd(valobj_sp));
-    }
-    else if (!strcmp(class_name,"__NSSetM"))
-    {
-        return (new NSSetMSyntheticFrontEnd(valobj_sp));
-    }
+template <bool cf_style>
+bool lldb_private::formatters::NSSetSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  static ConstString g_TypeHint("NSSet");
+
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+  bool is_64bit = (ptr_size == 8);
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  uint64_t value = 0;
+
+  ConstString class_name_cs = descriptor->GetClassName();
+  const char *class_name = class_name_cs.GetCString();
+
+  if (!class_name || !*class_name)
+    return false;
+
+  if (!strcmp(class_name, "__NSSetI")) {
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+                                                      ptr_size, 0, error);
+    if (error.Fail())
+      return false;
+    value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
+  } else if (!strcmp(class_name, "__NSSetM")) {
+    Error error;
+    value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+                                                      ptr_size, 0, error);
+    if (error.Fail())
+      return false;
+    value &= (is_64bit ? ~0xFC00000000000000UL : ~0xFC000000U);
+  }
+  /*else if (!strcmp(class_name,"__NSCFSet"))
+   {
+   Error error;
+   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + (is_64bit ?
+   20 : 12), 4, 0, error);
+   if (error.Fail())
+   return false;
+   if (is_64bit)
+   value &= ~0x1fff000000000000UL;
+   }
+   else if (!strcmp(class_name,"NSCountedSet"))
+   {
+   Error error;
+   value = process_sp->ReadUnsignedIntegerFromMemory(valobj_addr + ptr_size,
+   ptr_size, 0, error);
+   if (error.Fail())
+   return false;
+   value = process_sp->ReadUnsignedIntegerFromMemory(value + (is_64bit ? 20 :
+   12), 4, 0, error);
+   if (error.Fail())
+   return false;
+   if (is_64bit)
+   value &= ~0x1fff000000000000UL;
+   }*/
+  else {
+    auto &map(NSSet_Additionals::GetAdditionalSummaries());
+    auto iter = map.find(class_name_cs), end = map.end();
+    if (iter != end)
+      return iter->second(valobj, stream, options);
     else
-    {
-        auto& map(NSSet_Additionals::GetAdditionalSynthetics());
-        auto iter = map.find(class_name_cs), end = map.end();
-        if (iter != end)
-            return iter->second(synth, valobj_sp);
-        return nullptr;
-    }
-}
+      return false;
+  }
+
+  std::string prefix, suffix;
+  if (Language *language = Language::FindPlugin(options.GetLanguage())) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
+    }
+  }
+
+  stream.Printf("%s%" PRIu64 " %s%s%s", prefix.c_str(), value, "element",
+                value == 1 ? "" : "s", suffix.c_str());
+  return true;
+}
+
+SyntheticChildrenFrontEnd *
+lldb_private::formatters::NSSetSyntheticFrontEndCreator(
+    CXXSyntheticChildren *synth, lldb::ValueObjectSP valobj_sp) {
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
+    return nullptr;
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+  if (!runtime)
+    return nullptr;
+
+  CompilerType valobj_type(valobj_sp->GetCompilerType());
+  Flags flags(valobj_type.GetTypeInfo());
 
-lldb_private::formatters::NSSetISyntheticFrontEnd::NSSetISyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd(*valobj_sp),
-    m_exe_ctx_ref(),
-    m_ptr_size(8),
-    m_data_32(nullptr),
-    m_data_64(nullptr)
-{
-    if (valobj_sp)
-        Update();
-}
-
-lldb_private::formatters::NSSetISyntheticFrontEnd::~NSSetISyntheticFrontEnd ()
-{
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
+  if (flags.IsClear(eTypeIsPointer)) {
+    Error error;
+    valobj_sp = valobj_sp->AddressOf(error);
+    if (error.Fail() || !valobj_sp)
+      return nullptr;
+  }
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(*valobj_sp));
+
+  if (!descriptor || !descriptor->IsValid())
+    return nullptr;
+
+  ConstString class_name_cs = descriptor->GetClassName();
+  const char *class_name = class_name_cs.GetCString();
+
+  if (!class_name || !*class_name)
+    return nullptr;
+
+  if (!strcmp(class_name, "__NSSetI")) {
+    return (new NSSetISyntheticFrontEnd(valobj_sp));
+  } else if (!strcmp(class_name, "__NSSetM")) {
+    return (new NSSetMSyntheticFrontEnd(valobj_sp));
+  } else {
+    auto &map(NSSet_Additionals::GetAdditionalSynthetics());
+    auto iter = map.find(class_name_cs), end = map.end();
+    if (iter != end)
+      return iter->second(synth, valobj_sp);
+    return nullptr;
+  }
+}
+
+lldb_private::formatters::NSSetISyntheticFrontEnd::NSSetISyntheticFrontEnd(
+    lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
+      m_data_32(nullptr), m_data_64(nullptr) {
+  if (valobj_sp)
+    Update();
+}
+
+lldb_private::formatters::NSSetISyntheticFrontEnd::~NSSetISyntheticFrontEnd() {
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
 }
 
 size_t
-lldb_private::formatters::NSSetISyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    const char* item_name = name.GetCString();
-    uint32_t idx = ExtractIndexFromString(item_name);
-    if (idx < UINT32_MAX && idx >= CalculateNumChildren())
-        return UINT32_MAX;
-    return idx;
+lldb_private::formatters::NSSetISyntheticFrontEnd::GetIndexOfChildWithName(
+    const ConstString &name) {
+  const char *item_name = name.GetCString();
+  uint32_t idx = ExtractIndexFromString(item_name);
+  if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+    return UINT32_MAX;
+  return idx;
 }
 
 size_t
-lldb_private::formatters::NSSetISyntheticFrontEnd::CalculateNumChildren ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return (m_data_32 ? m_data_32->_used : m_data_64->_used);
-}
-
-bool
-lldb_private::formatters::NSSetISyntheticFrontEnd::Update()
-{
-    m_children.clear();
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
-    m_ptr_size = 0;
-    ValueObjectSP valobj_sp = m_backend.GetSP();
-    if (!valobj_sp)
-        return false;
-    if (!valobj_sp)
-        return false;
-    m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
-    Error error;
-    if (valobj_sp->IsPointerType())
-    {
-        valobj_sp = valobj_sp->Dereference(error);
-        if (error.Fail() || !valobj_sp)
-            return false;
-    }
-    error.Clear();
-    lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return false;
-    m_ptr_size = process_sp->GetAddressByteSize();
-    uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
-    if (m_ptr_size == 4)
-    {
-        m_data_32 = new DataDescriptor_32();
-        process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
-    }
-    else
-    {
-        m_data_64 = new DataDescriptor_64();
-        process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
-    }
-    if (error.Fail())
-        return false;
-    m_data_ptr = data_location + m_ptr_size;
+lldb_private::formatters::NSSetISyntheticFrontEnd::CalculateNumChildren() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return (m_data_32 ? m_data_32->_used : m_data_64->_used);
+}
+
+bool lldb_private::formatters::NSSetISyntheticFrontEnd::Update() {
+  m_children.clear();
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
+  m_ptr_size = 0;
+  ValueObjectSP valobj_sp = m_backend.GetSP();
+  if (!valobj_sp)
+    return false;
+  if (!valobj_sp)
     return false;
+  m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+  Error error;
+  if (valobj_sp->IsPointerType()) {
+    valobj_sp = valobj_sp->Dereference(error);
+    if (error.Fail() || !valobj_sp)
+      return false;
+  }
+  error.Clear();
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
+    return false;
+  m_ptr_size = process_sp->GetAddressByteSize();
+  uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+  if (m_ptr_size == 4) {
+    m_data_32 = new DataDescriptor_32();
+    process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+                           error);
+  } else {
+    m_data_64 = new DataDescriptor_64();
+    process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+                           error);
+  }
+  if (error.Fail())
+    return false;
+  m_data_ptr = data_location + m_ptr_size;
+  return false;
 }
 
-bool
-lldb_private::formatters::NSSetISyntheticFrontEnd::MightHaveChildren ()
-{
-    return true;
+bool lldb_private::formatters::NSSetISyntheticFrontEnd::MightHaveChildren() {
+  return true;
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSSetISyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    uint32_t num_children = CalculateNumChildren();
-    
-    if (idx >= num_children)
-        return lldb::ValueObjectSP();
-    
-    ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
-    if (!process_sp)
+lldb_private::formatters::NSSetISyntheticFrontEnd::GetChildAtIndex(size_t idx) {
+  uint32_t num_children = CalculateNumChildren();
+
+  if (idx >= num_children)
+    return lldb::ValueObjectSP();
+
+  ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
+  if (!process_sp)
+    return lldb::ValueObjectSP();
+
+  if (m_children.empty()) {
+    // do the scan phase
+    lldb::addr_t obj_at_idx = 0;
+
+    uint32_t tries = 0;
+    uint32_t test_idx = 0;
+
+    while (tries < num_children) {
+      obj_at_idx = m_data_ptr + (test_idx * m_ptr_size);
+      if (!process_sp)
         return lldb::ValueObjectSP();
-    
-    if (m_children.empty())
-    {
-        // do the scan phase
-        lldb::addr_t obj_at_idx = 0;
-        
-        uint32_t tries = 0;
-        uint32_t test_idx = 0;
-        
-        while(tries < num_children)
-        {
-            obj_at_idx = m_data_ptr + (test_idx * m_ptr_size);
-            if (!process_sp)
-                return lldb::ValueObjectSP();
-            Error error;
-            obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx, error);
-            if (error.Fail())
-                return lldb::ValueObjectSP();
-            
-            test_idx++;
-            
-            if (!obj_at_idx)
-                continue;
-            tries++;
-            
-            SetItemDescriptor descriptor = {obj_at_idx,lldb::ValueObjectSP()};
-            
-            m_children.push_back(descriptor);
-        }
-    }
-    
-    if (idx >= m_children.size()) // should never happen
+      Error error;
+      obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx, error);
+      if (error.Fail())
         return lldb::ValueObjectSP();
-    
-    SetItemDescriptor &set_item = m_children[idx];
-    if (!set_item.valobj_sp)
-    {
-        auto ptr_size = process_sp->GetAddressByteSize();
-        DataBufferHeap buffer(ptr_size,0);
-        switch (ptr_size)
-        {
-            case 0: // architecture has no clue?? - fail
-                return lldb::ValueObjectSP();
-            case 4:
-                *((uint32_t*)buffer.GetBytes()) = (uint32_t)set_item.item_ptr;
-                break;
-            case 8:
-                *((uint64_t*)buffer.GetBytes()) = (uint64_t)set_item.item_ptr;
-                break;
-            default:
-                assert(false && "pointer size is not 4 nor 8 - get out of here ASAP");
-        }
-        StreamString idx_name;
-        idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-        
-        DataExtractor data(buffer.GetBytes(),
-                           buffer.GetByteSize(),
-                           process_sp->GetByteOrder(),
-                           process_sp->GetAddressByteSize());
-        
-        set_item.valobj_sp =
-        CreateValueObjectFromData(idx_name.GetData(),
-                                  data,
-                                  m_exe_ctx_ref,
-                                  m_backend.GetCompilerType().GetBasicTypeFromAST(lldb::eBasicTypeObjCID));
-    }
-    return set_item.valobj_sp;
-}
 
-lldb_private::formatters::NSSetMSyntheticFrontEnd::NSSetMSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-    SyntheticChildrenFrontEnd(*valobj_sp),
-    m_exe_ctx_ref(),
-    m_ptr_size(8),
-    m_data_32(nullptr),
-    m_data_64(nullptr)
-{
-    if (valobj_sp)
-        Update ();
-}
-
-lldb_private::formatters::NSSetMSyntheticFrontEnd::~NSSetMSyntheticFrontEnd ()
-{
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
+      test_idx++;
+
+      if (!obj_at_idx)
+        continue;
+      tries++;
+
+      SetItemDescriptor descriptor = {obj_at_idx, lldb::ValueObjectSP()};
+
+      m_children.push_back(descriptor);
+    }
+  }
+
+  if (idx >= m_children.size()) // should never happen
+    return lldb::ValueObjectSP();
+
+  SetItemDescriptor &set_item = m_children[idx];
+  if (!set_item.valobj_sp) {
+    auto ptr_size = process_sp->GetAddressByteSize();
+    DataBufferHeap buffer(ptr_size, 0);
+    switch (ptr_size) {
+    case 0: // architecture has no clue?? - fail
+      return lldb::ValueObjectSP();
+    case 4:
+      *((uint32_t *)buffer.GetBytes()) = (uint32_t)set_item.item_ptr;
+      break;
+    case 8:
+      *((uint64_t *)buffer.GetBytes()) = (uint64_t)set_item.item_ptr;
+      break;
+    default:
+      assert(false && "pointer size is not 4 nor 8 - get out of here ASAP");
+    }
+    StreamString idx_name;
+    idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+
+    DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(),
+                       process_sp->GetByteOrder(),
+                       process_sp->GetAddressByteSize());
+
+    set_item.valobj_sp = CreateValueObjectFromData(
+        idx_name.GetData(), data, m_exe_ctx_ref,
+        m_backend.GetCompilerType().GetBasicTypeFromAST(
+            lldb::eBasicTypeObjCID));
+  }
+  return set_item.valobj_sp;
+}
+
+lldb_private::formatters::NSSetMSyntheticFrontEnd::NSSetMSyntheticFrontEnd(
+    lldb::ValueObjectSP valobj_sp)
+    : SyntheticChildrenFrontEnd(*valobj_sp), m_exe_ctx_ref(), m_ptr_size(8),
+      m_data_32(nullptr), m_data_64(nullptr) {
+  if (valobj_sp)
+    Update();
+}
+
+lldb_private::formatters::NSSetMSyntheticFrontEnd::~NSSetMSyntheticFrontEnd() {
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
 }
 
 size_t
-lldb_private::formatters::NSSetMSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    const char* item_name = name.GetCString();
-    uint32_t idx = ExtractIndexFromString(item_name);
-    if (idx < UINT32_MAX && idx >= CalculateNumChildren())
-        return UINT32_MAX;
-    return idx;
+lldb_private::formatters::NSSetMSyntheticFrontEnd::GetIndexOfChildWithName(
+    const ConstString &name) {
+  const char *item_name = name.GetCString();
+  uint32_t idx = ExtractIndexFromString(item_name);
+  if (idx < UINT32_MAX && idx >= CalculateNumChildren())
+    return UINT32_MAX;
+  return idx;
 }
 
 size_t
-lldb_private::formatters::NSSetMSyntheticFrontEnd::CalculateNumChildren ()
-{
-    if (!m_data_32 && !m_data_64)
-        return 0;
-    return (m_data_32 ? m_data_32->_used : m_data_64->_used);
-}
-
-bool
-lldb_private::formatters::NSSetMSyntheticFrontEnd::Update()
-{
-    m_children.clear();
-    ValueObjectSP valobj_sp = m_backend.GetSP();
-    m_ptr_size = 0;
-    delete m_data_32;
-    m_data_32 = nullptr;
-    delete m_data_64;
-    m_data_64 = nullptr;
-    if (!valobj_sp)
-        return false;
-    if (!valobj_sp)
-        return false;
-    m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
-    Error error;
-    if (valobj_sp->IsPointerType())
-    {
-        valobj_sp = valobj_sp->Dereference(error);
-        if (error.Fail() || !valobj_sp)
-            return false;
-    }
-    error.Clear();
-    lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
-    if (!process_sp)
-        return false;
-    m_ptr_size = process_sp->GetAddressByteSize();
-    uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
-    if (m_ptr_size == 4)
-    {
-        m_data_32 = new DataDescriptor_32();
-        process_sp->ReadMemory (data_location, m_data_32, sizeof(DataDescriptor_32), error);
-    }
-    else
-    {
-        m_data_64 = new DataDescriptor_64();
-        process_sp->ReadMemory (data_location, m_data_64, sizeof(DataDescriptor_64), error);
-    }
-    if (error.Fail())
-        return false;
+lldb_private::formatters::NSSetMSyntheticFrontEnd::CalculateNumChildren() {
+  if (!m_data_32 && !m_data_64)
+    return 0;
+  return (m_data_32 ? m_data_32->_used : m_data_64->_used);
+}
+
+bool lldb_private::formatters::NSSetMSyntheticFrontEnd::Update() {
+  m_children.clear();
+  ValueObjectSP valobj_sp = m_backend.GetSP();
+  m_ptr_size = 0;
+  delete m_data_32;
+  m_data_32 = nullptr;
+  delete m_data_64;
+  m_data_64 = nullptr;
+  if (!valobj_sp)
+    return false;
+  if (!valobj_sp)
+    return false;
+  m_exe_ctx_ref = valobj_sp->GetExecutionContextRef();
+  Error error;
+  if (valobj_sp->IsPointerType()) {
+    valobj_sp = valobj_sp->Dereference(error);
+    if (error.Fail() || !valobj_sp)
+      return false;
+  }
+  error.Clear();
+  lldb::ProcessSP process_sp(valobj_sp->GetProcessSP());
+  if (!process_sp)
     return false;
+  m_ptr_size = process_sp->GetAddressByteSize();
+  uint64_t data_location = valobj_sp->GetAddressOf() + m_ptr_size;
+  if (m_ptr_size == 4) {
+    m_data_32 = new DataDescriptor_32();
+    process_sp->ReadMemory(data_location, m_data_32, sizeof(DataDescriptor_32),
+                           error);
+  } else {
+    m_data_64 = new DataDescriptor_64();
+    process_sp->ReadMemory(data_location, m_data_64, sizeof(DataDescriptor_64),
+                           error);
+  }
+  if (error.Fail())
+    return false;
+  return false;
 }
 
-bool
-lldb_private::formatters::NSSetMSyntheticFrontEnd::MightHaveChildren ()
-{
-    return true;
+bool lldb_private::formatters::NSSetMSyntheticFrontEnd::MightHaveChildren() {
+  return true;
 }
 
 lldb::ValueObjectSP
-lldb_private::formatters::NSSetMSyntheticFrontEnd::GetChildAtIndex (size_t idx)
-{
-    lldb::addr_t m_objs_addr = (m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
-    
-    uint32_t num_children = CalculateNumChildren();
-    
-    if (idx >= num_children)
-        return lldb::ValueObjectSP();
-    
-    ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
-    if (!process_sp)
+lldb_private::formatters::NSSetMSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
+  lldb::addr_t m_objs_addr =
+      (m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr);
+
+  uint32_t num_children = CalculateNumChildren();
+
+  if (idx >= num_children)
+    return lldb::ValueObjectSP();
+
+  ProcessSP process_sp = m_exe_ctx_ref.GetProcessSP();
+  if (!process_sp)
+    return lldb::ValueObjectSP();
+
+  if (m_children.empty()) {
+    // do the scan phase
+    lldb::addr_t obj_at_idx = 0;
+
+    uint32_t tries = 0;
+    uint32_t test_idx = 0;
+
+    while (tries < num_children) {
+      obj_at_idx = m_objs_addr + (test_idx * m_ptr_size);
+      if (!process_sp)
         return lldb::ValueObjectSP();
-    
-    if (m_children.empty())
-    {
-        // do the scan phase
-        lldb::addr_t obj_at_idx = 0;
-        
-        uint32_t tries = 0;
-        uint32_t test_idx = 0;
-        
-        while(tries < num_children)
-        {
-            obj_at_idx = m_objs_addr + (test_idx * m_ptr_size);
-            if (!process_sp)
-                return lldb::ValueObjectSP();
-            Error error;
-            obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx, error);
-            if (error.Fail())
-                return lldb::ValueObjectSP();
-            
-            test_idx++;
-            
-            if (!obj_at_idx)
-                continue;
-            tries++;
-            
-            SetItemDescriptor descriptor = {obj_at_idx,lldb::ValueObjectSP()};
-            
-            m_children.push_back(descriptor);
-        }
-    }
-    
-    if (idx >= m_children.size()) // should never happen
+      Error error;
+      obj_at_idx = process_sp->ReadPointerFromMemory(obj_at_idx, error);
+      if (error.Fail())
         return lldb::ValueObjectSP();
-    
-    SetItemDescriptor &set_item = m_children[idx];
-    if (!set_item.valobj_sp)
-    {
-        auto ptr_size = process_sp->GetAddressByteSize();
-        DataBufferHeap buffer(ptr_size,0);
-        switch (ptr_size)
-        {
-            case 0: // architecture has no clue?? - fail
-                return lldb::ValueObjectSP();
-            case 4:
-                *((uint32_t*)buffer.GetBytes()) = (uint32_t)set_item.item_ptr;
-                break;
-            case 8:
-                *((uint64_t*)buffer.GetBytes()) = (uint64_t)set_item.item_ptr;
-                break;
-            default:
-                assert(false && "pointer size is not 4 nor 8 - get out of here ASAP");
-        }
-        StreamString idx_name;
-        idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-        
-        DataExtractor data(buffer.GetBytes(),
-                           buffer.GetByteSize(),
-                           process_sp->GetByteOrder(),
-                           process_sp->GetAddressByteSize());
-        
-        set_item.valobj_sp =
-        CreateValueObjectFromData(idx_name.GetData(),
-                                  data,
-                                  m_exe_ctx_ref,
-                                  m_backend.GetCompilerType().GetBasicTypeFromAST(lldb::eBasicTypeObjCID));
-    }
-    return set_item.valobj_sp;
+
+      test_idx++;
+
+      if (!obj_at_idx)
+        continue;
+      tries++;
+
+      SetItemDescriptor descriptor = {obj_at_idx, lldb::ValueObjectSP()};
+
+      m_children.push_back(descriptor);
+    }
+  }
+
+  if (idx >= m_children.size()) // should never happen
+    return lldb::ValueObjectSP();
+
+  SetItemDescriptor &set_item = m_children[idx];
+  if (!set_item.valobj_sp) {
+    auto ptr_size = process_sp->GetAddressByteSize();
+    DataBufferHeap buffer(ptr_size, 0);
+    switch (ptr_size) {
+    case 0: // architecture has no clue?? - fail
+      return lldb::ValueObjectSP();
+    case 4:
+      *((uint32_t *)buffer.GetBytes()) = (uint32_t)set_item.item_ptr;
+      break;
+    case 8:
+      *((uint64_t *)buffer.GetBytes()) = (uint64_t)set_item.item_ptr;
+      break;
+    default:
+      assert(false && "pointer size is not 4 nor 8 - get out of here ASAP");
+    }
+    StreamString idx_name;
+    idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+
+    DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(),
+                       process_sp->GetByteOrder(),
+                       process_sp->GetAddressByteSize());
+
+    set_item.valobj_sp = CreateValueObjectFromData(
+        idx_name.GetData(), data, m_exe_ctx_ref,
+        m_backend.GetCompilerType().GetBasicTypeFromAST(
+            lldb::eBasicTypeObjCID));
+  }
+  return set_item.valobj_sp;
 }
 
-template bool
-lldb_private::formatters::NSSetSummaryProvider<true> (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
+template bool lldb_private::formatters::NSSetSummaryProvider<true>(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options);
 
-template bool
-lldb_private::formatters::NSSetSummaryProvider<false> (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
+template bool lldb_private::formatters::NSSetSummaryProvider<false>(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options);

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSSet.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSSet.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSSet.h (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSSet.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- NSSet.h ---------------------------------------------------*- C++ -*-===//
+//===-- NSSet.h ---------------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,24 +18,23 @@
 #include "lldb/DataFormatters/TypeSynthetic.h"
 
 namespace lldb_private {
-    namespace formatters
-    {
-        template<bool cf_style>
-        bool
-        NSSetSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        SyntheticChildrenFrontEnd* NSSetSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP);
-        
-        class NSSet_Additionals
-        {
-        public:
-            static std::map<ConstString, CXXFunctionSummaryFormat::Callback>&
-            GetAdditionalSummaries ();
-            
-            static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback>&
-            GetAdditionalSynthetics ();
-        };
-    } // namespace formatters
+namespace formatters {
+template <bool cf_style>
+bool NSSetSummaryProvider(ValueObject &valobj, Stream &stream,
+                          const TypeSummaryOptions &options);
+
+SyntheticChildrenFrontEnd *NSSetSyntheticFrontEndCreator(CXXSyntheticChildren *,
+                                                         lldb::ValueObjectSP);
+
+class NSSet_Additionals {
+public:
+  static std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
+  GetAdditionalSummaries();
+
+  static std::map<ConstString, CXXSyntheticChildren::CreateFrontEndCallback> &
+  GetAdditionalSynthetics();
+};
+} // namespace formatters
 } // namespace lldb_private
 
 #endif // liblldb_NSSet_h_

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSString.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- NSString.cpp ----------------------------------------------*- C++ -*-===//
+//===-- NSString.cpp ----------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -26,380 +27,380 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-std::map<ConstString, CXXFunctionSummaryFormat::Callback>&
-NSString_Additionals::GetAdditionalSummaries ()
-{
-    static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
-    return g_map;
+std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
+NSString_Additionals::GetAdditionalSummaries() {
+  static std::map<ConstString, CXXFunctionSummaryFormat::Callback> g_map;
+  return g_map;
 }
 
-static CompilerType
-GetNSPathStore2Type (Target &target)
-{
-    static ConstString g_type_name("__lldb_autogen_nspathstore2");
-    
-    ClangASTContext *ast_ctx = target.GetScratchClangASTContext();
-    
-    if (!ast_ctx)
-        return CompilerType();
-    
-    CompilerType voidstar = ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType();
-    CompilerType uint32 = ast_ctx->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32);
-    
-    return ast_ctx->GetOrCreateStructForIdentifier(g_type_name, {
-        {"isa",voidstar},
-        {"lengthAndRef",uint32},
-        {"buffer",voidstar}
-    });
+static CompilerType GetNSPathStore2Type(Target &target) {
+  static ConstString g_type_name("__lldb_autogen_nspathstore2");
+
+  ClangASTContext *ast_ctx = target.GetScratchClangASTContext();
+
+  if (!ast_ctx)
+    return CompilerType();
+
+  CompilerType voidstar =
+      ast_ctx->GetBasicType(lldb::eBasicTypeVoid).GetPointerType();
+  CompilerType uint32 =
+      ast_ctx->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32);
+
+  return ast_ctx->GetOrCreateStructForIdentifier(
+      g_type_name,
+      {{"isa", voidstar}, {"lengthAndRef", uint32}, {"buffer", voidstar}});
 }
 
-bool
-lldb_private::formatters::NSStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& summary_options)
-{
-    static ConstString g_TypeHint("NSString");
-    
-    ProcessSP process_sp = valobj.GetProcessSP();
-    if (!process_sp)
-        return false;
-    
-    ObjCLanguageRuntime* runtime = (ObjCLanguageRuntime*)process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC);
-    
-    if (!runtime)
-        return false;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor(runtime->GetClassDescriptor(valobj));
-    
-    if (!descriptor.get() || !descriptor->IsValid())
-        return false;
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
-    
-    if (!valobj_addr)
-        return false;
-    
-    ConstString class_name_cs = descriptor->GetClassName();
-    const char* class_name = class_name_cs.GetCString();
-    
-    if (!class_name || !*class_name)
-        return false;
-    
-    bool is_tagged_ptr = (0 == strcmp(class_name,"NSTaggedPointerString")) && descriptor->GetTaggedPointerInfo();
-    // for a tagged pointer, the descriptor has everything we need
-    if (is_tagged_ptr)
-        return NSTaggedString_SummaryProvider(valobj, descriptor, stream, summary_options);
-    
-    auto& additionals_map(NSString_Additionals::GetAdditionalSummaries());
-    auto iter = additionals_map.find(class_name_cs), end = additionals_map.end();
-    if (iter != end)
-        return iter->second(valobj, stream, summary_options);
-    
-    // if not a tagged pointer that we know about, try the normal route
-    uint64_t info_bits_location = valobj_addr + ptr_size;
-    if (process_sp->GetByteOrder() != lldb::eByteOrderLittle)
-        info_bits_location += 3;
-    
-    Error error;
-    
-    uint8_t info_bits = process_sp->ReadUnsignedIntegerFromMemory(info_bits_location, 1, 0, error);
-    if (error.Fail())
-        return false;
-    
-    bool is_mutable = (info_bits & 1) == 1;
-    bool is_inline = (info_bits & 0x60) == 0;
-    bool has_explicit_length = (info_bits & (1 | 4)) != 4;
-    bool is_unicode = (info_bits & 0x10) == 0x10;
-    bool is_path_store = strcmp(class_name,"NSPathStore2") == 0;
-    bool has_null = (info_bits & 8) == 8;
-    
-    size_t explicit_length = 0;
-    if (!has_null && has_explicit_length && !is_path_store)
-    {
-        lldb::addr_t explicit_length_offset = 2*ptr_size;
-        if (is_mutable && !is_inline)
-            explicit_length_offset = explicit_length_offset + ptr_size; //  notInlineMutable.length;
-        else if (is_inline)
-            explicit_length = explicit_length + 0; // inline1.length;
-        else if (!is_inline && !is_mutable)
-            explicit_length_offset = explicit_length_offset + ptr_size; // notInlineImmutable1.length;
-        else
-            explicit_length_offset = 0;
-        
-        if (explicit_length_offset)
-        {
-            explicit_length_offset = valobj_addr + explicit_length_offset;
-            explicit_length = process_sp->ReadUnsignedIntegerFromMemory(explicit_length_offset, 4, 0, error);
-        }
-    }
-    
-    if (strcmp(class_name,"NSString") &&
-        strcmp(class_name,"CFStringRef") &&
-        strcmp(class_name,"CFMutableStringRef") &&
-        strcmp(class_name,"__NSCFConstantString") &&
-        strcmp(class_name,"__NSCFString") &&
-        strcmp(class_name,"NSCFConstantString") &&
-        strcmp(class_name,"NSCFString") &&
-        strcmp(class_name,"NSPathStore2"))
-    {
-        // not one of us - but tell me class name
-        stream.Printf("class name = %s",class_name);
-        return true;
-    }
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(summary_options.GetLanguage()))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
-    options.SetPrefixToken(prefix);
-    options.SetSuffixToken(suffix);
-    
-    if (is_mutable)
-    {
-        uint64_t location = 2 * ptr_size + valobj_addr;
-        location = process_sp->ReadPointerFromMemory(location, error);
-        if (error.Fail())
-            return false;
-        if (has_explicit_length && is_unicode)
-        {
-            options.SetLocation(location);
-            options.SetProcessSP(process_sp);
-            options.SetStream(&stream);
-            options.SetQuote('"');
-            options.SetSourceSize(explicit_length);
-            options.SetNeedsZeroTermination(false);
-            options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped);
-            options.SetBinaryZeroIsTerminator(false);
-            options.SetLanguage(summary_options.GetLanguage());
-            return StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::UTF16>(options);
-        }
-        else
-        {
-            options.SetLocation(location+1);
-            options.SetProcessSP(process_sp);
-            options.SetStream(&stream);
-            options.SetSourceSize(explicit_length);
-            options.SetNeedsZeroTermination(false);
-            options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped);
-            options.SetBinaryZeroIsTerminator(false);
-            options.SetLanguage(summary_options.GetLanguage());
-            return StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::ASCII>(options);
-        }
-    }
-    else if (is_inline && has_explicit_length && !is_unicode && !is_path_store && !is_mutable)
-    {
-        uint64_t location = 3 * ptr_size + valobj_addr;
-        
-        options.SetLocation(location);
-        options.SetProcessSP(process_sp);
-        options.SetStream(&stream);
-        options.SetQuote('"');
-        options.SetSourceSize(explicit_length);
-        options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped);
-        options.SetLanguage(summary_options.GetLanguage());
-        return StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::ASCII> (options);
-    }
-    else if (is_unicode)
-    {
-        uint64_t location = valobj_addr + 2*ptr_size;
-        if (is_inline)
-        {
-            if (!has_explicit_length)
-            {
-                stream.Printf("found new combo");
-                return true;
-            }
-            else
-                location += ptr_size;
-        }
-        else
-        {
-            location = process_sp->ReadPointerFromMemory(location, error);
-            if (error.Fail())
-                return false;
-        }
-        options.SetLocation(location);
-        options.SetProcessSP(process_sp);
-        options.SetStream(&stream);
-        options.SetQuote('"');
-        options.SetSourceSize(explicit_length);
-        options.SetNeedsZeroTermination(has_explicit_length == false);
-        options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped);
-        options.SetBinaryZeroIsTerminator(has_explicit_length == false);
-        options.SetLanguage(summary_options.GetLanguage());
-        return StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::UTF16> (options);
-    }
-    else if (is_path_store)
-    {
-        ProcessStructReader reader(valobj.GetProcessSP().get(), valobj.GetValueAsUnsigned(0), GetNSPathStore2Type(*valobj.GetTargetSP()));
-        explicit_length = reader.GetField<uint32_t>(ConstString("lengthAndRef")) >> 20;
-        lldb::addr_t location = valobj.GetValueAsUnsigned(0) + ptr_size + 4;
-        
-        options.SetLocation(location);
-        options.SetProcessSP(process_sp);
-        options.SetStream(&stream);
-        options.SetQuote('"');
-        options.SetSourceSize(explicit_length);
-        options.SetNeedsZeroTermination(has_explicit_length == false);
-        options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped);
-        options.SetBinaryZeroIsTerminator(has_explicit_length == false);
-        options.SetLanguage(summary_options.GetLanguage());
-        return StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::UTF16> (options);
-    }
+bool lldb_private::formatters::NSStringSummaryProvider(
+    ValueObject &valobj, Stream &stream,
+    const TypeSummaryOptions &summary_options) {
+  static ConstString g_TypeHint("NSString");
+
+  ProcessSP process_sp = valobj.GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  ObjCLanguageRuntime *runtime =
+      (ObjCLanguageRuntime *)process_sp->GetLanguageRuntime(
+          lldb::eLanguageTypeObjC);
+
+  if (!runtime)
+    return false;
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor(
+      runtime->GetClassDescriptor(valobj));
+
+  if (!descriptor.get() || !descriptor->IsValid())
+    return false;
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  lldb::addr_t valobj_addr = valobj.GetValueAsUnsigned(0);
+
+  if (!valobj_addr)
+    return false;
+
+  ConstString class_name_cs = descriptor->GetClassName();
+  const char *class_name = class_name_cs.GetCString();
+
+  if (!class_name || !*class_name)
+    return false;
+
+  bool is_tagged_ptr = (0 == strcmp(class_name, "NSTaggedPointerString")) &&
+                       descriptor->GetTaggedPointerInfo();
+  // for a tagged pointer, the descriptor has everything we need
+  if (is_tagged_ptr)
+    return NSTaggedString_SummaryProvider(valobj, descriptor, stream,
+                                          summary_options);
+
+  auto &additionals_map(NSString_Additionals::GetAdditionalSummaries());
+  auto iter = additionals_map.find(class_name_cs), end = additionals_map.end();
+  if (iter != end)
+    return iter->second(valobj, stream, summary_options);
+
+  // if not a tagged pointer that we know about, try the normal route
+  uint64_t info_bits_location = valobj_addr + ptr_size;
+  if (process_sp->GetByteOrder() != lldb::eByteOrderLittle)
+    info_bits_location += 3;
+
+  Error error;
+
+  uint8_t info_bits = process_sp->ReadUnsignedIntegerFromMemory(
+      info_bits_location, 1, 0, error);
+  if (error.Fail())
+    return false;
+
+  bool is_mutable = (info_bits & 1) == 1;
+  bool is_inline = (info_bits & 0x60) == 0;
+  bool has_explicit_length = (info_bits & (1 | 4)) != 4;
+  bool is_unicode = (info_bits & 0x10) == 0x10;
+  bool is_path_store = strcmp(class_name, "NSPathStore2") == 0;
+  bool has_null = (info_bits & 8) == 8;
+
+  size_t explicit_length = 0;
+  if (!has_null && has_explicit_length && !is_path_store) {
+    lldb::addr_t explicit_length_offset = 2 * ptr_size;
+    if (is_mutable && !is_inline)
+      explicit_length_offset =
+          explicit_length_offset + ptr_size; //  notInlineMutable.length;
     else if (is_inline)
-    {
-        uint64_t location = valobj_addr + 2*ptr_size;
-        if (!has_explicit_length)
-        {
-            // in this kind of string, the byte before the string content is a length byte
-            // so let's try and use it to handle the embedded NUL case
-            Error error;
-            explicit_length = process_sp->ReadUnsignedIntegerFromMemory(location, 1, 0, error);
-            if (error.Fail() || explicit_length == 0)
-                has_explicit_length = false;
-            else
-                has_explicit_length = true;
-            location++;
-        }
-        options.SetLocation(location);
-        options.SetProcessSP(process_sp);
-        options.SetStream(&stream);
-        options.SetSourceSize(explicit_length);
-        options.SetNeedsZeroTermination(!has_explicit_length);
-        options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped);
-        options.SetBinaryZeroIsTerminator(!has_explicit_length);
-        options.SetLanguage(summary_options.GetLanguage());
-        if (has_explicit_length)
-            return StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::UTF8>(options);
-        else
-            return StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::ASCII>(options);
-    }
+      explicit_length = explicit_length + 0; // inline1.length;
+    else if (!is_inline && !is_mutable)
+      explicit_length_offset =
+          explicit_length_offset + ptr_size; // notInlineImmutable1.length;
     else
-    {
-        uint64_t location = valobj_addr + 2*ptr_size;
-        location = process_sp->ReadPointerFromMemory(location, error);
-        if (error.Fail())
-            return false;
-        if (has_explicit_length && !has_null)
-            explicit_length++; // account for the fact that there is no NULL and we need to have one added
-        options.SetLocation(location);
-        options.SetProcessSP(process_sp);
-        options.SetStream(&stream);
-        options.SetSourceSize(explicit_length);
-        options.SetIgnoreMaxLength(summary_options.GetCapping() == TypeSummaryCapping::eTypeSummaryUncapped);
-        options.SetLanguage(summary_options.GetLanguage());
-        return StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::ASCII>(options);
+      explicit_length_offset = 0;
+
+    if (explicit_length_offset) {
+      explicit_length_offset = valobj_addr + explicit_length_offset;
+      explicit_length = process_sp->ReadUnsignedIntegerFromMemory(
+          explicit_length_offset, 4, 0, error);
     }
-}
+  }
 
-bool
-lldb_private::formatters::NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    TargetSP target_sp(valobj.GetTargetSP());
-    if (!target_sp)
-        return false;
-    uint32_t addr_size = target_sp->GetArchitecture().GetAddressByteSize();
-    uint64_t pointer_value = valobj.GetValueAsUnsigned(0);
-    if (!pointer_value)
-        return false;
-    pointer_value += addr_size;
-    CompilerType type(valobj.GetCompilerType());
-    ExecutionContext exe_ctx(target_sp,false);
-    ValueObjectSP child_ptr_sp(valobj.CreateValueObjectFromAddress("string_ptr", pointer_value, exe_ctx, type));
-    if (!child_ptr_sp)
-        return false;
-    DataExtractor data;
-    Error error;
-    child_ptr_sp->GetData(data, error);
+  if (strcmp(class_name, "NSString") && strcmp(class_name, "CFStringRef") &&
+      strcmp(class_name, "CFMutableStringRef") &&
+      strcmp(class_name, "__NSCFConstantString") &&
+      strcmp(class_name, "__NSCFString") &&
+      strcmp(class_name, "NSCFConstantString") &&
+      strcmp(class_name, "NSCFString") && strcmp(class_name, "NSPathStore2")) {
+    // not one of us - but tell me class name
+    stream.Printf("class name = %s", class_name);
+    return true;
+  }
+
+  std::string prefix, suffix;
+  if (Language *language =
+          Language::FindPlugin(summary_options.GetLanguage())) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
+    }
+  }
+
+  StringPrinter::ReadStringAndDumpToStreamOptions options(valobj);
+  options.SetPrefixToken(prefix);
+  options.SetSuffixToken(suffix);
+
+  if (is_mutable) {
+    uint64_t location = 2 * ptr_size + valobj_addr;
+    location = process_sp->ReadPointerFromMemory(location, error);
     if (error.Fail())
-        return false;
-    ValueObjectSP child_sp(child_ptr_sp->CreateValueObjectFromData("string_data", data, exe_ctx, type));
-    child_sp->GetValueAsUnsigned(0);
-    if (child_sp)
-        return NSStringSummaryProvider(*child_sp, stream, options);
+      return false;
+    if (has_explicit_length && is_unicode) {
+      options.SetLocation(location);
+      options.SetProcessSP(process_sp);
+      options.SetStream(&stream);
+      options.SetQuote('"');
+      options.SetSourceSize(explicit_length);
+      options.SetNeedsZeroTermination(false);
+      options.SetIgnoreMaxLength(summary_options.GetCapping() ==
+                                 TypeSummaryCapping::eTypeSummaryUncapped);
+      options.SetBinaryZeroIsTerminator(false);
+      options.SetLanguage(summary_options.GetLanguage());
+      return StringPrinter::ReadStringAndDumpToStream<
+          StringPrinter::StringElementType::UTF16>(options);
+    } else {
+      options.SetLocation(location + 1);
+      options.SetProcessSP(process_sp);
+      options.SetStream(&stream);
+      options.SetSourceSize(explicit_length);
+      options.SetNeedsZeroTermination(false);
+      options.SetIgnoreMaxLength(summary_options.GetCapping() ==
+                                 TypeSummaryCapping::eTypeSummaryUncapped);
+      options.SetBinaryZeroIsTerminator(false);
+      options.SetLanguage(summary_options.GetLanguage());
+      return StringPrinter::ReadStringAndDumpToStream<
+          StringPrinter::StringElementType::ASCII>(options);
+    }
+  } else if (is_inline && has_explicit_length && !is_unicode &&
+             !is_path_store && !is_mutable) {
+    uint64_t location = 3 * ptr_size + valobj_addr;
+
+    options.SetLocation(location);
+    options.SetProcessSP(process_sp);
+    options.SetStream(&stream);
+    options.SetQuote('"');
+    options.SetSourceSize(explicit_length);
+    options.SetIgnoreMaxLength(summary_options.GetCapping() ==
+                               TypeSummaryCapping::eTypeSummaryUncapped);
+    options.SetLanguage(summary_options.GetLanguage());
+    return StringPrinter::ReadStringAndDumpToStream<
+        StringPrinter::StringElementType::ASCII>(options);
+  } else if (is_unicode) {
+    uint64_t location = valobj_addr + 2 * ptr_size;
+    if (is_inline) {
+      if (!has_explicit_length) {
+        stream.Printf("found new combo");
+        return true;
+      } else
+        location += ptr_size;
+    } else {
+      location = process_sp->ReadPointerFromMemory(location, error);
+      if (error.Fail())
+        return false;
+    }
+    options.SetLocation(location);
+    options.SetProcessSP(process_sp);
+    options.SetStream(&stream);
+    options.SetQuote('"');
+    options.SetSourceSize(explicit_length);
+    options.SetNeedsZeroTermination(has_explicit_length == false);
+    options.SetIgnoreMaxLength(summary_options.GetCapping() ==
+                               TypeSummaryCapping::eTypeSummaryUncapped);
+    options.SetBinaryZeroIsTerminator(has_explicit_length == false);
+    options.SetLanguage(summary_options.GetLanguage());
+    return StringPrinter::ReadStringAndDumpToStream<
+        StringPrinter::StringElementType::UTF16>(options);
+  } else if (is_path_store) {
+    ProcessStructReader reader(valobj.GetProcessSP().get(),
+                               valobj.GetValueAsUnsigned(0),
+                               GetNSPathStore2Type(*valobj.GetTargetSP()));
+    explicit_length =
+        reader.GetField<uint32_t>(ConstString("lengthAndRef")) >> 20;
+    lldb::addr_t location = valobj.GetValueAsUnsigned(0) + ptr_size + 4;
+
+    options.SetLocation(location);
+    options.SetProcessSP(process_sp);
+    options.SetStream(&stream);
+    options.SetQuote('"');
+    options.SetSourceSize(explicit_length);
+    options.SetNeedsZeroTermination(has_explicit_length == false);
+    options.SetIgnoreMaxLength(summary_options.GetCapping() ==
+                               TypeSummaryCapping::eTypeSummaryUncapped);
+    options.SetBinaryZeroIsTerminator(has_explicit_length == false);
+    options.SetLanguage(summary_options.GetLanguage());
+    return StringPrinter::ReadStringAndDumpToStream<
+        StringPrinter::StringElementType::UTF16>(options);
+  } else if (is_inline) {
+    uint64_t location = valobj_addr + 2 * ptr_size;
+    if (!has_explicit_length) {
+      // in this kind of string, the byte before the string content is a length
+      // byte
+      // so let's try and use it to handle the embedded NUL case
+      Error error;
+      explicit_length =
+          process_sp->ReadUnsignedIntegerFromMemory(location, 1, 0, error);
+      if (error.Fail() || explicit_length == 0)
+        has_explicit_length = false;
+      else
+        has_explicit_length = true;
+      location++;
+    }
+    options.SetLocation(location);
+    options.SetProcessSP(process_sp);
+    options.SetStream(&stream);
+    options.SetSourceSize(explicit_length);
+    options.SetNeedsZeroTermination(!has_explicit_length);
+    options.SetIgnoreMaxLength(summary_options.GetCapping() ==
+                               TypeSummaryCapping::eTypeSummaryUncapped);
+    options.SetBinaryZeroIsTerminator(!has_explicit_length);
+    options.SetLanguage(summary_options.GetLanguage());
+    if (has_explicit_length)
+      return StringPrinter::ReadStringAndDumpToStream<
+          StringPrinter::StringElementType::UTF8>(options);
+    else
+      return StringPrinter::ReadStringAndDumpToStream<
+          StringPrinter::StringElementType::ASCII>(options);
+  } else {
+    uint64_t location = valobj_addr + 2 * ptr_size;
+    location = process_sp->ReadPointerFromMemory(location, error);
+    if (error.Fail())
+      return false;
+    if (has_explicit_length && !has_null)
+      explicit_length++; // account for the fact that there is no NULL and we
+                         // need to have one added
+    options.SetLocation(location);
+    options.SetProcessSP(process_sp);
+    options.SetStream(&stream);
+    options.SetSourceSize(explicit_length);
+    options.SetIgnoreMaxLength(summary_options.GetCapping() ==
+                               TypeSummaryCapping::eTypeSummaryUncapped);
+    options.SetLanguage(summary_options.GetLanguage());
+    return StringPrinter::ReadStringAndDumpToStream<
+        StringPrinter::StringElementType::ASCII>(options);
+  }
+}
+
+bool lldb_private::formatters::NSAttributedStringSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  TargetSP target_sp(valobj.GetTargetSP());
+  if (!target_sp)
+    return false;
+  uint32_t addr_size = target_sp->GetArchitecture().GetAddressByteSize();
+  uint64_t pointer_value = valobj.GetValueAsUnsigned(0);
+  if (!pointer_value)
+    return false;
+  pointer_value += addr_size;
+  CompilerType type(valobj.GetCompilerType());
+  ExecutionContext exe_ctx(target_sp, false);
+  ValueObjectSP child_ptr_sp(valobj.CreateValueObjectFromAddress(
+      "string_ptr", pointer_value, exe_ctx, type));
+  if (!child_ptr_sp)
     return false;
+  DataExtractor data;
+  Error error;
+  child_ptr_sp->GetData(data, error);
+  if (error.Fail())
+    return false;
+  ValueObjectSP child_sp(child_ptr_sp->CreateValueObjectFromData(
+      "string_data", data, exe_ctx, type));
+  child_sp->GetValueAsUnsigned(0);
+  if (child_sp)
+    return NSStringSummaryProvider(*child_sp, stream, options);
+  return false;
 }
 
-bool
-lldb_private::formatters::NSMutableAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    return NSAttributedStringSummaryProvider(valobj, stream, options);
+bool lldb_private::formatters::NSMutableAttributedStringSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  return NSAttributedStringSummaryProvider(valobj, stream, options);
 }
 
-bool
-lldb_private::formatters::NSTaggedString_SummaryProvider (ValueObject& valobj, ObjCLanguageRuntime::ClassDescriptorSP descriptor, Stream& stream, const TypeSummaryOptions& summary_options)
-{
-    static ConstString g_TypeHint("NSString");
-    
-    if (!descriptor)
-        return false;
-    uint64_t len_bits = 0, data_bits = 0;
-    if (!descriptor->GetTaggedPointerInfo(&len_bits,&data_bits,nullptr))
-        return false;
-    
-    static const int g_MaxNonBitmaskedLen = 7; //TAGGED_STRING_UNPACKED_MAXLEN
-    static const int g_SixbitMaxLen = 9;
-    static const int g_fiveBitMaxLen = 11;
-    
-    static const char *sixBitToCharLookup = "eilotrm.apdnsIc ufkMShjTRxgC4013" "bDNvwyUL2O856P-B79AFKEWV_zGJ/HYX";
-    
-    if (len_bits > g_fiveBitMaxLen)
-        return false;
-    
-    std::string prefix,suffix;
-    if (Language* language = Language::FindPlugin(summary_options.GetLanguage()))
-    {
-        if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix, suffix))
-        {
-            prefix.clear();
-            suffix.clear();
-        }
-    }
-    
-    // this is a fairly ugly trick - pretend that the numeric value is actually a char*
-    // this works under a few assumptions:
-    // little endian architecture
-    // sizeof(uint64_t) > g_MaxNonBitmaskedLen
-    if (len_bits <= g_MaxNonBitmaskedLen)
-    {
-        stream.Printf("%s",prefix.c_str());
-        stream.Printf("\"%s\"",(const char*)&data_bits);
-        stream.Printf("%s",suffix.c_str());
-        return true;
-    }
-    
-    // if the data is bitmasked, we need to actually process the bytes
-    uint8_t bitmask = 0;
-    uint8_t shift_offset = 0;
-    
-    if (len_bits <= g_SixbitMaxLen)
-    {
-        bitmask = 0x03f;
-        shift_offset = 6;
-    }
-    else
-    {
-        bitmask = 0x01f;
-        shift_offset = 5;
-    }
-    
-    std::vector<uint8_t> bytes;
-    bytes.resize(len_bits);
-    for (; len_bits > 0; data_bits >>= shift_offset, --len_bits)
-    {
-        uint8_t packed = data_bits & bitmask;
-        bytes.insert(bytes.begin(), sixBitToCharLookup[packed]);
+bool lldb_private::formatters::NSTaggedString_SummaryProvider(
+    ValueObject &valobj, ObjCLanguageRuntime::ClassDescriptorSP descriptor,
+    Stream &stream, const TypeSummaryOptions &summary_options) {
+  static ConstString g_TypeHint("NSString");
+
+  if (!descriptor)
+    return false;
+  uint64_t len_bits = 0, data_bits = 0;
+  if (!descriptor->GetTaggedPointerInfo(&len_bits, &data_bits, nullptr))
+    return false;
+
+  static const int g_MaxNonBitmaskedLen = 7; // TAGGED_STRING_UNPACKED_MAXLEN
+  static const int g_SixbitMaxLen = 9;
+  static const int g_fiveBitMaxLen = 11;
+
+  static const char *sixBitToCharLookup = "eilotrm.apdnsIc ufkMShjTRxgC4013"
+                                          "bDNvwyUL2O856P-B79AFKEWV_zGJ/HYX";
+
+  if (len_bits > g_fiveBitMaxLen)
+    return false;
+
+  std::string prefix, suffix;
+  if (Language *language =
+          Language::FindPlugin(summary_options.GetLanguage())) {
+    if (!language->GetFormatterPrefixSuffix(valobj, g_TypeHint, prefix,
+                                            suffix)) {
+      prefix.clear();
+      suffix.clear();
     }
-    
-    stream.Printf("%s",prefix.c_str());
-    stream.Printf("\"%s\"",&bytes[0]);
-    stream.Printf("%s",suffix.c_str());
+  }
+
+  // this is a fairly ugly trick - pretend that the numeric value is actually a
+  // char*
+  // this works under a few assumptions:
+  // little endian architecture
+  // sizeof(uint64_t) > g_MaxNonBitmaskedLen
+  if (len_bits <= g_MaxNonBitmaskedLen) {
+    stream.Printf("%s", prefix.c_str());
+    stream.Printf("\"%s\"", (const char *)&data_bits);
+    stream.Printf("%s", suffix.c_str());
     return true;
+  }
+
+  // if the data is bitmasked, we need to actually process the bytes
+  uint8_t bitmask = 0;
+  uint8_t shift_offset = 0;
+
+  if (len_bits <= g_SixbitMaxLen) {
+    bitmask = 0x03f;
+    shift_offset = 6;
+  } else {
+    bitmask = 0x01f;
+    shift_offset = 5;
+  }
+
+  std::vector<uint8_t> bytes;
+  bytes.resize(len_bits);
+  for (; len_bits > 0; data_bits >>= shift_offset, --len_bits) {
+    uint8_t packed = data_bits & bitmask;
+    bytes.insert(bytes.begin(), sixBitToCharLookup[packed]);
+  }
+
+  stream.Printf("%s", prefix.c_str());
+  stream.Printf("\"%s\"", &bytes[0]);
+  stream.Printf("%s", suffix.c_str());
+  return true;
 }

Modified: lldb/trunk/source/Plugins/Language/ObjC/NSString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/NSString.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/NSString.h (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/NSString.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- NSString.h ---------------------------------------------------*- C++ -*-===//
+//===-- NSString.h ---------------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -16,27 +17,26 @@
 #include "lldb/Target/ObjCLanguageRuntime.h"
 
 namespace lldb_private {
-    namespace formatters
-    {
-        bool
-        NSStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSTaggedString_SummaryProvider (ValueObject& valobj, ObjCLanguageRuntime::ClassDescriptorSP descriptor, Stream& stream, const TypeSummaryOptions& summary_options);
-        
-        bool
-        NSAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        bool
-        NSMutableAttributedStringSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
-        
-        class NSString_Additionals
-        {
-        public:
-            static std::map<ConstString, CXXFunctionSummaryFormat::Callback>&
-            GetAdditionalSummaries ();
-        };
-    } // namespace formatters
+namespace formatters {
+bool NSStringSummaryProvider(ValueObject &valobj, Stream &stream,
+                             const TypeSummaryOptions &options);
+
+bool NSTaggedString_SummaryProvider(
+    ValueObject &valobj, ObjCLanguageRuntime::ClassDescriptorSP descriptor,
+    Stream &stream, const TypeSummaryOptions &summary_options);
+
+bool NSAttributedStringSummaryProvider(ValueObject &valobj, Stream &stream,
+                                       const TypeSummaryOptions &options);
+
+bool NSMutableAttributedStringSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options);
+
+class NSString_Additionals {
+public:
+  static std::map<ConstString, CXXFunctionSummaryFormat::Callback> &
+  GetAdditionalSummaries();
+};
+} // namespace formatters
 } // namespace lldb_private
 
 #endif // liblldb_CF_h_

Modified: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp Tue Sep  6 15:57:50 2016
@@ -21,10 +21,10 @@
 #include "lldb/Core/ValueObject.h"
 #include "lldb/DataFormatters/DataVisualization.h"
 #include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompilerType.h"
-#include "lldb/Target/Target.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
-#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Target/Target.h"
 
 #include "CF.h"
 #include "Cocoa.h"
@@ -37,841 +37,1035 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-void
-ObjCLanguage::Initialize()
-{
-    PluginManager::RegisterPlugin (GetPluginNameStatic(),
-                                   "Objective-C Language",
-                                   CreateInstance);
-}
-
-void
-ObjCLanguage::Terminate()
-{
-    PluginManager::UnregisterPlugin (CreateInstance);
-}
-
-lldb_private::ConstString
-ObjCLanguage::GetPluginNameStatic()
-{
-    static ConstString g_name("objc");
-    return g_name;
+void ObjCLanguage::Initialize() {
+  PluginManager::RegisterPlugin(GetPluginNameStatic(), "Objective-C Language",
+                                CreateInstance);
+}
+
+void ObjCLanguage::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+lldb_private::ConstString ObjCLanguage::GetPluginNameStatic() {
+  static ConstString g_name("objc");
+  return g_name;
 }
 
 //------------------------------------------------------------------
 // PluginInterface protocol
 //------------------------------------------------------------------
 
-lldb_private::ConstString
-ObjCLanguage::GetPluginName()
-{
-    return GetPluginNameStatic();
+lldb_private::ConstString ObjCLanguage::GetPluginName() {
+  return GetPluginNameStatic();
 }
 
-uint32_t
-ObjCLanguage::GetPluginVersion()
-{
-    return 1;
-}
+uint32_t ObjCLanguage::GetPluginVersion() { return 1; }
 
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
 
-Language *
-ObjCLanguage::CreateInstance (lldb::LanguageType language)
-{
-    switch (language)
-    {
-        case lldb::eLanguageTypeObjC:
-            return new ObjCLanguage();
-        default:
-            return nullptr;
+Language *ObjCLanguage::CreateInstance(lldb::LanguageType language) {
+  switch (language) {
+  case lldb::eLanguageTypeObjC:
+    return new ObjCLanguage();
+  default:
+    return nullptr;
+  }
+}
+
+void ObjCLanguage::MethodName::Clear() {
+  m_full.Clear();
+  m_class.Clear();
+  m_category.Clear();
+  m_selector.Clear();
+  m_type = eTypeUnspecified;
+  m_category_is_valid = false;
+}
+
+bool ObjCLanguage::MethodName::SetName(const char *name, bool strict) {
+  Clear();
+  if (name && name[0]) {
+    // If "strict" is true. then the method must be specified with a
+    // '+' or '-' at the beginning. If "strict" is false, then the '+'
+    // or '-' can be omitted
+    bool valid_prefix = false;
+
+    if (name[0] == '+' || name[0] == '-') {
+      valid_prefix = name[1] == '[';
+      if (name[0] == '+')
+        m_type = eTypeClassMethod;
+      else
+        m_type = eTypeInstanceMethod;
+    } else if (!strict) {
+      // "strict" is false, the name just needs to start with '['
+      valid_prefix = name[0] == '[';
     }
-}
 
-void
-ObjCLanguage::MethodName::Clear()
-{
-    m_full.Clear();
-    m_class.Clear();
-    m_category.Clear();
-    m_selector.Clear();
-    m_type = eTypeUnspecified;
-    m_category_is_valid = false;
-}
-
-bool
-ObjCLanguage::MethodName::SetName (const char *name, bool strict)
-{
-    Clear();
-    if (name && name[0])
-    {
-        // If "strict" is true. then the method must be specified with a
-        // '+' or '-' at the beginning. If "strict" is false, then the '+'
-        // or '-' can be omitted
-        bool valid_prefix = false;
-        
-        if (name[0] == '+' || name[0] == '-')
-        {
-            valid_prefix = name[1] == '[';
-            if (name[0] == '+')
-                m_type = eTypeClassMethod;
-            else
-                m_type = eTypeInstanceMethod;
-        }
-        else if (!strict)
-        {
-            // "strict" is false, the name just needs to start with '['
-            valid_prefix = name[0] == '[';
-        }
-        
-        if (valid_prefix)
-        {
-            int name_len = strlen (name);
-            // Objective C methods must have at least:
-            //      "-[" or "+[" prefix
-            //      One character for a class name
-            //      One character for the space between the class name
-            //      One character for the method name
-            //      "]" suffix
-            if (name_len >= (5 + (strict ? 1 : 0)) && name[name_len - 1] == ']')
-            {
-                m_full.SetCStringWithLength(name, name_len);
-            }
-        }
+    if (valid_prefix) {
+      int name_len = strlen(name);
+      // Objective C methods must have at least:
+      //      "-[" or "+[" prefix
+      //      One character for a class name
+      //      One character for the space between the class name
+      //      One character for the method name
+      //      "]" suffix
+      if (name_len >= (5 + (strict ? 1 : 0)) && name[name_len - 1] == ']') {
+        m_full.SetCStringWithLength(name, name_len);
+      }
     }
-    return IsValid(strict);
+  }
+  return IsValid(strict);
 }
 
-const ConstString &
-ObjCLanguage::MethodName::GetClassName ()
-{
-    if (!m_class)
-    {
-        if (IsValid(false))
-        {
-            const char *full = m_full.GetCString();
-            const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
-            const char *paren_pos = strchr (class_start, '(');
-            if (paren_pos)
-            {
-                m_class.SetCStringWithLength (class_start, paren_pos - class_start);
-            }
-            else
-            {
-                // No '(' was found in the full name, we can definitively say
-                // that our category was valid (and empty).
-                m_category_is_valid = true;
-                const char *space_pos = strchr (full, ' ');
-                if (space_pos)
-                {
-                    m_class.SetCStringWithLength (class_start, space_pos - class_start);
-                    if (!m_class_category)
-                    {
-                        // No category in name, so we can also fill in the m_class_category
-                        m_class_category = m_class;
-                    }
-                }
-            }
+const ConstString &ObjCLanguage::MethodName::GetClassName() {
+  if (!m_class) {
+    if (IsValid(false)) {
+      const char *full = m_full.GetCString();
+      const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
+      const char *paren_pos = strchr(class_start, '(');
+      if (paren_pos) {
+        m_class.SetCStringWithLength(class_start, paren_pos - class_start);
+      } else {
+        // No '(' was found in the full name, we can definitively say
+        // that our category was valid (and empty).
+        m_category_is_valid = true;
+        const char *space_pos = strchr(full, ' ');
+        if (space_pos) {
+          m_class.SetCStringWithLength(class_start, space_pos - class_start);
+          if (!m_class_category) {
+            // No category in name, so we can also fill in the m_class_category
+            m_class_category = m_class;
+          }
         }
+      }
     }
-    return m_class;
+  }
+  return m_class;
 }
 
-const ConstString &
-ObjCLanguage::MethodName::GetClassNameWithCategory () 
-{
-    if (!m_class_category)
-    {
-        if (IsValid(false))
-        {
-            const char *full = m_full.GetCString();
-            const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
-            const char *space_pos = strchr (full, ' ');
-            if (space_pos)
-            {
-                m_class_category.SetCStringWithLength (class_start, space_pos - class_start);
-                // If m_class hasn't been filled in and the class with category doesn't
-                // contain a '(', then we can also fill in the m_class
-                if (!m_class && strchr(m_class_category.GetCString(), '(') == nullptr)
-                {
-                    m_class = m_class_category;
-                    // No '(' was found in the full name, we can definitively say
-                    // that our category was valid (and empty).
-                    m_category_is_valid = true;
-
-                }
-            }
+const ConstString &ObjCLanguage::MethodName::GetClassNameWithCategory() {
+  if (!m_class_category) {
+    if (IsValid(false)) {
+      const char *full = m_full.GetCString();
+      const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
+      const char *space_pos = strchr(full, ' ');
+      if (space_pos) {
+        m_class_category.SetCStringWithLength(class_start,
+                                              space_pos - class_start);
+        // If m_class hasn't been filled in and the class with category doesn't
+        // contain a '(', then we can also fill in the m_class
+        if (!m_class && strchr(m_class_category.GetCString(), '(') == nullptr) {
+          m_class = m_class_category;
+          // No '(' was found in the full name, we can definitively say
+          // that our category was valid (and empty).
+          m_category_is_valid = true;
         }
+      }
     }
-    return m_class_category;
+  }
+  return m_class_category;
 }
 
-const ConstString &
-ObjCLanguage::MethodName::GetSelector ()
-{
-    if (!m_selector)
-    {
-        if (IsValid(false))
-        {
-            const char *full = m_full.GetCString();
-            const char *space_pos = strchr (full, ' ');
-            if (space_pos)
-            {
-                ++space_pos; // skip the space
-                m_selector.SetCStringWithLength (space_pos, m_full.GetLength() - (space_pos - full) - 1);
-            }
-        }
+const ConstString &ObjCLanguage::MethodName::GetSelector() {
+  if (!m_selector) {
+    if (IsValid(false)) {
+      const char *full = m_full.GetCString();
+      const char *space_pos = strchr(full, ' ');
+      if (space_pos) {
+        ++space_pos; // skip the space
+        m_selector.SetCStringWithLength(space_pos, m_full.GetLength() -
+                                                       (space_pos - full) - 1);
+      }
     }
-    return m_selector;
+  }
+  return m_selector;
 }
 
-const ConstString &
-ObjCLanguage::MethodName::GetCategory ()
-{
-    if (!m_category_is_valid && !m_category)
-    {
-        if (IsValid(false))
-        {
-            m_category_is_valid = true;
-            const char *full = m_full.GetCString();
-            const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
-            const char *open_paren_pos = strchr (class_start, '(');
-            if (open_paren_pos)
-            {
-                ++open_paren_pos; // Skip the open paren
-                const char *close_paren_pos = strchr (open_paren_pos, ')');
-                if (close_paren_pos)
-                    m_category.SetCStringWithLength (open_paren_pos, close_paren_pos - open_paren_pos);
-            }
-        }
+const ConstString &ObjCLanguage::MethodName::GetCategory() {
+  if (!m_category_is_valid && !m_category) {
+    if (IsValid(false)) {
+      m_category_is_valid = true;
+      const char *full = m_full.GetCString();
+      const char *class_start = (full[0] == '[' ? full + 1 : full + 2);
+      const char *open_paren_pos = strchr(class_start, '(');
+      if (open_paren_pos) {
+        ++open_paren_pos; // Skip the open paren
+        const char *close_paren_pos = strchr(open_paren_pos, ')');
+        if (close_paren_pos)
+          m_category.SetCStringWithLength(open_paren_pos,
+                                          close_paren_pos - open_paren_pos);
+      }
     }
-    return m_category;
+  }
+  return m_category;
 }
 
-ConstString
-ObjCLanguage::MethodName::GetFullNameWithoutCategory (bool empty_if_no_category)
-{
-    if (IsValid(false))
-    {
-        if (HasCategory())
-        {
-            StreamString strm;
-            if (m_type == eTypeClassMethod)
-                strm.PutChar('+');
-            else if (m_type == eTypeInstanceMethod)
-                strm.PutChar('-');
-            strm.Printf("[%s %s]", GetClassName().GetCString(), GetSelector().GetCString());
-            return ConstString(strm.GetString().c_str());
-        }
-        
-        if (!empty_if_no_category)
-        {
-            // Just return the full name since it doesn't have a category
-            return GetFullName();
-        }
+ConstString ObjCLanguage::MethodName::GetFullNameWithoutCategory(
+    bool empty_if_no_category) {
+  if (IsValid(false)) {
+    if (HasCategory()) {
+      StreamString strm;
+      if (m_type == eTypeClassMethod)
+        strm.PutChar('+');
+      else if (m_type == eTypeInstanceMethod)
+        strm.PutChar('-');
+      strm.Printf("[%s %s]", GetClassName().GetCString(),
+                  GetSelector().GetCString());
+      return ConstString(strm.GetString().c_str());
     }
-    return ConstString();
+
+    if (!empty_if_no_category) {
+      // Just return the full name since it doesn't have a category
+      return GetFullName();
+    }
+  }
+  return ConstString();
 }
 
-size_t
-ObjCLanguage::MethodName::GetFullNames (std::vector<ConstString> &names, bool append)
-{
-    if (!append)
-        names.clear();
-    if (IsValid(false))
-    {
-        StreamString strm;
-        const bool is_class_method = m_type == eTypeClassMethod;
-        const bool is_instance_method = m_type == eTypeInstanceMethod;
-        const ConstString &category = GetCategory();
-        if (is_class_method || is_instance_method)
-        {
-            names.push_back (m_full);
-            if (category)
-            {
-                strm.Printf("%c[%s %s]",
-                            is_class_method ? '+' : '-',
-                            GetClassName().GetCString(),
-                            GetSelector().GetCString());
-                names.push_back(ConstString(strm.GetString().c_str()));
-            }
-        }
-        else
-        {
-            const ConstString &class_name = GetClassName();
-            const ConstString &selector = GetSelector();
-            strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString());
-            names.push_back(ConstString(strm.GetString().c_str()));
-            strm.Clear();
-            strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString());
-            names.push_back(ConstString(strm.GetString().c_str()));
-            strm.Clear();
-            if (category)
-            {
-                strm.Printf("+[%s(%s) %s]", class_name.GetCString(), category.GetCString(), selector.GetCString());
-                names.push_back(ConstString(strm.GetString().c_str()));
-                strm.Clear();
-                strm.Printf("-[%s(%s) %s]", class_name.GetCString(), category.GetCString(), selector.GetCString());
-                names.push_back(ConstString(strm.GetString().c_str()));
-            }
-        }
+size_t ObjCLanguage::MethodName::GetFullNames(std::vector<ConstString> &names,
+                                              bool append) {
+  if (!append)
+    names.clear();
+  if (IsValid(false)) {
+    StreamString strm;
+    const bool is_class_method = m_type == eTypeClassMethod;
+    const bool is_instance_method = m_type == eTypeInstanceMethod;
+    const ConstString &category = GetCategory();
+    if (is_class_method || is_instance_method) {
+      names.push_back(m_full);
+      if (category) {
+        strm.Printf("%c[%s %s]", is_class_method ? '+' : '-',
+                    GetClassName().GetCString(), GetSelector().GetCString());
+        names.push_back(ConstString(strm.GetString().c_str()));
+      }
+    } else {
+      const ConstString &class_name = GetClassName();
+      const ConstString &selector = GetSelector();
+      strm.Printf("+[%s %s]", class_name.GetCString(), selector.GetCString());
+      names.push_back(ConstString(strm.GetString().c_str()));
+      strm.Clear();
+      strm.Printf("-[%s %s]", class_name.GetCString(), selector.GetCString());
+      names.push_back(ConstString(strm.GetString().c_str()));
+      strm.Clear();
+      if (category) {
+        strm.Printf("+[%s(%s) %s]", class_name.GetCString(),
+                    category.GetCString(), selector.GetCString());
+        names.push_back(ConstString(strm.GetString().c_str()));
+        strm.Clear();
+        strm.Printf("-[%s(%s) %s]", class_name.GetCString(),
+                    category.GetCString(), selector.GetCString());
+        names.push_back(ConstString(strm.GetString().c_str()));
+      }
     }
-    return names.size();
+  }
+  return names.size();
 }
 
-static void
-LoadObjCFormatters(TypeCategoryImplSP objc_category_sp)
-{
-    if (!objc_category_sp)
-        return;
-    
-    TypeSummaryImpl::Flags objc_flags;
-    objc_flags.SetCascades(false)
-    .SetSkipPointers(true)
-    .SetSkipReferences(true)
-    .SetDontShowChildren(true)
-    .SetDontShowValue(true)
-    .SetShowMembersOneLiner(false)
-    .SetHideItemNames(false);
-    
-    lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(objc_flags, lldb_private::formatters::ObjCBOOLSummaryProvider,""));
-    objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL"),
-                                                       ObjC_BOOL_summary);
-    objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL &"),
-                                                       ObjC_BOOL_summary);
-    objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL *"),
-                                                       ObjC_BOOL_summary);
-    
+static void LoadObjCFormatters(TypeCategoryImplSP objc_category_sp) {
+  if (!objc_category_sp)
+    return;
+
+  TypeSummaryImpl::Flags objc_flags;
+  objc_flags.SetCascades(false)
+      .SetSkipPointers(true)
+      .SetSkipReferences(true)
+      .SetDontShowChildren(true)
+      .SetDontShowValue(true)
+      .SetShowMembersOneLiner(false)
+      .SetHideItemNames(false);
+
+  lldb::TypeSummaryImplSP ObjC_BOOL_summary(new CXXFunctionSummaryFormat(
+      objc_flags, lldb_private::formatters::ObjCBOOLSummaryProvider, ""));
+  objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL"),
+                                                     ObjC_BOOL_summary);
+  objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL &"),
+                                                     ObjC_BOOL_summary);
+  objc_category_sp->GetTypeSummariesContainer()->Add(ConstString("BOOL *"),
+                                                     ObjC_BOOL_summary);
+
 #ifndef LLDB_DISABLE_PYTHON
-    // we need to skip pointers here since we are special casing a SEL* when retrieving its value
-    objc_flags.SetSkipPointers(true);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("SEL"), objc_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("struct objc_selector"), objc_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>, "SEL summary provider", ConstString("objc_selector"), objc_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("objc_selector *"), objc_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>, "SEL summary provider", ConstString("SEL *"), objc_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::ObjCClassSummaryProvider, "Class summary provider", ConstString("Class"), objc_flags);
-    
-    SyntheticChildren::Flags class_synth_flags;
-    class_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(false);
-    
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::ObjCClassSyntheticFrontEndCreator, "Class synthetic children", ConstString("Class"), class_synth_flags);
+  // we need to skip pointers here since we are special casing a SEL* when
+  // retrieving its value
+  objc_flags.SetSkipPointers(true);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::ObjCSELSummaryProvider<false>,
+                "SEL summary provider", ConstString("SEL"), objc_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>,
+      "SEL summary provider", ConstString("struct objc_selector"), objc_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<false>,
+      "SEL summary provider", ConstString("objc_selector"), objc_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::ObjCSELSummaryProvider<true>,
+      "SEL summary provider", ConstString("objc_selector *"), objc_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::ObjCSELSummaryProvider<true>,
+                "SEL summary provider", ConstString("SEL *"), objc_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::ObjCClassSummaryProvider,
+                "Class summary provider", ConstString("Class"), objc_flags);
+
+  SyntheticChildren::Flags class_synth_flags;
+  class_synth_flags.SetCascades(true).SetSkipPointers(false).SetSkipReferences(
+      false);
+
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::ObjCClassSyntheticFrontEndCreator,
+                  "Class synthetic children", ConstString("Class"),
+                  class_synth_flags);
 #endif // LLDB_DISABLE_PYTHON
-    
-    objc_flags.SetSkipPointers(false);
-    objc_flags.SetCascades(true);
-    objc_flags.SetSkipReferences(false);
-    
-    AddStringSummary (objc_category_sp,
-                      "${var.__FuncPtr%A}",
-                      ConstString("__block_literal_generic"),
-                      objc_flags);
-    
-    AddStringSummary(objc_category_sp,
-                     "${var.years} years, ${var.months} months, ${var.days} days, ${var.hours} hours, ${var.minutes} minutes ${var.seconds} seconds",
-                     ConstString("CFGregorianUnits"),
-                     objc_flags);
-    AddStringSummary(objc_category_sp,
-                     "location=${var.location} length=${var.length}",
-                     ConstString("CFRange"),
-                     objc_flags);
-    
-    AddStringSummary(objc_category_sp,
-                     "location=${var.location}, length=${var.length}",
-                     ConstString("NSRange"),
-                     objc_flags);
-    AddStringSummary(objc_category_sp,
-                     "(${var.origin}, ${var.size}), ...",
-                     ConstString("NSRectArray"),
-                     objc_flags);
-    
-    AddOneLineSummary (objc_category_sp,
-                       ConstString("NSPoint"),
-                       objc_flags);
-    AddOneLineSummary (objc_category_sp,
-                       ConstString("NSSize"),
-                       objc_flags);
-    AddOneLineSummary (objc_category_sp,
-                       ConstString("NSRect"),
-                       objc_flags);
-    
-    AddOneLineSummary (objc_category_sp,
-                       ConstString("CGSize"),
-                       objc_flags);
-    AddOneLineSummary (objc_category_sp,
-                       ConstString("CGPoint"),
-                       objc_flags);
-    AddOneLineSummary (objc_category_sp,
-                       ConstString("CGRect"),
-                       objc_flags);
-    
-    AddStringSummary(objc_category_sp,
-                     "red=${var.red} green=${var.green} blue=${var.blue}",
-                     ConstString("RGBColor"),
-                     objc_flags);
-    AddStringSummary(objc_category_sp,
-                     "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})",
-                     ConstString("Rect"),
-                     objc_flags);
-    AddStringSummary(objc_category_sp,
-                     "{(v=${var.v}, h=${var.h})}",
-                     ConstString("Point"),
-                     objc_flags);
-    AddStringSummary(objc_category_sp,
-                     "${var.month}/${var.day}/${var.year}  ${var.hour} :${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}",
-                     ConstString("DateTimeRect *"),
-                     objc_flags);
-    AddStringSummary(objc_category_sp,
-                     "${var.ld.month}/${var.ld.day}/${var.ld.year} ${var.ld.hour} :${var.ld.minute} :${var.ld.second} dayOfWeek:${var.ld.dayOfWeek}",
-                     ConstString("LongDateRect"),
-                     objc_flags);
-    AddStringSummary(objc_category_sp,
-                     "(x=${var.x}, y=${var.y})",
-                     ConstString("HIPoint"),
-                     objc_flags);
-    AddStringSummary(objc_category_sp,
-                     "origin=${var.origin} size=${var.size}",
-                     ConstString("HIRect"),
-                     objc_flags);
-    
-    TypeSummaryImpl::Flags appkit_flags;
-    appkit_flags.SetCascades(true)
-    .SetSkipPointers(false)
-    .SetSkipReferences(false)
-    .SetDontShowChildren(true)
-    .SetDontShowValue(false)
-    .SetShowMembersOneLiner(false)
-    .SetHideItemNames(false);
-    
-    appkit_flags.SetDontShowChildren(false);
-    
+
+  objc_flags.SetSkipPointers(false);
+  objc_flags.SetCascades(true);
+  objc_flags.SetSkipReferences(false);
+
+  AddStringSummary(objc_category_sp, "${var.__FuncPtr%A}",
+                   ConstString("__block_literal_generic"), objc_flags);
+
+  AddStringSummary(objc_category_sp, "${var.years} years, ${var.months} "
+                                     "months, ${var.days} days, ${var.hours} "
+                                     "hours, ${var.minutes} minutes "
+                                     "${var.seconds} seconds",
+                   ConstString("CFGregorianUnits"), objc_flags);
+  AddStringSummary(objc_category_sp,
+                   "location=${var.location} length=${var.length}",
+                   ConstString("CFRange"), objc_flags);
+
+  AddStringSummary(objc_category_sp,
+                   "location=${var.location}, length=${var.length}",
+                   ConstString("NSRange"), objc_flags);
+  AddStringSummary(objc_category_sp, "(${var.origin}, ${var.size}), ...",
+                   ConstString("NSRectArray"), objc_flags);
+
+  AddOneLineSummary(objc_category_sp, ConstString("NSPoint"), objc_flags);
+  AddOneLineSummary(objc_category_sp, ConstString("NSSize"), objc_flags);
+  AddOneLineSummary(objc_category_sp, ConstString("NSRect"), objc_flags);
+
+  AddOneLineSummary(objc_category_sp, ConstString("CGSize"), objc_flags);
+  AddOneLineSummary(objc_category_sp, ConstString("CGPoint"), objc_flags);
+  AddOneLineSummary(objc_category_sp, ConstString("CGRect"), objc_flags);
+
+  AddStringSummary(objc_category_sp,
+                   "red=${var.red} green=${var.green} blue=${var.blue}",
+                   ConstString("RGBColor"), objc_flags);
+  AddStringSummary(
+      objc_category_sp,
+      "(t=${var.top}, l=${var.left}, b=${var.bottom}, r=${var.right})",
+      ConstString("Rect"), objc_flags);
+  AddStringSummary(objc_category_sp, "{(v=${var.v}, h=${var.h})}",
+                   ConstString("Point"), objc_flags);
+  AddStringSummary(objc_category_sp,
+                   "${var.month}/${var.day}/${var.year}  ${var.hour} "
+                   ":${var.minute} :${var.second} dayOfWeek:${var.dayOfWeek}",
+                   ConstString("DateTimeRect *"), objc_flags);
+  AddStringSummary(objc_category_sp, "${var.ld.month}/${var.ld.day}/"
+                                     "${var.ld.year} ${var.ld.hour} "
+                                     ":${var.ld.minute} :${var.ld.second} "
+                                     "dayOfWeek:${var.ld.dayOfWeek}",
+                   ConstString("LongDateRect"), objc_flags);
+  AddStringSummary(objc_category_sp, "(x=${var.x}, y=${var.y})",
+                   ConstString("HIPoint"), objc_flags);
+  AddStringSummary(objc_category_sp, "origin=${var.origin} size=${var.size}",
+                   ConstString("HIRect"), objc_flags);
+
+  TypeSummaryImpl::Flags appkit_flags;
+  appkit_flags.SetCascades(true)
+      .SetSkipPointers(false)
+      .SetSkipReferences(false)
+      .SetDontShowChildren(true)
+      .SetDontShowValue(false)
+      .SetShowMembersOneLiner(false)
+      .SetHideItemNames(false);
+
+  appkit_flags.SetDontShowChildren(false);
+
 #ifndef LLDB_DISABLE_PYTHON
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSArray"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArray0"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSSingleObjectArrayI"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSArraySummaryProvider, "NSArray summary provider", ConstString("CFMutableArrayRef"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSDictionary"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("NSMutableDictionary"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSCFDictionary"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryI"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSSingleEntryDictionaryI"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<false>, "NSDictionary summary provider", ConstString("__NSDictionaryM"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFDictionaryRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDictionarySummaryProvider<true>, "NSDictionary summary provider", ConstString("CFMutableDictionaryRef"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSSet summary", ConstString("NSSet"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFSetRef summary", ConstString("CFSetRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>, "CFMutableSetRef summary", ConstString("CFMutableSetRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetI summary", ConstString("__NSSetI"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSSetM summary", ConstString("__NSSetM"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSCountedSet summary", ConstString("NSCountedSet"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "NSOrderedSet summary", ConstString("NSOrderedSet"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSOrderedSetI summary", ConstString("__NSOrderedSetI"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>, "__NSOrderedSetM summary", ConstString("__NSOrderedSetM"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSError_SummaryProvider, "NSError summary provider", ConstString("NSError"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSException_SummaryProvider, "NSException summary provider", ConstString("NSException"), appkit_flags);
-    
-    // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}", ConstString("$_lldb_typegen_nspair"), appkit_flags);
-    
-    appkit_flags.SetDontShowChildren(true);
-    
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayM"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArrayI"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSArray0"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSSingleObjectArrayI"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSArray"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("NSMutableArray"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("__NSCFArray"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFMutableArrayRef"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSArraySyntheticFrontEndCreator, "NSArray synthetic children", ConstString("CFArrayRef"), ScriptedSyntheticChildren::Flags());
-    
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryM"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSDictionaryI"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSSingleEntryDictionaryI"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("__NSCFDictionary"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSDictionary"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("NSMutableDictionary"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFDictionaryRef"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSDictionarySyntheticFrontEndCreator, "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"), ScriptedSyntheticChildren::Flags());
-    
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSErrorSyntheticFrontEndCreator, "NSError synthetic children", ConstString("NSError"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSExceptionSyntheticFrontEndCreator, "NSException synthetic children", ConstString("NSException"), ScriptedSyntheticChildren::Flags());
-    
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSSet synthetic children", ConstString("NSSet"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSSetI synthetic children", ConstString("__NSSetI"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSSetM synthetic children", ConstString("__NSSetM"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSMutableSet synthetic children", ConstString("NSMutableSet"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "NSOrderedSet synthetic children", ConstString("NSOrderedSet"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSOrderedSetI synthetic children", ConstString("__NSOrderedSetI"), ScriptedSyntheticChildren::Flags());
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator, "__NSOrderedSetM synthetic children", ConstString("__NSOrderedSetM"), ScriptedSyntheticChildren::Flags());
-    
-    AddCXXSynthetic(objc_category_sp, lldb_private::formatters::NSIndexPathSyntheticFrontEndCreator, "NSIndexPath synthetic children", ConstString("NSIndexPath"), ScriptedSyntheticChildren::Flags());
-    
-    AddCXXSummary(objc_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFBagRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("__CFBag"), appkit_flags);
-    AddCXXSummary(objc_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("const struct __CFBag"), appkit_flags);
-    AddCXXSummary(objc_category_sp,lldb_private::formatters::CFBagSummaryProvider, "CFBag summary provider", ConstString("CFMutableBagRef"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("CFBinaryHeapRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp,lldb_private::formatters::CFBinaryHeapSummaryProvider, "CFBinaryHeap summary provider", ConstString("__CFBinaryHeap"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__CFString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("CFMutableStringRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSMutableString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFConstantString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFConstantString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSCFString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSStringSummaryProvider, "NSString summary provider", ConstString("NSTaggedPointerString"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSAttributedStringSummaryProvider, "NSAttributedString summary provider", ConstString("NSAttributedString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSMutableAttributedString"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSMutableAttributedStringSummaryProvider, "NSMutableAttributedString summary provider", ConstString("NSConcreteMutableAttributedString"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSBundleSummaryProvider, "NSBundle summary provider", ConstString("NSBundle"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSData"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("_NSInlineData"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteData"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSConcreteMutableData"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("NSMutableData"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>, "NSData summary provider", ConstString("__NSCFData"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>, "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSMachPortSummaryProvider, "NSMachPort summary provider", ConstString("NSMachPort"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSNotification"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSNotificationSummaryProvider, "NSNotification summary provider", ConstString("NSConcreteNotification"), appkit_flags);
-        
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "CFNumberRef summary provider", ConstString("CFNumberRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider, "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("NSURL"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSURLSummaryProvider, "NSURL summary provider", ConstString("CFURLRef"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSDate"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSDate"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("__NSTaggedDate"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSDateSummaryProvider, "NSDate summary provider", ConstString("NSCalendarDate"), appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("NSTimeZone"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("CFTimeZoneRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider, "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags);
-    
-    // CFAbsoluteTime is actually a double rather than a pointer to an object
-    // we do not care about the numeric value, since it is probably meaningless to users
-    appkit_flags.SetDontShowValue(true);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::CFAbsoluteTimeSummaryProvider, "CFAbsoluteTime summary provider", ConstString("CFAbsoluteTime"), appkit_flags);
-    appkit_flags.SetDontShowValue(false);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSIndexSet"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider, "NSIndexSet summary provider", ConstString("NSMutableIndexSet"), appkit_flags);
-    
-    AddStringSummary(objc_category_sp,
-                     "@\"${var.month%d}/${var.day%d}/${var.year%d} ${var.hour%d}:${var.minute%d}:${var.second}\"",
-                     ConstString("CFGregorianDate"),
-                     appkit_flags);
-    
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFBitVectorRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("CFMutableBitVectorRef"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFBitVector"), appkit_flags);
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::CFBitVectorSummaryProvider, "CFBitVector summary provider", ConstString("__CFMutableBitVector"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSArraySummaryProvider,
+      "NSArray summary provider", ConstString("NSArray"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSArraySummaryProvider,
+      "NSArray summary provider", ConstString("NSMutableArray"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSArraySummaryProvider,
+      "NSArray summary provider", ConstString("__NSArrayI"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSArraySummaryProvider,
+      "NSArray summary provider", ConstString("__NSArray0"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSArraySummaryProvider,
+                "NSArray summary provider",
+                ConstString("__NSSingleObjectArrayI"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSArraySummaryProvider,
+      "NSArray summary provider", ConstString("__NSArrayM"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSArraySummaryProvider,
+      "NSArray summary provider", ConstString("__NSCFArray"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSArraySummaryProvider,
+      "NSArray summary provider", ConstString("CFArrayRef"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSArraySummaryProvider,
+                "NSArray summary provider", ConstString("CFMutableArrayRef"),
+                appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDictionarySummaryProvider<false>,
+                "NSDictionary summary provider", ConstString("NSDictionary"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDictionarySummaryProvider<false>,
+                "NSDictionary summary provider",
+                ConstString("NSMutableDictionary"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDictionarySummaryProvider<false>,
+                "NSDictionary summary provider",
+                ConstString("__NSCFDictionary"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDictionarySummaryProvider<false>,
+                "NSDictionary summary provider", ConstString("__NSDictionaryI"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDictionarySummaryProvider<false>,
+                "NSDictionary summary provider",
+                ConstString("__NSSingleEntryDictionaryI"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDictionarySummaryProvider<false>,
+                "NSDictionary summary provider", ConstString("__NSDictionaryM"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDictionarySummaryProvider<true>,
+                "NSDictionary summary provider", ConstString("CFDictionaryRef"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDictionarySummaryProvider<true>,
+                "NSDictionary summary provider",
+                ConstString("CFMutableDictionaryRef"), appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSSetSummaryProvider<false>,
+                "NSSet summary", ConstString("NSSet"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
+      "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSSetSummaryProvider<true>,
+                "CFSetRef summary", ConstString("CFSetRef"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<true>,
+      "CFMutableSetRef summary", ConstString("CFMutableSetRef"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSSetSummaryProvider<false>,
+                "__NSCFSet summary", ConstString("__NSCFSet"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSSetSummaryProvider<false>,
+                "__NSSetI summary", ConstString("__NSSetI"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSSetSummaryProvider<false>,
+                "__NSSetM summary", ConstString("__NSSetM"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
+      "NSCountedSet summary", ConstString("NSCountedSet"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
+      "NSMutableSet summary", ConstString("NSMutableSet"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
+      "NSOrderedSet summary", ConstString("NSOrderedSet"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
+      "__NSOrderedSetI summary", ConstString("__NSOrderedSetI"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSSetSummaryProvider<false>,
+      "__NSOrderedSetM summary", ConstString("__NSOrderedSetM"), appkit_flags);
+
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSError_SummaryProvider,
+      "NSError summary provider", ConstString("NSError"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSException_SummaryProvider,
+      "NSException summary provider", ConstString("NSException"), appkit_flags);
+
+  // AddSummary(appkit_category_sp, "${var.key%@} -> ${var.value%@}",
+  // ConstString("$_lldb_typegen_nspair"), appkit_flags);
+
+  appkit_flags.SetDontShowChildren(true);
+
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children", ConstString("__NSArrayM"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children", ConstString("__NSArrayI"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children", ConstString("__NSArray0"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children",
+                  ConstString("__NSSingleObjectArrayI"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children", ConstString("NSArray"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children", ConstString("NSMutableArray"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children", ConstString("__NSCFArray"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children",
+                  ConstString("CFMutableArrayRef"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSArraySyntheticFrontEndCreator,
+                  "NSArray synthetic children", ConstString("CFArrayRef"),
+                  ScriptedSyntheticChildren::Flags());
+
+  AddCXXSynthetic(
+      objc_category_sp,
+      lldb_private::formatters::NSDictionarySyntheticFrontEndCreator,
+      "NSDictionary synthetic children", ConstString("__NSDictionaryM"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp,
+      lldb_private::formatters::NSDictionarySyntheticFrontEndCreator,
+      "NSDictionary synthetic children", ConstString("__NSDictionaryI"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp,
+      lldb_private::formatters::NSDictionarySyntheticFrontEndCreator,
+      "NSDictionary synthetic children",
+      ConstString("__NSSingleEntryDictionaryI"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp,
+      lldb_private::formatters::NSDictionarySyntheticFrontEndCreator,
+      "NSDictionary synthetic children", ConstString("__NSCFDictionary"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp,
+      lldb_private::formatters::NSDictionarySyntheticFrontEndCreator,
+      "NSDictionary synthetic children", ConstString("NSDictionary"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp,
+      lldb_private::formatters::NSDictionarySyntheticFrontEndCreator,
+      "NSDictionary synthetic children", ConstString("NSMutableDictionary"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp,
+      lldb_private::formatters::NSDictionarySyntheticFrontEndCreator,
+      "NSDictionary synthetic children", ConstString("CFDictionaryRef"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp,
+      lldb_private::formatters::NSDictionarySyntheticFrontEndCreator,
+      "NSDictionary synthetic children", ConstString("CFMutableDictionaryRef"),
+      ScriptedSyntheticChildren::Flags());
+
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSErrorSyntheticFrontEndCreator,
+                  "NSError synthetic children", ConstString("NSError"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSExceptionSyntheticFrontEndCreator,
+                  "NSException synthetic children", ConstString("NSException"),
+                  ScriptedSyntheticChildren::Flags());
+
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSSetSyntheticFrontEndCreator,
+                  "NSSet synthetic children", ConstString("NSSet"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSSetSyntheticFrontEndCreator,
+                  "__NSSetI synthetic children", ConstString("__NSSetI"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSSetSyntheticFrontEndCreator,
+                  "__NSSetM synthetic children", ConstString("__NSSetM"),
+                  ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator,
+      "NSMutableSet synthetic children", ConstString("NSMutableSet"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator,
+      "NSOrderedSet synthetic children", ConstString("NSOrderedSet"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator,
+      "__NSOrderedSetI synthetic children", ConstString("__NSOrderedSetI"),
+      ScriptedSyntheticChildren::Flags());
+  AddCXXSynthetic(
+      objc_category_sp, lldb_private::formatters::NSSetSyntheticFrontEndCreator,
+      "__NSOrderedSetM synthetic children", ConstString("__NSOrderedSetM"),
+      ScriptedSyntheticChildren::Flags());
+
+  AddCXXSynthetic(objc_category_sp,
+                  lldb_private::formatters::NSIndexPathSyntheticFrontEndCreator,
+                  "NSIndexPath synthetic children", ConstString("NSIndexPath"),
+                  ScriptedSyntheticChildren::Flags());
+
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::CFBagSummaryProvider,
+      "CFBag summary provider", ConstString("CFBagRef"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFBagSummaryProvider,
+                "CFBag summary provider", ConstString("__CFBag"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFBagSummaryProvider,
+                "CFBag summary provider", ConstString("const struct __CFBag"),
+                appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::CFBagSummaryProvider,
+      "CFBag summary provider", ConstString("CFMutableBagRef"), appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFBinaryHeapSummaryProvider,
+                "CFBinaryHeap summary provider", ConstString("CFBinaryHeapRef"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFBinaryHeapSummaryProvider,
+                "CFBinaryHeap summary provider", ConstString("__CFBinaryHeap"),
+                appkit_flags);
+
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSStringSummaryProvider,
+      "NSString summary provider", ConstString("NSString"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSStringSummaryProvider,
+      "NSString summary provider", ConstString("CFStringRef"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSStringSummaryProvider,
+      "NSString summary provider", ConstString("__CFString"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSStringSummaryProvider,
+                "NSString summary provider", ConstString("CFMutableStringRef"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSStringSummaryProvider,
+                "NSString summary provider", ConstString("NSMutableString"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSStringSummaryProvider,
+                "NSString summary provider",
+                ConstString("__NSCFConstantString"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSStringSummaryProvider,
+      "NSString summary provider", ConstString("__NSCFString"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSStringSummaryProvider,
+                "NSString summary provider", ConstString("NSCFConstantString"),
+                appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSStringSummaryProvider,
+      "NSString summary provider", ConstString("NSCFString"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSStringSummaryProvider,
+      "NSString summary provider", ConstString("NSPathStore2"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSStringSummaryProvider,
+                "NSString summary provider",
+                ConstString("NSTaggedPointerString"), appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSAttributedStringSummaryProvider,
+                "NSAttributedString summary provider",
+                ConstString("NSAttributedString"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp,
+      lldb_private::formatters::NSMutableAttributedStringSummaryProvider,
+      "NSMutableAttributedString summary provider",
+      ConstString("NSMutableAttributedString"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp,
+      lldb_private::formatters::NSMutableAttributedStringSummaryProvider,
+      "NSMutableAttributedString summary provider",
+      ConstString("NSConcreteMutableAttributedString"), appkit_flags);
+
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSBundleSummaryProvider,
+      "NSBundle summary provider", ConstString("NSBundle"), appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDataSummaryProvider<false>,
+                "NSData summary provider", ConstString("NSData"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>,
+      "NSData summary provider", ConstString("_NSInlineData"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>,
+      "NSData summary provider", ConstString("NSConcreteData"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDataSummaryProvider<false>,
+                "NSData summary provider", ConstString("NSConcreteMutableData"),
+                appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>,
+      "NSData summary provider", ConstString("NSMutableData"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<false>,
+      "NSData summary provider", ConstString("__NSCFData"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>,
+      "NSData summary provider", ConstString("CFDataRef"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDataSummaryProvider<true>,
+      "NSData summary provider", ConstString("CFMutableDataRef"), appkit_flags);
+
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSMachPortSummaryProvider,
+      "NSMachPort summary provider", ConstString("NSMachPort"), appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSNotificationSummaryProvider,
+                "NSNotification summary provider",
+                ConstString("NSNotification"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSNotificationSummaryProvider,
+                "NSNotification summary provider",
+                ConstString("NSConcreteNotification"), appkit_flags);
+
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider,
+      "NSNumber summary provider", ConstString("NSNumber"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider,
+      "CFNumberRef summary provider", ConstString("CFNumberRef"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider,
+      "NSNumber summary provider", ConstString("__NSCFBoolean"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider,
+      "NSNumber summary provider", ConstString("__NSCFNumber"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider,
+      "NSNumber summary provider", ConstString("NSCFBoolean"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSNumberSummaryProvider,
+      "NSNumber summary provider", ConstString("NSCFNumber"), appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSURLSummaryProvider,
+                "NSURL summary provider", ConstString("NSURL"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSURLSummaryProvider,
+      "NSURL summary provider", ConstString("CFURLRef"), appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSDateSummaryProvider,
+                "NSDate summary provider", ConstString("NSDate"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDateSummaryProvider,
+      "NSDate summary provider", ConstString("__NSDate"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDateSummaryProvider,
+      "NSDate summary provider", ConstString("__NSTaggedDate"), appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSDateSummaryProvider,
+      "NSDate summary provider", ConstString("NSCalendarDate"), appkit_flags);
+
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider,
+      "NSTimeZone summary provider", ConstString("NSTimeZone"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSTimeZoneSummaryProvider,
+                "NSTimeZone summary provider", ConstString("CFTimeZoneRef"),
+                appkit_flags);
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSTimeZoneSummaryProvider,
+      "NSTimeZone summary provider", ConstString("__NSTimeZone"), appkit_flags);
+
+  // CFAbsoluteTime is actually a double rather than a pointer to an object
+  // we do not care about the numeric value, since it is probably meaningless to
+  // users
+  appkit_flags.SetDontShowValue(true);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFAbsoluteTimeSummaryProvider,
+                "CFAbsoluteTime summary provider",
+                ConstString("CFAbsoluteTime"), appkit_flags);
+  appkit_flags.SetDontShowValue(false);
+
+  AddCXXSummary(
+      objc_category_sp, lldb_private::formatters::NSIndexSetSummaryProvider,
+      "NSIndexSet summary provider", ConstString("NSIndexSet"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::NSIndexSetSummaryProvider,
+                "NSIndexSet summary provider", ConstString("NSMutableIndexSet"),
+                appkit_flags);
+
+  AddStringSummary(objc_category_sp,
+                   "@\"${var.month%d}/${var.day%d}/${var.year%d} "
+                   "${var.hour%d}:${var.minute%d}:${var.second}\"",
+                   ConstString("CFGregorianDate"), appkit_flags);
+
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFBitVectorSummaryProvider,
+                "CFBitVector summary provider", ConstString("CFBitVectorRef"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFBitVectorSummaryProvider,
+                "CFBitVector summary provider",
+                ConstString("CFMutableBitVectorRef"), appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFBitVectorSummaryProvider,
+                "CFBitVector summary provider", ConstString("__CFBitVector"),
+                appkit_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CFBitVectorSummaryProvider,
+                "CFBitVector summary provider",
+                ConstString("__CFMutableBitVector"), appkit_flags);
 #endif // LLDB_DISABLE_PYTHON
 }
 
-static void
-LoadCoreMediaFormatters(TypeCategoryImplSP objc_category_sp)
-{
-    if (!objc_category_sp)
-        return;
-
-    TypeSummaryImpl::Flags cm_flags;
-    cm_flags.SetCascades(true)
-    .SetDontShowChildren(false)
-    .SetDontShowValue(false)
-    .SetHideItemNames(false)
-    .SetShowMembersOneLiner(false)
-    .SetSkipPointers(false)
-    .SetSkipReferences(false);
-    
+static void LoadCoreMediaFormatters(TypeCategoryImplSP objc_category_sp) {
+  if (!objc_category_sp)
+    return;
+
+  TypeSummaryImpl::Flags cm_flags;
+  cm_flags.SetCascades(true)
+      .SetDontShowChildren(false)
+      .SetDontShowValue(false)
+      .SetHideItemNames(false)
+      .SetShowMembersOneLiner(false)
+      .SetSkipPointers(false)
+      .SetSkipReferences(false);
+
 #ifndef LLDB_DISABLE_PYTHON
-    AddCXXSummary(objc_category_sp, lldb_private::formatters::CMTimeSummaryProvider, "CMTime summary provider", ConstString("CMTime"), cm_flags);
+  AddCXXSummary(objc_category_sp,
+                lldb_private::formatters::CMTimeSummaryProvider,
+                "CMTime summary provider", ConstString("CMTime"), cm_flags);
 #endif // LLDB_DISABLE_PYTHON
 }
 
-lldb::TypeCategoryImplSP
-ObjCLanguage::GetFormatters ()
-{
-    static std::once_flag g_initialize;
-    static TypeCategoryImplSP g_category;
-    
-    std::call_once(g_initialize, [this] () -> void {
-        DataVisualization::Categories::GetCategory(GetPluginName(), g_category);
-        if (g_category)
-        {
-            LoadCoreMediaFormatters(g_category);
-            LoadObjCFormatters(g_category);
-        }
-    });
-    return g_category;
+lldb::TypeCategoryImplSP ObjCLanguage::GetFormatters() {
+  static std::once_flag g_initialize;
+  static TypeCategoryImplSP g_category;
+
+  std::call_once(g_initialize, [this]() -> void {
+    DataVisualization::Categories::GetCategory(GetPluginName(), g_category);
+    if (g_category) {
+      LoadCoreMediaFormatters(g_category);
+      LoadObjCFormatters(g_category);
+    }
+  });
+  return g_category;
 }
 
 std::vector<ConstString>
-ObjCLanguage::GetPossibleFormattersMatches (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
-{
-    std::vector<ConstString> result;
-    
-    if (use_dynamic == lldb::eNoDynamicValues)
-        return result;
-    
-    CompilerType compiler_type(valobj.GetCompilerType());
-    
-    const bool check_cpp = false;
-    const bool check_objc = true;
-    bool canBeObjCDynamic = compiler_type.IsPossibleDynamicType(nullptr, check_cpp, check_objc);
-    
-    if (canBeObjCDynamic)
-    {
-        do {
-            lldb::ProcessSP process_sp = valobj.GetProcessSP();
-            if (!process_sp)
-                break;
-            ObjCLanguageRuntime* runtime = process_sp->GetObjCLanguageRuntime();
-            if (runtime == nullptr)
-                break;
-            ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp (runtime->GetClassDescriptor(valobj));
-            if (!objc_class_sp)
-                break;
-            if (ConstString name = objc_class_sp->GetClassName())
-                result.push_back(name);
-        } while (false);
-    }
-    
+ObjCLanguage::GetPossibleFormattersMatches(ValueObject &valobj,
+                                           lldb::DynamicValueType use_dynamic) {
+  std::vector<ConstString> result;
+
+  if (use_dynamic == lldb::eNoDynamicValues)
     return result;
-}
 
-std::unique_ptr<Language::TypeScavenger>
-ObjCLanguage::GetTypeScavenger ()
-{
-    class ObjCTypeScavenger : public Language::TypeScavenger
-    {
+  CompilerType compiler_type(valobj.GetCompilerType());
+
+  const bool check_cpp = false;
+  const bool check_objc = true;
+  bool canBeObjCDynamic =
+      compiler_type.IsPossibleDynamicType(nullptr, check_cpp, check_objc);
+
+  if (canBeObjCDynamic) {
+    do {
+      lldb::ProcessSP process_sp = valobj.GetProcessSP();
+      if (!process_sp)
+        break;
+      ObjCLanguageRuntime *runtime = process_sp->GetObjCLanguageRuntime();
+      if (runtime == nullptr)
+        break;
+      ObjCLanguageRuntime::ClassDescriptorSP objc_class_sp(
+          runtime->GetClassDescriptor(valobj));
+      if (!objc_class_sp)
+        break;
+      if (ConstString name = objc_class_sp->GetClassName())
+        result.push_back(name);
+    } while (false);
+  }
+
+  return result;
+}
+
+std::unique_ptr<Language::TypeScavenger> ObjCLanguage::GetTypeScavenger() {
+  class ObjCTypeScavenger : public Language::TypeScavenger {
+  private:
+    class ObjCScavengerResult : public Language::TypeScavenger::Result {
+    public:
+      ObjCScavengerResult(CompilerType type)
+          : Language::TypeScavenger::Result(), m_compiler_type(type) {}
+
+      bool IsValid() override { return m_compiler_type.IsValid(); }
+
+      bool DumpToStream(Stream &stream, bool print_help_if_available) override {
+        if (IsValid()) {
+          m_compiler_type.DumpTypeDescription(&stream);
+          stream.EOL();
+          return true;
+        }
+        return false;
+      }
+
+      ~ObjCScavengerResult() override = default;
+
     private:
-        class ObjCScavengerResult : public Language::TypeScavenger::Result
-        {
-        public:
-            ObjCScavengerResult (CompilerType type) :
-                Language::TypeScavenger::Result(),
-                m_compiler_type(type)
-            {
-            }
-            
-            bool
-            IsValid () override
-            {
-                return m_compiler_type.IsValid();
-            }
-            
-            bool
-            DumpToStream (Stream& stream,
-                          bool print_help_if_available) override
-            {
-                if (IsValid())
-                {
-                    m_compiler_type.DumpTypeDescription(&stream);
-                    stream.EOL();
-                    return true;
-                }
-                return false;
-            }
+      CompilerType m_compiler_type;
+    };
 
-            ~ObjCScavengerResult() override = default;
+  protected:
+    ObjCTypeScavenger() = default;
 
-        private:
-            CompilerType m_compiler_type;
-        };
-        
-    protected:
-        ObjCTypeScavenger() = default;
-        
-        ~ObjCTypeScavenger() override = default;
-        
-        bool
-        Find_Impl (ExecutionContextScope *exe_scope,
-                   const char *key,
-                   ResultSet &results) override
-        {
-            bool result = false;
-            
-            Target* target = exe_scope->CalculateTarget().get();
-            if (target)
-            {
-                if (auto clang_modules_decl_vendor = target->GetClangModulesDeclVendor())
-                {
-                    std::vector <clang::NamedDecl*> decls;
-                    ConstString key_cs(key);
-                    
-                    if (clang_modules_decl_vendor->FindDecls(key_cs, false, UINT32_MAX, decls) > 0 &&
-                        !decls.empty())
-                    {
-                        CompilerType module_type = ClangASTContext::GetTypeForDecl(decls.front());
-                        result = true;
-                        std::unique_ptr<Language::TypeScavenger::Result> result(new ObjCScavengerResult(module_type));
-                        results.insert(std::move(result));
-                    }
-                }
-            }
-            
-            if (!result)
-            {
-                Process* process = exe_scope->CalculateProcess().get();
-                if (process)
-                {
-                    const bool create_on_demand = false;
-                    auto objc_runtime = process->GetObjCLanguageRuntime(create_on_demand);
-                    if (objc_runtime)
-                    {
-                        auto decl_vendor = objc_runtime->GetDeclVendor();
-                        if (decl_vendor)
-                        {
-                            std::vector<clang::NamedDecl *> decls;
-                            ConstString name(key);
-                            decl_vendor->FindDecls(name, true, UINT32_MAX, decls);
-                            for (auto decl : decls)
-                            {
-                                if (decl)
-                                {
-                                    if (CompilerType candidate = ClangASTContext::GetTypeForDecl(decl))
-                                    {
-                                        result = true;
-                                        std::unique_ptr<Language::TypeScavenger::Result> result(new ObjCScavengerResult(candidate));
-                                        results.insert(std::move(result));
-                                    }
-                                }
-                            }
-                        }
-                    }
+    ~ObjCTypeScavenger() override = default;
+
+    bool Find_Impl(ExecutionContextScope *exe_scope, const char *key,
+                   ResultSet &results) override {
+      bool result = false;
+
+      Target *target = exe_scope->CalculateTarget().get();
+      if (target) {
+        if (auto clang_modules_decl_vendor =
+                target->GetClangModulesDeclVendor()) {
+          std::vector<clang::NamedDecl *> decls;
+          ConstString key_cs(key);
+
+          if (clang_modules_decl_vendor->FindDecls(key_cs, false, UINT32_MAX,
+                                                   decls) > 0 &&
+              !decls.empty()) {
+            CompilerType module_type =
+                ClangASTContext::GetTypeForDecl(decls.front());
+            result = true;
+            std::unique_ptr<Language::TypeScavenger::Result> result(
+                new ObjCScavengerResult(module_type));
+            results.insert(std::move(result));
+          }
+        }
+      }
+
+      if (!result) {
+        Process *process = exe_scope->CalculateProcess().get();
+        if (process) {
+          const bool create_on_demand = false;
+          auto objc_runtime = process->GetObjCLanguageRuntime(create_on_demand);
+          if (objc_runtime) {
+            auto decl_vendor = objc_runtime->GetDeclVendor();
+            if (decl_vendor) {
+              std::vector<clang::NamedDecl *> decls;
+              ConstString name(key);
+              decl_vendor->FindDecls(name, true, UINT32_MAX, decls);
+              for (auto decl : decls) {
+                if (decl) {
+                  if (CompilerType candidate =
+                          ClangASTContext::GetTypeForDecl(decl)) {
+                    result = true;
+                    std::unique_ptr<Language::TypeScavenger::Result> result(
+                        new ObjCScavengerResult(candidate));
+                    results.insert(std::move(result));
+                  }
                 }
+              }
             }
-
-            return result;
+          }
         }
+      }
 
-        friend class lldb_private::ObjCLanguage;
-    };
-    
-    return std::unique_ptr<TypeScavenger>(new ObjCTypeScavenger());
+      return result;
+    }
+
+    friend class lldb_private::ObjCLanguage;
+  };
+
+  return std::unique_ptr<TypeScavenger>(new ObjCTypeScavenger());
 }
 
-bool
-ObjCLanguage::GetFormatterPrefixSuffix (ValueObject& valobj, ConstString type_hint,
-                                        std::string& prefix, std::string& suffix)
-{
-    static ConstString g_CFBag("CFBag");
-    static ConstString g_CFBinaryHeap("CFBinaryHeap");
-    
-    static ConstString g_NSNumberChar("NSNumber:char");
-    static ConstString g_NSNumberShort("NSNumber:short");
-    static ConstString g_NSNumberInt("NSNumber:int");
-    static ConstString g_NSNumberLong("NSNumber:long");
-    static ConstString g_NSNumberFloat("NSNumber:float");
-    static ConstString g_NSNumberDouble("NSNumber:double");
-    
-    static ConstString g_NSData("NSData");
-    static ConstString g_NSArray("NSArray");
-    static ConstString g_NSString("NSString");
-    static ConstString g_NSStringStar("NSString*");
-    
-    if (type_hint.IsEmpty())
-        return false;
-    
-    prefix.clear();
-    suffix.clear();
-    
-    if (type_hint == g_CFBag ||
-        type_hint == g_CFBinaryHeap)
-    {
-        prefix = "@";
-        return true;
-    }
-    
-    if (type_hint == g_NSNumberChar)
-    {
-        prefix = "(char)";
-        return true;
-    }
-    if (type_hint == g_NSNumberShort)
-    {
-        prefix = "(short)";
-        return true;
-    }
-    if (type_hint == g_NSNumberInt)
-    {
-        prefix = "(int)";
-        return true;
-    }
-    if (type_hint == g_NSNumberLong)
-    {
-        prefix = "(long)";
-        return true;
-    }
-    if (type_hint == g_NSNumberFloat)
-    {
-        prefix = "(float)";
-        return true;
-    }
-    if (type_hint == g_NSNumberDouble)
-    {
-        prefix = "(double)";
-        return true;
-    }
-    
-    if (type_hint == g_NSData ||
-        type_hint == g_NSArray)
-    {
-        prefix = "@\"";
-        suffix = "\"";
-        return true;
-    }
-    
-    if (type_hint == g_NSString ||
-        type_hint == g_NSStringStar)
-    {
-        prefix = "@";
-        return true;
-    }
-    
+bool ObjCLanguage::GetFormatterPrefixSuffix(ValueObject &valobj,
+                                            ConstString type_hint,
+                                            std::string &prefix,
+                                            std::string &suffix) {
+  static ConstString g_CFBag("CFBag");
+  static ConstString g_CFBinaryHeap("CFBinaryHeap");
+
+  static ConstString g_NSNumberChar("NSNumber:char");
+  static ConstString g_NSNumberShort("NSNumber:short");
+  static ConstString g_NSNumberInt("NSNumber:int");
+  static ConstString g_NSNumberLong("NSNumber:long");
+  static ConstString g_NSNumberFloat("NSNumber:float");
+  static ConstString g_NSNumberDouble("NSNumber:double");
+
+  static ConstString g_NSData("NSData");
+  static ConstString g_NSArray("NSArray");
+  static ConstString g_NSString("NSString");
+  static ConstString g_NSStringStar("NSString*");
+
+  if (type_hint.IsEmpty())
     return false;
-}
 
-bool
-ObjCLanguage::IsNilReference (ValueObject& valobj)
-{
-    const uint32_t mask = eTypeIsObjC | eTypeIsPointer;
-    bool isObjCpointer = (((valobj.GetCompilerType().GetTypeInfo(nullptr)) & mask) == mask);
-    if (!isObjCpointer)
-        return false;
-    bool canReadValue = true;
-    bool isZero = valobj.GetValueAsUnsigned(0,&canReadValue) == 0;
-    return canReadValue && isZero;
+  prefix.clear();
+  suffix.clear();
+
+  if (type_hint == g_CFBag || type_hint == g_CFBinaryHeap) {
+    prefix = "@";
+    return true;
+  }
+
+  if (type_hint == g_NSNumberChar) {
+    prefix = "(char)";
+    return true;
+  }
+  if (type_hint == g_NSNumberShort) {
+    prefix = "(short)";
+    return true;
+  }
+  if (type_hint == g_NSNumberInt) {
+    prefix = "(int)";
+    return true;
+  }
+  if (type_hint == g_NSNumberLong) {
+    prefix = "(long)";
+    return true;
+  }
+  if (type_hint == g_NSNumberFloat) {
+    prefix = "(float)";
+    return true;
+  }
+  if (type_hint == g_NSNumberDouble) {
+    prefix = "(double)";
+    return true;
+  }
+
+  if (type_hint == g_NSData || type_hint == g_NSArray) {
+    prefix = "@\"";
+    suffix = "\"";
+    return true;
+  }
+
+  if (type_hint == g_NSString || type_hint == g_NSStringStar) {
+    prefix = "@";
+    return true;
+  }
+
+  return false;
+}
+
+bool ObjCLanguage::IsNilReference(ValueObject &valobj) {
+  const uint32_t mask = eTypeIsObjC | eTypeIsPointer;
+  bool isObjCpointer =
+      (((valobj.GetCompilerType().GetTypeInfo(nullptr)) & mask) == mask);
+  if (!isObjCpointer)
+    return false;
+  bool canReadValue = true;
+  bool isZero = valobj.GetValueAsUnsigned(0, &canReadValue) == 0;
+  return canReadValue && isZero;
 }

Modified: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.h (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.h Tue Sep  6 15:57:50 2016
@@ -17,195 +17,143 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Core/ConstString.h"
 #include "lldb/Target/Language.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
-    
-class ObjCLanguage :
-    public Language
-{
+
+class ObjCLanguage : public Language {
 public:
-    class MethodName
-    {
-    public:
-        enum Type
-        {
-            eTypeUnspecified,
-            eTypeClassMethod,
-            eTypeInstanceMethod
-        };
-        
-        MethodName () :
-            m_full(),
-            m_class(),
-            m_category(),
-            m_selector(),
-            m_type (eTypeUnspecified),
-            m_category_is_valid (false)
-        {
-        }
-
-        MethodName (const char *name, bool strict) :
-            m_full(),
-            m_class(),
-            m_category(),
-            m_selector(),
-            m_type (eTypeUnspecified),
-            m_category_is_valid (false)
-        {
-            SetName (name, strict);
-        }
-
-        void
-        Clear();
-
-        bool
-        IsValid (bool strict) const
-        {
-            // If "strict" is true, the name must have everything specified including
-            // the leading "+" or "-" on the method name
-            if (strict && m_type == eTypeUnspecified)
-                return false;
-            // Other than that, m_full will only be filled in if the objective C
-            // name is valid.
-            return (bool)m_full;
-        }
-        
-        bool
-        HasCategory()
-        {
-            return !GetCategory().IsEmpty();
-        }
-
-        Type
-        GetType () const
-        {
-            return m_type;
-        }
-        
-        const ConstString &
-        GetFullName () const
-        {
-            return m_full;
-        }
-        
-        ConstString
-        GetFullNameWithoutCategory (bool empty_if_no_category);
-
-        bool
-        SetName (const char *name, bool strict);
-
-        const ConstString &
-        GetClassName ();
-
-        const ConstString &
-        GetClassNameWithCategory ();
-
-        const ConstString &
-        GetCategory ();
-        
-        const ConstString &
-        GetSelector ();
-
-        // Get all possible names for a method. Examples:
-        // If name is "+[NSString(my_additions) myStringWithCString:]"
-        //  names[0] => "+[NSString(my_additions) myStringWithCString:]"
-        //  names[1] => "+[NSString myStringWithCString:]"
-        // If name is specified without the leading '+' or '-' like "[NSString(my_additions) myStringWithCString:]"
-        //  names[0] => "+[NSString(my_additions) myStringWithCString:]"
-        //  names[1] => "-[NSString(my_additions) myStringWithCString:]"
-        //  names[2] => "+[NSString myStringWithCString:]"
-        //  names[3] => "-[NSString myStringWithCString:]"
-        size_t
-        GetFullNames (std::vector<ConstString> &names, bool append);
-
-    protected:
-        ConstString m_full;     // Full name:   "+[NSString(my_additions) myStringWithCString:]"
-        ConstString m_class;    // Class name:  "NSString"
-        ConstString m_class_category; // Class with category: "NSString(my_additions)"
-        ConstString m_category; // Category:    "my_additions"
-        ConstString m_selector; // Selector:    "myStringWithCString:"
-        Type m_type;
-        bool m_category_is_valid;
-    };
-
-    ObjCLanguage() = default;
-
-    ~ObjCLanguage() override = default;
-
-    lldb::LanguageType
-    GetLanguageType () const override
-    {
-        return lldb::eLanguageTypeObjC;
+  class MethodName {
+  public:
+    enum Type { eTypeUnspecified, eTypeClassMethod, eTypeInstanceMethod };
+
+    MethodName()
+        : m_full(), m_class(), m_category(), m_selector(),
+          m_type(eTypeUnspecified), m_category_is_valid(false) {}
+
+    MethodName(const char *name, bool strict)
+        : m_full(), m_class(), m_category(), m_selector(),
+          m_type(eTypeUnspecified), m_category_is_valid(false) {
+      SetName(name, strict);
     }
-    
-    lldb::TypeCategoryImplSP
-    GetFormatters () override;
-    
-    std::vector<ConstString>
-    GetPossibleFormattersMatches (ValueObject& valobj, lldb::DynamicValueType use_dynamic) override;
-    
-    std::unique_ptr<TypeScavenger>
-    GetTypeScavenger () override;
-    
-    bool
-    GetFormatterPrefixSuffix (ValueObject& valobj, ConstString type_hint,
-                              std::string& prefix, std::string& suffix) override;
-    
-    bool
-    IsNilReference (ValueObject& valobj) override;
-    
-    //------------------------------------------------------------------
-    // Static Functions
-    //------------------------------------------------------------------
-    static void
-    Initialize();
-    
-    static void
-    Terminate();
-    
-    static lldb_private::Language *
-    CreateInstance (lldb::LanguageType language);
-    
-    static lldb_private::ConstString
-    GetPluginNameStatic();
-    
-    static bool
-    IsPossibleObjCMethodName (const char *name)
-    {
-        if (!name)
-            return false;
-        bool starts_right = (name[0] == '+' || name[0] == '-') && name[1] == '[';
-        bool ends_right = (name[strlen(name) - 1] == ']');
-        return (starts_right && ends_right);
-    }
-    
-    static bool
-    IsPossibleObjCSelector (const char *name)
-    {
-        if (!name)
-            return false;
-            
-        if (strchr(name, ':') == nullptr)
-            return true;
-        else if (name[strlen(name) - 1] == ':')
-            return true;
-        else
-            return false;
+
+    void Clear();
+
+    bool IsValid(bool strict) const {
+      // If "strict" is true, the name must have everything specified including
+      // the leading "+" or "-" on the method name
+      if (strict && m_type == eTypeUnspecified)
+        return false;
+      // Other than that, m_full will only be filled in if the objective C
+      // name is valid.
+      return (bool)m_full;
     }
-    
-    //------------------------------------------------------------------
-    // PluginInterface protocol
-    //------------------------------------------------------------------
+
+    bool HasCategory() { return !GetCategory().IsEmpty(); }
+
+    Type GetType() const { return m_type; }
+
+    const ConstString &GetFullName() const { return m_full; }
+
+    ConstString GetFullNameWithoutCategory(bool empty_if_no_category);
+
+    bool SetName(const char *name, bool strict);
+
+    const ConstString &GetClassName();
+
+    const ConstString &GetClassNameWithCategory();
+
+    const ConstString &GetCategory();
+
+    const ConstString &GetSelector();
+
+    // Get all possible names for a method. Examples:
+    // If name is "+[NSString(my_additions) myStringWithCString:]"
+    //  names[0] => "+[NSString(my_additions) myStringWithCString:]"
+    //  names[1] => "+[NSString myStringWithCString:]"
+    // If name is specified without the leading '+' or '-' like
+    // "[NSString(my_additions) myStringWithCString:]"
+    //  names[0] => "+[NSString(my_additions) myStringWithCString:]"
+    //  names[1] => "-[NSString(my_additions) myStringWithCString:]"
+    //  names[2] => "+[NSString myStringWithCString:]"
+    //  names[3] => "-[NSString myStringWithCString:]"
+    size_t GetFullNames(std::vector<ConstString> &names, bool append);
+
+  protected:
+    ConstString
+        m_full; // Full name:   "+[NSString(my_additions) myStringWithCString:]"
+    ConstString m_class; // Class name:  "NSString"
     ConstString
-    GetPluginName() override;
-    
-    uint32_t
-    GetPluginVersion() override;
+        m_class_category;   // Class with category: "NSString(my_additions)"
+    ConstString m_category; // Category:    "my_additions"
+    ConstString m_selector; // Selector:    "myStringWithCString:"
+    Type m_type;
+    bool m_category_is_valid;
+  };
+
+  ObjCLanguage() = default;
+
+  ~ObjCLanguage() override = default;
+
+  lldb::LanguageType GetLanguageType() const override {
+    return lldb::eLanguageTypeObjC;
+  }
+
+  lldb::TypeCategoryImplSP GetFormatters() override;
+
+  std::vector<ConstString>
+  GetPossibleFormattersMatches(ValueObject &valobj,
+                               lldb::DynamicValueType use_dynamic) override;
+
+  std::unique_ptr<TypeScavenger> GetTypeScavenger() override;
+
+  bool GetFormatterPrefixSuffix(ValueObject &valobj, ConstString type_hint,
+                                std::string &prefix,
+                                std::string &suffix) override;
+
+  bool IsNilReference(ValueObject &valobj) override;
+
+  //------------------------------------------------------------------
+  // Static Functions
+  //------------------------------------------------------------------
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb_private::Language *CreateInstance(lldb::LanguageType language);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  static bool IsPossibleObjCMethodName(const char *name) {
+    if (!name)
+      return false;
+    bool starts_right = (name[0] == '+' || name[0] == '-') && name[1] == '[';
+    bool ends_right = (name[strlen(name) - 1] == ']');
+    return (starts_right && ends_right);
+  }
+
+  static bool IsPossibleObjCSelector(const char *name) {
+    if (!name)
+      return false;
+
+    if (strchr(name, ':') == nullptr)
+      return true;
+    else if (name[strlen(name) - 1] == ':')
+      return true;
+    else
+      return false;
+  }
+
+  //------------------------------------------------------------------
+  // PluginInterface protocol
+  //------------------------------------------------------------------
+  ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_ObjCLanguage_h_

Modified: lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ObjCPlusPlusLanguage.cpp --------------------------------------*- C++ -*-===//
+//===-- ObjCPlusPlusLanguage.cpp --------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,54 +16,37 @@
 using namespace lldb;
 using namespace lldb_private;
 
-void
-ObjCPlusPlusLanguage::Initialize()
-{
-    PluginManager::RegisterPlugin (GetPluginNameStatic(),
-                                   "Objective-C++ Language",
-                                   CreateInstance);
+void ObjCPlusPlusLanguage::Initialize() {
+  PluginManager::RegisterPlugin(GetPluginNameStatic(), "Objective-C++ Language",
+                                CreateInstance);
 }
 
-void
-ObjCPlusPlusLanguage::Terminate()
-{
-    PluginManager::UnregisterPlugin (CreateInstance);
+void ObjCPlusPlusLanguage::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
 }
 
-lldb_private::ConstString
-ObjCPlusPlusLanguage::GetPluginNameStatic()
-{
-    static ConstString g_name("objcplusplus");
-    return g_name;
+lldb_private::ConstString ObjCPlusPlusLanguage::GetPluginNameStatic() {
+  static ConstString g_name("objcplusplus");
+  return g_name;
 }
 
-
 //------------------------------------------------------------------
 // PluginInterface protocol
 //------------------------------------------------------------------
-lldb_private::ConstString
-ObjCPlusPlusLanguage::GetPluginName()
-{
-    return GetPluginNameStatic();
+lldb_private::ConstString ObjCPlusPlusLanguage::GetPluginName() {
+  return GetPluginNameStatic();
 }
 
-uint32_t
-ObjCPlusPlusLanguage::GetPluginVersion()
-{
-    return 1;
-}
+uint32_t ObjCPlusPlusLanguage::GetPluginVersion() { return 1; }
 
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
-Language *
-ObjCPlusPlusLanguage::CreateInstance (lldb::LanguageType language)
-{
-    switch (language)
-    {
-        case lldb::eLanguageTypeObjC_plus_plus:
-            return new ObjCPlusPlusLanguage();
-        default:
-            return nullptr;
-    }
+Language *ObjCPlusPlusLanguage::CreateInstance(lldb::LanguageType language) {
+  switch (language) {
+  case lldb::eLanguageTypeObjC_plus_plus:
+    return new ObjCPlusPlusLanguage();
+  default:
+    return nullptr;
+  }
 }

Modified: lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h (original)
+++ lldb/trunk/source/Plugins/Language/ObjCPlusPlus/ObjCPlusPlusLanguage.h Tue Sep  6 15:57:50 2016
@@ -14,50 +14,40 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Target/Language.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
-    
-class ObjCPlusPlusLanguage :
-    public Language
-{
+
+class ObjCPlusPlusLanguage : public Language {
 public:
-    ObjCPlusPlusLanguage() = default;
+  ObjCPlusPlusLanguage() = default;
+
+  ~ObjCPlusPlusLanguage() override = default;
+
+  lldb::LanguageType GetLanguageType() const override {
+    return lldb::eLanguageTypeObjC_plus_plus;
+  }
 
-    ~ObjCPlusPlusLanguage() override = default;
+  //------------------------------------------------------------------
+  // Static Functions
+  //------------------------------------------------------------------
+  static void Initialize();
 
-    lldb::LanguageType
-    GetLanguageType() const override
-    {
-        return lldb::eLanguageTypeObjC_plus_plus;
-    }
-    
-    //------------------------------------------------------------------
-    // Static Functions
-    //------------------------------------------------------------------
-    static void
-    Initialize();
-    
-    static void
-    Terminate();
-    
-    static lldb_private::Language *
-    CreateInstance (lldb::LanguageType language);
-    
-    static lldb_private::ConstString
-    GetPluginNameStatic();
-    
-    //------------------------------------------------------------------
-    // PluginInterface protocol
-    //------------------------------------------------------------------
-    ConstString
-    GetPluginName() override;
-    
-    uint32_t
-    GetPluginVersion() override;
+  static void Terminate();
+
+  static lldb_private::Language *CreateInstance(lldb::LanguageType language);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  //------------------------------------------------------------------
+  // PluginInterface protocol
+  //------------------------------------------------------------------
+  ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_CPlusPlusLanguage_h_

Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ItaniumABILanguageRuntime.cpp --------------------------------------*- C++ -*-===//
+//===-- ItaniumABILanguageRuntime.cpp --------------------------------------*-
+//C++ -*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -40,579 +41,535 @@ using namespace lldb_private;
 
 static const char *vtable_demangled_prefix = "vtable for ";
 
-bool
-ItaniumABILanguageRuntime::CouldHaveDynamicValue (ValueObject &in_value)
-{
-    const bool check_cxx = true;
-    const bool check_objc = false;
-    return in_value.GetCompilerType().IsPossibleDynamicType (NULL, check_cxx, check_objc);
-}
-
-TypeAndOrName
-ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(ValueObject &in_value, lldb::addr_t original_ptr,
-                                                        lldb::addr_t vtable_load_addr)
-{
-    if (m_process && vtable_load_addr != LLDB_INVALID_ADDRESS)
-    {
-        // Find the symbol that contains the "vtable_load_addr" address
-        Address vtable_addr;
-        Target &target = m_process->GetTarget();
-        if (!target.GetSectionLoadList().IsEmpty())
-        {
-            if (target.GetSectionLoadList().ResolveLoadAddress(vtable_load_addr, vtable_addr))
-            {
-                // See if we have cached info for this type already
-                TypeAndOrName type_info = GetDynamicTypeInfo(vtable_addr);
-                if (type_info)
-                    return type_info;
-
-                SymbolContext sc;
-                target.GetImages().ResolveSymbolContextForAddress(vtable_addr, eSymbolContextSymbol, sc);
-                Symbol *symbol = sc.symbol;
-                if (symbol != NULL)
-                {
-                    const char *name = symbol->GetMangled().GetDemangledName(lldb::eLanguageTypeC_plus_plus).AsCString();
-                    if (name && strstr(name, vtable_demangled_prefix) == name)
-                    {
-                        Log *log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
-                        if (log)
-                            log->Printf ("0x%16.16" PRIx64 ": static-type = '%s' has vtable symbol '%s'\n",
-                                         original_ptr,
-                                         in_value.GetTypeName().GetCString(),
-                                         name);
-                        // We are a C++ class, that's good.  Get the class name and look it up:
-                        const char *class_name = name + strlen(vtable_demangled_prefix);
-                        type_info.SetName(class_name);
-                        const bool exact_match = true;
-                        TypeList class_types;
-
-                        uint32_t num_matches = 0;
-                        // First look in the module that the vtable symbol came from
-                        // and look for a single exact match.
-                        llvm::DenseSet<SymbolFile *> searched_symbol_files;
-                        if (sc.module_sp)
-                        {
-                            num_matches = sc.module_sp->FindTypes (sc,
-                                                                   ConstString(class_name),
-                                                                   exact_match,
-                                                                   1,
-                                                                   searched_symbol_files,
-                                                                   class_types);
-                        }
-
-                        // If we didn't find a symbol, then move on to the entire
-                        // module list in the target and get as many unique matches
-                        // as possible
-                        if (num_matches == 0)
-                        {
-                            num_matches = target.GetImages().FindTypes(sc, ConstString(class_name), exact_match,
-                                                                       UINT32_MAX, searched_symbol_files, class_types);
-                        }
-
-                        lldb::TypeSP type_sp;
-                        if (num_matches == 0)
-                        {
-                            if (log)
-                                log->Printf("0x%16.16" PRIx64 ": is not dynamic\n", original_ptr);
-                            return TypeAndOrName();
-                        }
-                        if (num_matches == 1)
-                        {
-                            type_sp = class_types.GetTypeAtIndex(0);
-                            if (type_sp)
-                            {
-                                if (ClangASTContext::IsCXXClassType(type_sp->GetForwardCompilerType()))
-                                {
-                                    if (log)
-                                        log->Printf("0x%16.16" PRIx64
-                                                    ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
-                                                    "}, type-name='%s'\n",
-                                                    original_ptr, in_value.GetTypeName().AsCString(), type_sp->GetID(),
-                                                    type_sp->GetName().GetCString());
-                                    type_info.SetTypeSP(type_sp);
-                                }
-                            }
-                        }
-                        else if (num_matches > 1)
-                        {
-                            size_t i;
-                            if (log)
-                            {
-                                for (i = 0; i < num_matches; i++)
-                                {
-                                    type_sp = class_types.GetTypeAtIndex(i);
-                                    if (type_sp)
-                                    {
-                                        if (log)
-                                            log->Printf ("0x%16.16" PRIx64 ": static-type = '%s' has multiple matching dynamic types: uid={0x%" PRIx64 "}, type-name='%s'\n",
-                                                         original_ptr,
-                                                         in_value.GetTypeName().AsCString(),
-                                                         type_sp->GetID(),
-                                                         type_sp->GetName().GetCString());
-                                    }
-                                }
-                            }
-
-                            for (i = 0; i < num_matches; i++)
-                            {
-                                type_sp = class_types.GetTypeAtIndex(i);
-                                if (type_sp)
-                                {
-                                    if (ClangASTContext::IsCXXClassType(type_sp->GetForwardCompilerType()))
-                                    {
-                                        if (log)
-                                            log->Printf ("0x%16.16" PRIx64 ": static-type = '%s' has multiple matching dynamic types, picking this one: uid={0x%" PRIx64 "}, type-name='%s'\n",
-                                                         original_ptr,
-                                                         in_value.GetTypeName().AsCString(),
-                                                         type_sp->GetID(),
-                                                         type_sp->GetName().GetCString());
-                                        type_info.SetTypeSP(type_sp);
-                                    }
-                                }
-                            }
-
-                            if (log && i == num_matches)
-                            {
-                                log->Printf("0x%16.16" PRIx64 ": static-type = '%s' has multiple matching dynamic "
-                                                              "types, didn't find a C++ match\n",
-                                            original_ptr, in_value.GetTypeName().AsCString());
-                            }
-                        }
-                        if (type_info)
-                            SetDynamicTypeInfo(vtable_addr, type_info);
-                        return type_info;
-                    }
-                }
-            }
-        }
-    }
-    return TypeAndOrName();
+bool ItaniumABILanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
+  const bool check_cxx = true;
+  const bool check_objc = false;
+  return in_value.GetCompilerType().IsPossibleDynamicType(NULL, check_cxx,
+                                                          check_objc);
 }
 
-bool
-ItaniumABILanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
-                                                    TypeAndOrName &class_type_or_name, Address &dynamic_address,
-                                                    Value::ValueType &value_type)
-{
-    // For Itanium, if the type has a vtable pointer in the object, it will be at offset 0
-    // in the object.  That will point to the "address point" within the vtable (not the beginning of the
-    // vtable.)  We can then look up the symbol containing this "address point" and that symbol's name
-    // demangled will contain the full class name.
-    // The second pointer above the "address point" is the "offset_to_top".  We'll use that to get the
-    // start of the value object which holds the dynamic type.
-    //
-
-    class_type_or_name.Clear();
-    value_type = Value::ValueType::eValueTypeScalar;
-
-    // Only a pointer or reference type can have a different dynamic and static type:
-    if (CouldHaveDynamicValue(in_value))
-    {
-        // First job, pull out the address at 0 offset from the object.
-        AddressType address_type;
-        lldb::addr_t original_ptr = in_value.GetPointerValue(&address_type);
-        if (original_ptr == LLDB_INVALID_ADDRESS)
-            return false;
-
-        ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
-
-        Process *process = exe_ctx.GetProcessPtr();
-
-        if (process == nullptr)
-            return false;
-
-        Error error;
-        const lldb::addr_t vtable_address_point = process->ReadPointerFromMemory(original_ptr, error);
-
-        if (!error.Success() || vtable_address_point == LLDB_INVALID_ADDRESS)
-        {
-            return false;
-        }
+TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
+    ValueObject &in_value, lldb::addr_t original_ptr,
+    lldb::addr_t vtable_load_addr) {
+  if (m_process && vtable_load_addr != LLDB_INVALID_ADDRESS) {
+    // Find the symbol that contains the "vtable_load_addr" address
+    Address vtable_addr;
+    Target &target = m_process->GetTarget();
+    if (!target.GetSectionLoadList().IsEmpty()) {
+      if (target.GetSectionLoadList().ResolveLoadAddress(vtable_load_addr,
+                                                         vtable_addr)) {
+        // See if we have cached info for this type already
+        TypeAndOrName type_info = GetDynamicTypeInfo(vtable_addr);
+        if (type_info)
+          return type_info;
+
+        SymbolContext sc;
+        target.GetImages().ResolveSymbolContextForAddress(
+            vtable_addr, eSymbolContextSymbol, sc);
+        Symbol *symbol = sc.symbol;
+        if (symbol != NULL) {
+          const char *name =
+              symbol->GetMangled()
+                  .GetDemangledName(lldb::eLanguageTypeC_plus_plus)
+                  .AsCString();
+          if (name && strstr(name, vtable_demangled_prefix) == name) {
+            Log *log(
+                lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
+            if (log)
+              log->Printf("0x%16.16" PRIx64
+                          ": static-type = '%s' has vtable symbol '%s'\n",
+                          original_ptr, in_value.GetTypeName().GetCString(),
+                          name);
+            // We are a C++ class, that's good.  Get the class name and look it
+            // up:
+            const char *class_name = name + strlen(vtable_demangled_prefix);
+            type_info.SetName(class_name);
+            const bool exact_match = true;
+            TypeList class_types;
+
+            uint32_t num_matches = 0;
+            // First look in the module that the vtable symbol came from
+            // and look for a single exact match.
+            llvm::DenseSet<SymbolFile *> searched_symbol_files;
+            if (sc.module_sp) {
+              num_matches = sc.module_sp->FindTypes(
+                  sc, ConstString(class_name), exact_match, 1,
+                  searched_symbol_files, class_types);
+            }
 
-        class_type_or_name = GetTypeInfoFromVTableAddress(in_value, original_ptr, vtable_address_point);
+            // If we didn't find a symbol, then move on to the entire
+            // module list in the target and get as many unique matches
+            // as possible
+            if (num_matches == 0) {
+              num_matches = target.GetImages().FindTypes(
+                  sc, ConstString(class_name), exact_match, UINT32_MAX,
+                  searched_symbol_files, class_types);
+            }
 
-        if (class_type_or_name)
-        {
-            TypeSP type_sp = class_type_or_name.GetTypeSP();
-            // There can only be one type with a given name,
-            // so we've just found duplicate definitions, and this
-            // one will do as well as any other.
-            // We don't consider something to have a dynamic type if
-            // it is the same as the static type.  So compare against
-            // the value we were handed.
-            if (type_sp)
-            {
-                if (ClangASTContext::AreTypesSame(in_value.GetCompilerType(), type_sp->GetForwardCompilerType()))
-                {
-                    // The dynamic type we found was the same type,
-                    // so we don't have a dynamic type here...
-                    return false;
+            lldb::TypeSP type_sp;
+            if (num_matches == 0) {
+              if (log)
+                log->Printf("0x%16.16" PRIx64 ": is not dynamic\n",
+                            original_ptr);
+              return TypeAndOrName();
+            }
+            if (num_matches == 1) {
+              type_sp = class_types.GetTypeAtIndex(0);
+              if (type_sp) {
+                if (ClangASTContext::IsCXXClassType(
+                        type_sp->GetForwardCompilerType())) {
+                  if (log)
+                    log->Printf(
+                        "0x%16.16" PRIx64
+                        ": static-type = '%s' has dynamic type: uid={0x%" PRIx64
+                        "}, type-name='%s'\n",
+                        original_ptr, in_value.GetTypeName().AsCString(),
+                        type_sp->GetID(), type_sp->GetName().GetCString());
+                  type_info.SetTypeSP(type_sp);
+                }
+              }
+            } else if (num_matches > 1) {
+              size_t i;
+              if (log) {
+                for (i = 0; i < num_matches; i++) {
+                  type_sp = class_types.GetTypeAtIndex(i);
+                  if (type_sp) {
+                    if (log)
+                      log->Printf(
+                          "0x%16.16" PRIx64
+                          ": static-type = '%s' has multiple matching dynamic "
+                          "types: uid={0x%" PRIx64 "}, type-name='%s'\n",
+                          original_ptr, in_value.GetTypeName().AsCString(),
+                          type_sp->GetID(), type_sp->GetName().GetCString());
+                  }
                 }
+              }
 
-                // The offset_to_top is two pointers above the vtable pointer.
-                const uint32_t addr_byte_size = process->GetAddressByteSize();
-                const lldb::addr_t offset_to_top_location = vtable_address_point - 2 * addr_byte_size;
-                // Watch for underflow, offset_to_top_location should be less than vtable_address_point
-                if (offset_to_top_location >= vtable_address_point)
-                    return false;
-                const int64_t offset_to_top =
-                    process->ReadSignedIntegerFromMemory(offset_to_top_location, addr_byte_size, INT64_MIN, error);
-
-                if (offset_to_top == INT64_MIN)
-                    return false;
-                // So the dynamic type is a value that starts at offset_to_top
-                // above the original address.
-                lldb::addr_t dynamic_addr = original_ptr + offset_to_top;
-                if (!process->GetTarget().GetSectionLoadList().ResolveLoadAddress(dynamic_addr, dynamic_address))
-                {
-                    dynamic_address.SetRawAddress(dynamic_addr);
+              for (i = 0; i < num_matches; i++) {
+                type_sp = class_types.GetTypeAtIndex(i);
+                if (type_sp) {
+                  if (ClangASTContext::IsCXXClassType(
+                          type_sp->GetForwardCompilerType())) {
+                    if (log)
+                      log->Printf(
+                          "0x%16.16" PRIx64 ": static-type = '%s' has multiple "
+                                            "matching dynamic types, picking "
+                                            "this one: uid={0x%" PRIx64
+                          "}, type-name='%s'\n",
+                          original_ptr, in_value.GetTypeName().AsCString(),
+                          type_sp->GetID(), type_sp->GetName().GetCString());
+                    type_info.SetTypeSP(type_sp);
+                  }
                 }
-                return true;
+              }
+
+              if (log && i == num_matches) {
+                log->Printf(
+                    "0x%16.16" PRIx64
+                    ": static-type = '%s' has multiple matching dynamic "
+                    "types, didn't find a C++ match\n",
+                    original_ptr, in_value.GetTypeName().AsCString());
+              }
             }
+            if (type_info)
+              SetDynamicTypeInfo(vtable_addr, type_info);
+            return type_info;
+          }
         }
+      }
     }
-
-    return class_type_or_name.IsEmpty() == false;
+  }
+  return TypeAndOrName();
 }
 
-TypeAndOrName
-ItaniumABILanguageRuntime::FixUpDynamicType(const TypeAndOrName& type_and_or_name,
-                                            ValueObject& static_value)
-{
-    CompilerType static_type(static_value.GetCompilerType());
-    Flags static_type_flags(static_type.GetTypeInfo());
-    
-    TypeAndOrName ret(type_and_or_name);
-    if (type_and_or_name.HasType())
-    {
-        // The type will always be the type of the dynamic object.  If our parent's type was a pointer,
-        // then our type should be a pointer to the type of the dynamic object.  If a reference, then the original type
-        // should be okay...
-        CompilerType orig_type = type_and_or_name.GetCompilerType();
-        CompilerType corrected_type = orig_type;
-        if (static_type_flags.AllSet(eTypeIsPointer))
-            corrected_type = orig_type.GetPointerType ();
-        else if (static_type_flags.AllSet(eTypeIsReference))
-            corrected_type = orig_type.GetLValueReferenceType();
-        ret.SetCompilerType(corrected_type);
-    }
-    else
-    {
-        // If we are here we need to adjust our dynamic type name to include the correct & or * symbol
-        std::string corrected_name (type_and_or_name.GetName().GetCString());
-        if (static_type_flags.AllSet(eTypeIsPointer))
-            corrected_name.append(" *");
-        else if (static_type_flags.AllSet(eTypeIsReference))
-            corrected_name.append(" &");
-        // the parent type should be a correctly pointer'ed or referenc'ed type
-        ret.SetCompilerType(static_type);
-        ret.SetName(corrected_name.c_str());
+bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress(
+    ValueObject &in_value, lldb::DynamicValueType use_dynamic,
+    TypeAndOrName &class_type_or_name, Address &dynamic_address,
+    Value::ValueType &value_type) {
+  // For Itanium, if the type has a vtable pointer in the object, it will be at
+  // offset 0
+  // in the object.  That will point to the "address point" within the vtable
+  // (not the beginning of the
+  // vtable.)  We can then look up the symbol containing this "address point"
+  // and that symbol's name
+  // demangled will contain the full class name.
+  // The second pointer above the "address point" is the "offset_to_top".  We'll
+  // use that to get the
+  // start of the value object which holds the dynamic type.
+  //
+
+  class_type_or_name.Clear();
+  value_type = Value::ValueType::eValueTypeScalar;
+
+  // Only a pointer or reference type can have a different dynamic and static
+  // type:
+  if (CouldHaveDynamicValue(in_value)) {
+    // First job, pull out the address at 0 offset from the object.
+    AddressType address_type;
+    lldb::addr_t original_ptr = in_value.GetPointerValue(&address_type);
+    if (original_ptr == LLDB_INVALID_ADDRESS)
+      return false;
+
+    ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
+
+    Process *process = exe_ctx.GetProcessPtr();
+
+    if (process == nullptr)
+      return false;
+
+    Error error;
+    const lldb::addr_t vtable_address_point =
+        process->ReadPointerFromMemory(original_ptr, error);
+
+    if (!error.Success() || vtable_address_point == LLDB_INVALID_ADDRESS) {
+      return false;
+    }
+
+    class_type_or_name = GetTypeInfoFromVTableAddress(in_value, original_ptr,
+                                                      vtable_address_point);
+
+    if (class_type_or_name) {
+      TypeSP type_sp = class_type_or_name.GetTypeSP();
+      // There can only be one type with a given name,
+      // so we've just found duplicate definitions, and this
+      // one will do as well as any other.
+      // We don't consider something to have a dynamic type if
+      // it is the same as the static type.  So compare against
+      // the value we were handed.
+      if (type_sp) {
+        if (ClangASTContext::AreTypesSame(in_value.GetCompilerType(),
+                                          type_sp->GetForwardCompilerType())) {
+          // The dynamic type we found was the same type,
+          // so we don't have a dynamic type here...
+          return false;
+        }
+
+        // The offset_to_top is two pointers above the vtable pointer.
+        const uint32_t addr_byte_size = process->GetAddressByteSize();
+        const lldb::addr_t offset_to_top_location =
+            vtable_address_point - 2 * addr_byte_size;
+        // Watch for underflow, offset_to_top_location should be less than
+        // vtable_address_point
+        if (offset_to_top_location >= vtable_address_point)
+          return false;
+        const int64_t offset_to_top = process->ReadSignedIntegerFromMemory(
+            offset_to_top_location, addr_byte_size, INT64_MIN, error);
+
+        if (offset_to_top == INT64_MIN)
+          return false;
+        // So the dynamic type is a value that starts at offset_to_top
+        // above the original address.
+        lldb::addr_t dynamic_addr = original_ptr + offset_to_top;
+        if (!process->GetTarget().GetSectionLoadList().ResolveLoadAddress(
+                dynamic_addr, dynamic_address)) {
+          dynamic_address.SetRawAddress(dynamic_addr);
+        }
+        return true;
+      }
     }
-    return ret;
+  }
+
+  return class_type_or_name.IsEmpty() == false;
 }
 
-bool
-ItaniumABILanguageRuntime::IsVTableName (const char *name)
-{
-    if (name == NULL)
-        return false;
-        
-    // Can we maybe ask Clang about this?
-    if (strstr (name, "_vptr$") == name)
-        return true;
-    else
-        return false;
+TypeAndOrName ItaniumABILanguageRuntime::FixUpDynamicType(
+    const TypeAndOrName &type_and_or_name, ValueObject &static_value) {
+  CompilerType static_type(static_value.GetCompilerType());
+  Flags static_type_flags(static_type.GetTypeInfo());
+
+  TypeAndOrName ret(type_and_or_name);
+  if (type_and_or_name.HasType()) {
+    // The type will always be the type of the dynamic object.  If our parent's
+    // type was a pointer,
+    // then our type should be a pointer to the type of the dynamic object.  If
+    // a reference, then the original type
+    // should be okay...
+    CompilerType orig_type = type_and_or_name.GetCompilerType();
+    CompilerType corrected_type = orig_type;
+    if (static_type_flags.AllSet(eTypeIsPointer))
+      corrected_type = orig_type.GetPointerType();
+    else if (static_type_flags.AllSet(eTypeIsReference))
+      corrected_type = orig_type.GetLValueReferenceType();
+    ret.SetCompilerType(corrected_type);
+  } else {
+    // If we are here we need to adjust our dynamic type name to include the
+    // correct & or * symbol
+    std::string corrected_name(type_and_or_name.GetName().GetCString());
+    if (static_type_flags.AllSet(eTypeIsPointer))
+      corrected_name.append(" *");
+    else if (static_type_flags.AllSet(eTypeIsReference))
+      corrected_name.append(" &");
+    // the parent type should be a correctly pointer'ed or referenc'ed type
+    ret.SetCompilerType(static_type);
+    ret.SetName(corrected_name.c_str());
+  }
+  return ret;
+}
+
+bool ItaniumABILanguageRuntime::IsVTableName(const char *name) {
+  if (name == NULL)
+    return false;
+
+  // Can we maybe ask Clang about this?
+  if (strstr(name, "_vptr$") == name)
+    return true;
+  else
+    return false;
 }
 
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
 LanguageRuntime *
-ItaniumABILanguageRuntime::CreateInstance (Process *process, lldb::LanguageType language)
-{
-    // FIXME: We have to check the process and make sure we actually know that this process supports
-    // the Itanium ABI.
-    if (language == eLanguageTypeC_plus_plus ||
-        language == eLanguageTypeC_plus_plus_03 ||
-        language == eLanguageTypeC_plus_plus_11 ||
-        language == eLanguageTypeC_plus_plus_14)
-        return new ItaniumABILanguageRuntime (process);
-    else
-        return NULL;
+ItaniumABILanguageRuntime::CreateInstance(Process *process,
+                                          lldb::LanguageType language) {
+  // FIXME: We have to check the process and make sure we actually know that
+  // this process supports
+  // the Itanium ABI.
+  if (language == eLanguageTypeC_plus_plus ||
+      language == eLanguageTypeC_plus_plus_03 ||
+      language == eLanguageTypeC_plus_plus_11 ||
+      language == eLanguageTypeC_plus_plus_14)
+    return new ItaniumABILanguageRuntime(process);
+  else
+    return NULL;
 }
 
-class CommandObjectMultiwordItaniumABI_Demangle : public CommandObjectParsed
-{
+class CommandObjectMultiwordItaniumABI_Demangle : public CommandObjectParsed {
 public:
-    CommandObjectMultiwordItaniumABI_Demangle (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "demangle",
-                         "Demangle a C++ mangled name.",
-                         "language cplusplus demangle")
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData index_arg;
-        
-        // Define the first (and only) variant of this arg.
-        index_arg.arg_type = eArgTypeSymbol;
-        index_arg.arg_repetition = eArgRepeatPlus;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (index_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-    
-    ~CommandObjectMultiwordItaniumABI_Demangle() override = default;
-    
+  CommandObjectMultiwordItaniumABI_Demangle(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "demangle",
+                            "Demangle a C++ mangled name.",
+                            "language cplusplus demangle") {
+    CommandArgumentEntry arg;
+    CommandArgumentData index_arg;
+
+    // Define the first (and only) variant of this arg.
+    index_arg.arg_type = eArgTypeSymbol;
+    index_arg.arg_repetition = eArgRepeatPlus;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(index_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectMultiwordItaniumABI_Demangle() override = default;
+
 protected:
-    bool
-    DoExecute(Args& command, CommandReturnObject &result) override
-    {
-        bool demangled_any = false;
-        bool error_any = false;
-        for (size_t i = 0; i < command.GetArgumentCount(); i++)
-        {
-            auto arg = command.GetArgumentAtIndex(i);
-            if (arg && *arg)
-            {
-                ConstString mangled_cs(arg);
-                
-                // the actual Mangled class should be strict about this, but on the command line
-                // if you're copying mangled names out of 'nm' on Darwin, they will come out with
-                // an extra underscore - be willing to strip this on behalf of the user
-                // This is the moral equivalent of the -_/-n options to c++filt
-                if (mangled_cs.GetStringRef().startswith("__Z"))
-                    mangled_cs.SetCString(arg+1);
-                
-                Mangled mangled(mangled_cs, true);
-                if (mangled.GuessLanguage() == lldb::eLanguageTypeC_plus_plus)
-                {
-                    ConstString demangled(mangled.GetDisplayDemangledName(lldb::eLanguageTypeC_plus_plus));
-                    demangled_any = true;
-                    result.AppendMessageWithFormat("%s ---> %s\n", arg, demangled.GetCString());
-                }
-                else
-                {
-                    error_any = true;
-                    result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n", arg);
-                }
-            }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    bool demangled_any = false;
+    bool error_any = false;
+    for (size_t i = 0; i < command.GetArgumentCount(); i++) {
+      auto arg = command.GetArgumentAtIndex(i);
+      if (arg && *arg) {
+        ConstString mangled_cs(arg);
+
+        // the actual Mangled class should be strict about this, but on the
+        // command line
+        // if you're copying mangled names out of 'nm' on Darwin, they will come
+        // out with
+        // an extra underscore - be willing to strip this on behalf of the user
+        // This is the moral equivalent of the -_/-n options to c++filt
+        if (mangled_cs.GetStringRef().startswith("__Z"))
+          mangled_cs.SetCString(arg + 1);
+
+        Mangled mangled(mangled_cs, true);
+        if (mangled.GuessLanguage() == lldb::eLanguageTypeC_plus_plus) {
+          ConstString demangled(
+              mangled.GetDisplayDemangledName(lldb::eLanguageTypeC_plus_plus));
+          demangled_any = true;
+          result.AppendMessageWithFormat("%s ---> %s\n", arg,
+                                         demangled.GetCString());
+        } else {
+          error_any = true;
+          result.AppendErrorWithFormat("%s is not a valid C++ mangled name\n",
+                                       arg);
         }
-        
-        result.SetStatus(error_any ? lldb::eReturnStatusFailed :
-                         (demangled_any ? lldb::eReturnStatusSuccessFinishResult : lldb::eReturnStatusSuccessFinishNoResult));
-        return result.Succeeded();
+      }
     }
+
+    result.SetStatus(
+        error_any ? lldb::eReturnStatusFailed
+                  : (demangled_any ? lldb::eReturnStatusSuccessFinishResult
+                                   : lldb::eReturnStatusSuccessFinishNoResult));
+    return result.Succeeded();
+  }
 };
 
-class CommandObjectMultiwordItaniumABI : public CommandObjectMultiword
-{
+class CommandObjectMultiwordItaniumABI : public CommandObjectMultiword {
 public:
-    CommandObjectMultiwordItaniumABI(CommandInterpreter &interpreter)
-        : CommandObjectMultiword(interpreter, "cplusplus", "Commands for operating on the C++ language runtime.",
-                                 "cplusplus <subcommand> [<subcommand-options>]")
-    {
-        LoadSubCommand ("demangle",   CommandObjectSP (new CommandObjectMultiwordItaniumABI_Demangle (interpreter)));
-    }
-    
-    ~CommandObjectMultiwordItaniumABI() override = default;
+  CommandObjectMultiwordItaniumABI(CommandInterpreter &interpreter)
+      : CommandObjectMultiword(
+            interpreter, "cplusplus",
+            "Commands for operating on the C++ language runtime.",
+            "cplusplus <subcommand> [<subcommand-options>]") {
+    LoadSubCommand(
+        "demangle",
+        CommandObjectSP(
+            new CommandObjectMultiwordItaniumABI_Demangle(interpreter)));
+  }
+
+  ~CommandObjectMultiwordItaniumABI() override = default;
 };
 
-void
-ItaniumABILanguageRuntime::Initialize()
-{
-    PluginManager::RegisterPlugin (GetPluginNameStatic(),
-                                   "Itanium ABI for the C++ language",
-                                   CreateInstance,
-                                   [] (CommandInterpreter& interpreter) -> lldb::CommandObjectSP {
-                                       return CommandObjectSP(new CommandObjectMultiwordItaniumABI(interpreter));
-                                   });
-}
-
-void
-ItaniumABILanguageRuntime::Terminate()
-{
-    PluginManager::UnregisterPlugin (CreateInstance);
-}
-
-lldb_private::ConstString
-ItaniumABILanguageRuntime::GetPluginNameStatic()
-{
-    static ConstString g_name("itanium");
-    return g_name;
+void ItaniumABILanguageRuntime::Initialize() {
+  PluginManager::RegisterPlugin(
+      GetPluginNameStatic(), "Itanium ABI for the C++ language", CreateInstance,
+      [](CommandInterpreter &interpreter) -> lldb::CommandObjectSP {
+        return CommandObjectSP(
+            new CommandObjectMultiwordItaniumABI(interpreter));
+      });
+}
+
+void ItaniumABILanguageRuntime::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+lldb_private::ConstString ItaniumABILanguageRuntime::GetPluginNameStatic() {
+  static ConstString g_name("itanium");
+  return g_name;
 }
 
 //------------------------------------------------------------------
 // PluginInterface protocol
 //------------------------------------------------------------------
-lldb_private::ConstString
-ItaniumABILanguageRuntime::GetPluginName()
-{
-    return GetPluginNameStatic();
-}
-
-uint32_t
-ItaniumABILanguageRuntime::GetPluginVersion()
-{
-    return 1;
-}
-
-BreakpointResolverSP
-ItaniumABILanguageRuntime::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp)
-{
-    return CreateExceptionResolver (bkpt, catch_bp, throw_bp, false);
-}
-
-BreakpointResolverSP
-ItaniumABILanguageRuntime::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions)
-{
-    // One complication here is that most users DON'T want to stop at __cxa_allocate_expression, but until we can do
-    // anything better with predicting unwinding the expression parser does.  So we have two forms of the exception
-    // breakpoints, one for expressions that leaves out __cxa_allocate_exception, and one that includes it.
-    // The SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in the runtime the former.
-    static const char *g_catch_name = "__cxa_begin_catch";
-    static const char *g_throw_name1 = "__cxa_throw";
-    static const char *g_throw_name2 = "__cxa_rethrow";
-    static const char *g_exception_throw_name = "__cxa_allocate_exception";
-    std::vector<const char *> exception_names;
-    exception_names.reserve(4);
-    if (catch_bp)
-        exception_names.push_back(g_catch_name);
-
-    if (throw_bp)
-    {
-        exception_names.push_back(g_throw_name1);
-        exception_names.push_back(g_throw_name2);
-    }
+lldb_private::ConstString ItaniumABILanguageRuntime::GetPluginName() {
+  return GetPluginNameStatic();
+}
 
-    if (for_expressions)
-        exception_names.push_back(g_exception_throw_name);
-    
-    BreakpointResolverSP resolver_sp (new BreakpointResolverName (bkpt,
-                                                                  exception_names.data(),
-                                                                  exception_names.size(),
-                                                                  eFunctionNameTypeBase,
-                                                                  eLanguageTypeUnknown,
-                                                                  0,
-                                                                  eLazyBoolNo));
+uint32_t ItaniumABILanguageRuntime::GetPluginVersion() { return 1; }
 
-    return resolver_sp;
+BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver(
+    Breakpoint *bkpt, bool catch_bp, bool throw_bp) {
+  return CreateExceptionResolver(bkpt, catch_bp, throw_bp, false);
+}
+
+BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver(
+    Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions) {
+  // One complication here is that most users DON'T want to stop at
+  // __cxa_allocate_expression, but until we can do
+  // anything better with predicting unwinding the expression parser does.  So
+  // we have two forms of the exception
+  // breakpoints, one for expressions that leaves out __cxa_allocate_exception,
+  // and one that includes it.
+  // The SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint
+  // in the runtime the former.
+  static const char *g_catch_name = "__cxa_begin_catch";
+  static const char *g_throw_name1 = "__cxa_throw";
+  static const char *g_throw_name2 = "__cxa_rethrow";
+  static const char *g_exception_throw_name = "__cxa_allocate_exception";
+  std::vector<const char *> exception_names;
+  exception_names.reserve(4);
+  if (catch_bp)
+    exception_names.push_back(g_catch_name);
+
+  if (throw_bp) {
+    exception_names.push_back(g_throw_name1);
+    exception_names.push_back(g_throw_name2);
+  }
+
+  if (for_expressions)
+    exception_names.push_back(g_exception_throw_name);
+
+  BreakpointResolverSP resolver_sp(new BreakpointResolverName(
+      bkpt, exception_names.data(), exception_names.size(),
+      eFunctionNameTypeBase, eLanguageTypeUnknown, 0, eLazyBoolNo));
+
+  return resolver_sp;
+}
+
+lldb::SearchFilterSP ItaniumABILanguageRuntime::CreateExceptionSearchFilter() {
+  Target &target = m_process->GetTarget();
+
+  if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
+    // Limit the number of modules that are searched for these breakpoints for
+    // Apple binaries.
+    FileSpecList filter_modules;
+    filter_modules.Append(FileSpec("libc++abi.dylib", false));
+    filter_modules.Append(FileSpec("libSystem.B.dylib", false));
+    return target.GetSearchFilterForModuleList(&filter_modules);
+  } else {
+    return LanguageRuntime::CreateExceptionSearchFilter();
+  }
+}
+
+lldb::BreakpointSP ItaniumABILanguageRuntime::CreateExceptionBreakpoint(
+    bool catch_bp, bool throw_bp, bool for_expressions, bool is_internal) {
+  Target &target = m_process->GetTarget();
+  FileSpecList filter_modules;
+  BreakpointResolverSP exception_resolver_sp =
+      CreateExceptionResolver(NULL, catch_bp, throw_bp, for_expressions);
+  SearchFilterSP filter_sp(CreateExceptionSearchFilter());
+  const bool hardware = false;
+  const bool resolve_indirect_functions = false;
+  return target.CreateBreakpoint(filter_sp, exception_resolver_sp, is_internal,
+                                 hardware, resolve_indirect_functions);
+}
+
+void ItaniumABILanguageRuntime::SetExceptionBreakpoints() {
+  if (!m_process)
+    return;
+
+  const bool catch_bp = false;
+  const bool throw_bp = true;
+  const bool is_internal = true;
+  const bool for_expressions = true;
+
+  // For the exception breakpoints set by the Expression parser, we'll be a
+  // little more aggressive and
+  // stop at exception allocation as well.
+
+  if (m_cxx_exception_bp_sp) {
+    m_cxx_exception_bp_sp->SetEnabled(true);
+  } else {
+    m_cxx_exception_bp_sp = CreateExceptionBreakpoint(
+        catch_bp, throw_bp, for_expressions, is_internal);
+    if (m_cxx_exception_bp_sp)
+      m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception");
+  }
 }
 
+void ItaniumABILanguageRuntime::ClearExceptionBreakpoints() {
+  if (!m_process)
+    return;
 
+  if (m_cxx_exception_bp_sp) {
+    m_cxx_exception_bp_sp->SetEnabled(false);
+  }
+}
 
-lldb::SearchFilterSP
-ItaniumABILanguageRuntime::CreateExceptionSearchFilter ()
-{
-    Target &target = m_process->GetTarget();
+bool ItaniumABILanguageRuntime::ExceptionBreakpointsAreSet() {
+  return m_cxx_exception_bp_sp && m_cxx_exception_bp_sp->IsEnabled();
+}
 
-    if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple)
-    {
-        // Limit the number of modules that are searched for these breakpoints for
-        // Apple binaries.
-        FileSpecList filter_modules;
-        filter_modules.Append(FileSpec("libc++abi.dylib", false));
-        filter_modules.Append(FileSpec("libSystem.B.dylib", false));
-        return target.GetSearchFilterForModuleList(&filter_modules);
-    }
-    else
-    {
-        return LanguageRuntime::CreateExceptionSearchFilter();
-    }
+bool ItaniumABILanguageRuntime::ExceptionBreakpointsExplainStop(
+    lldb::StopInfoSP stop_reason) {
+  if (!m_process)
+    return false;
+
+  if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
+    return false;
+
+  uint64_t break_site_id = stop_reason->GetValue();
+  return m_process->GetBreakpointSiteList().BreakpointSiteContainsBreakpoint(
+      break_site_id, m_cxx_exception_bp_sp->GetID());
 }
 
-lldb::BreakpointSP
-ItaniumABILanguageRuntime::CreateExceptionBreakpoint (bool catch_bp,
-                                                      bool throw_bp,
-                                                      bool for_expressions,
-                                                      bool is_internal)
-{
-    Target &target = m_process->GetTarget();
-    FileSpecList filter_modules;
-    BreakpointResolverSP exception_resolver_sp = CreateExceptionResolver (NULL, catch_bp, throw_bp, for_expressions);
-    SearchFilterSP filter_sp (CreateExceptionSearchFilter ());
-    const bool hardware = false;
-    const bool resolve_indirect_functions = false;
-    return target.CreateBreakpoint (filter_sp, exception_resolver_sp, is_internal, hardware, resolve_indirect_functions);
-}
-
-void
-ItaniumABILanguageRuntime::SetExceptionBreakpoints ()
-{
-    if (!m_process)
-        return;
-    
-    const bool catch_bp = false;
-    const bool throw_bp = true;
-    const bool is_internal = true;
-    const bool for_expressions = true;
-    
-    // For the exception breakpoints set by the Expression parser, we'll be a little more aggressive and
-    // stop at exception allocation as well.
-    
-    if (m_cxx_exception_bp_sp)
-    {
-        m_cxx_exception_bp_sp->SetEnabled (true);
-    }
-    else
-    {
-        m_cxx_exception_bp_sp = CreateExceptionBreakpoint (catch_bp, throw_bp, for_expressions, is_internal);
-        if (m_cxx_exception_bp_sp)
-            m_cxx_exception_bp_sp->SetBreakpointKind("c++ exception");
-    }
-    
+TypeAndOrName ItaniumABILanguageRuntime::GetDynamicTypeInfo(
+    const lldb_private::Address &vtable_addr) {
+  std::lock_guard<std::mutex> locker(m_dynamic_type_map_mutex);
+  DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr);
+  if (pos == m_dynamic_type_map.end())
+    return TypeAndOrName();
+  else
+    return pos->second;
 }
 
-void
-ItaniumABILanguageRuntime::ClearExceptionBreakpoints ()
-{
-    if (!m_process)
-        return;
-    
-    if (m_cxx_exception_bp_sp)
-    {
-        m_cxx_exception_bp_sp->SetEnabled (false);
-    }    
-}
-
-bool
-ItaniumABILanguageRuntime::ExceptionBreakpointsAreSet ()
-{
-    return m_cxx_exception_bp_sp && m_cxx_exception_bp_sp->IsEnabled();
-}
-
-bool
-ItaniumABILanguageRuntime::ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason)
-{
-    if (!m_process)
-        return false;
-    
-    if (!stop_reason || 
-        stop_reason->GetStopReason() != eStopReasonBreakpoint)
-        return false;
-    
-    uint64_t break_site_id = stop_reason->GetValue();
-    return m_process->GetBreakpointSiteList().BreakpointSiteContainsBreakpoint(break_site_id,
-                                                                               m_cxx_exception_bp_sp->GetID());
-    
-}
-
-TypeAndOrName
-ItaniumABILanguageRuntime::GetDynamicTypeInfo(const lldb_private::Address &vtable_addr)
-{
-    std::lock_guard<std::mutex> locker(m_dynamic_type_map_mutex);
-    DynamicTypeCache::const_iterator pos = m_dynamic_type_map.find(vtable_addr);
-    if (pos == m_dynamic_type_map.end())
-        return TypeAndOrName();
-    else
-        return pos->second;
-}
-
-void
-ItaniumABILanguageRuntime::SetDynamicTypeInfo(const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info)
-{
-    std::lock_guard<std::mutex> locker(m_dynamic_type_map_mutex);
-    m_dynamic_type_map[vtable_addr] = type_info;
+void ItaniumABILanguageRuntime::SetDynamicTypeInfo(
+    const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info) {
+  std::lock_guard<std::mutex> locker(m_dynamic_type_map_mutex);
+  m_dynamic_type_map[vtable_addr] = type_info;
 }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h Tue Sep  6 15:57:50 2016
@@ -18,116 +18,98 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Breakpoint/BreakpointResolver.h"
+#include "lldb/Core/Value.h"
 #include "lldb/Symbol/Type.h"
-#include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Target/CPPLanguageRuntime.h"
-#include "lldb/Core/Value.h"
+#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
-    
-    class ItaniumABILanguageRuntime :
-    public lldb_private::CPPLanguageRuntime
-    {
-    public:
-        ~ItaniumABILanguageRuntime() override = default;
-        
-        //------------------------------------------------------------------
-        // Static Functions
-        //------------------------------------------------------------------
-        static void
-        Initialize();
-        
-        static void
-        Terminate();
-        
-        static lldb_private::LanguageRuntime *
-        CreateInstance (Process *process, lldb::LanguageType language);
-        
-        static lldb_private::ConstString
-        GetPluginNameStatic();
-
-        bool
-        IsVTableName(const char *name) override;
-        
-        bool
-        GetDynamicTypeAndAddress(ValueObject &in_value,
-                                 lldb::DynamicValueType use_dynamic,
-                                 TypeAndOrName &class_type_or_name,
-                                 Address &address,
-                                 Value::ValueType &value_type) override;
-        
-        TypeAndOrName
-        FixUpDynamicType(const TypeAndOrName& type_and_or_name,
-                         ValueObject& static_value) override;
-        
-        bool
-        CouldHaveDynamicValue(ValueObject &in_value) override;
-        
-        void
-        SetExceptionBreakpoints() override;
-        
-        void
-        ClearExceptionBreakpoints() override;
-        
-        bool
-        ExceptionBreakpointsAreSet() override;
-        
-        bool
-        ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
-
-        lldb::BreakpointResolverSP
-        CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override;
-        
-        lldb::SearchFilterSP
-        CreateExceptionSearchFilter() override;
-
-        //------------------------------------------------------------------
-        // PluginInterface protocol
-        //------------------------------------------------------------------
-        lldb_private::ConstString
-        GetPluginName() override;
-        
-        uint32_t
-        GetPluginVersion() override;
-
-    protected:
-        lldb::BreakpointResolverSP
-        CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions);
-
-        lldb::BreakpointSP
-        CreateExceptionBreakpoint(bool catch_bp,
-                                  bool throw_bp,
-                                  bool for_expressions,
-                                  bool is_internal);
-        
-    private:
-        typedef std::map<lldb_private::Address, TypeAndOrName> DynamicTypeCache;
-
-        ItaniumABILanguageRuntime(Process *process)
-            : // Call CreateInstance instead.
-              lldb_private::CPPLanguageRuntime(process),
-              m_cxx_exception_bp_sp(),
-              m_dynamic_type_map(),
-              m_dynamic_type_map_mutex()
-        {
-        }
-
-        lldb::BreakpointSP m_cxx_exception_bp_sp;
-        DynamicTypeCache m_dynamic_type_map;
-        std::mutex m_dynamic_type_map_mutex;
-
-        TypeAndOrName
-        GetTypeInfoFromVTableAddress(ValueObject &in_value, lldb::addr_t original_ptr, lldb::addr_t vtable_addr);
-
-        TypeAndOrName
-        GetDynamicTypeInfo(const lldb_private::Address &vtable_addr);
-
-        void
-        SetDynamicTypeInfo(const lldb_private::Address &vtable_addr, const TypeAndOrName &type_info);
-    };
-    
+
+class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime {
+public:
+  ~ItaniumABILanguageRuntime() override = default;
+
+  //------------------------------------------------------------------
+  // Static Functions
+  //------------------------------------------------------------------
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb_private::LanguageRuntime *
+  CreateInstance(Process *process, lldb::LanguageType language);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  bool IsVTableName(const char *name) override;
+
+  bool GetDynamicTypeAndAddress(ValueObject &in_value,
+                                lldb::DynamicValueType use_dynamic,
+                                TypeAndOrName &class_type_or_name,
+                                Address &address,
+                                Value::ValueType &value_type) override;
+
+  TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+                                 ValueObject &static_value) override;
+
+  bool CouldHaveDynamicValue(ValueObject &in_value) override;
+
+  void SetExceptionBreakpoints() override;
+
+  void ClearExceptionBreakpoints() override;
+
+  bool ExceptionBreakpointsAreSet() override;
+
+  bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
+
+  lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
+                                                     bool catch_bp,
+                                                     bool throw_bp) override;
+
+  lldb::SearchFilterSP CreateExceptionSearchFilter() override;
+
+  //------------------------------------------------------------------
+  // PluginInterface protocol
+  //------------------------------------------------------------------
+  lldb_private::ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+
+protected:
+  lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
+                                                     bool catch_bp,
+                                                     bool throw_bp,
+                                                     bool for_expressions);
+
+  lldb::BreakpointSP CreateExceptionBreakpoint(bool catch_bp, bool throw_bp,
+                                               bool for_expressions,
+                                               bool is_internal);
+
+private:
+  typedef std::map<lldb_private::Address, TypeAndOrName> DynamicTypeCache;
+
+  ItaniumABILanguageRuntime(Process *process)
+      : // Call CreateInstance instead.
+        lldb_private::CPPLanguageRuntime(process),
+        m_cxx_exception_bp_sp(), m_dynamic_type_map(),
+        m_dynamic_type_map_mutex() {}
+
+  lldb::BreakpointSP m_cxx_exception_bp_sp;
+  DynamicTypeCache m_dynamic_type_map;
+  std::mutex m_dynamic_type_map_mutex;
+
+  TypeAndOrName GetTypeInfoFromVTableAddress(ValueObject &in_value,
+                                             lldb::addr_t original_ptr,
+                                             lldb::addr_t vtable_addr);
+
+  TypeAndOrName GetDynamicTypeInfo(const lldb_private::Address &vtable_addr);
+
+  void SetDynamicTypeInfo(const lldb_private::Address &vtable_addr,
+                          const TypeAndOrName &type_info);
+};
+
 } // namespace lldb_private
 
 #endif // liblldb_ItaniumABILanguageRuntime_h_

Modified: lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- GoLanguageRuntime.cpp --------------------------------------*- C++ -*-===//
+//===-- GoLanguageRuntime.cpp --------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -36,206 +37,179 @@ using namespace lldb;
 using namespace lldb_private;
 
 namespace {
-ValueObjectSP GetChild(ValueObject& obj, const char* name, bool dereference = true) {
-    ConstString name_const_str(name);
-    ValueObjectSP result = obj.GetChildMemberWithName(name_const_str, true);
-    if (dereference && result && result->IsPointerType()) {
-        Error err;
-        result = result->Dereference(err);
-        if (err.Fail())
-            result.reset();
-    }
-    return result;
-}
-
-ConstString ReadString(ValueObject& str, Process* process) {
-    ConstString result;
-    ValueObjectSP data = GetChild(str, "str", false);
-    ValueObjectSP len = GetChild(str, "len");
-    if (len && data)
-    {
-        Error err;
-        lldb::addr_t addr = data->GetPointerValue();
-        if (addr == LLDB_INVALID_ADDRESS)
-            return result;
-        uint64_t byte_size = len->GetValueAsUnsigned(0);
-        char* buf = new char[byte_size + 1];
-        buf[byte_size] = 0;
-        size_t bytes_read = process->ReadMemory (addr,
-                                                 buf,
-                                                 byte_size,
-                                                 err);
-        if (!(err.Fail() || bytes_read != byte_size))
-            result = ConstString(buf, bytes_read);
-        delete[] buf;
-    }
-    return result;
-}
+ValueObjectSP GetChild(ValueObject &obj, const char *name,
+                       bool dereference = true) {
+  ConstString name_const_str(name);
+  ValueObjectSP result = obj.GetChildMemberWithName(name_const_str, true);
+  if (dereference && result && result->IsPointerType()) {
+    Error err;
+    result = result->Dereference(err);
+    if (err.Fail())
+      result.reset();
+  }
+  return result;
+}
+
+ConstString ReadString(ValueObject &str, Process *process) {
+  ConstString result;
+  ValueObjectSP data = GetChild(str, "str", false);
+  ValueObjectSP len = GetChild(str, "len");
+  if (len && data) {
+    Error err;
+    lldb::addr_t addr = data->GetPointerValue();
+    if (addr == LLDB_INVALID_ADDRESS)
+      return result;
+    uint64_t byte_size = len->GetValueAsUnsigned(0);
+    char *buf = new char[byte_size + 1];
+    buf[byte_size] = 0;
+    size_t bytes_read = process->ReadMemory(addr, buf, byte_size, err);
+    if (!(err.Fail() || bytes_read != byte_size))
+      result = ConstString(buf, bytes_read);
+    delete[] buf;
+  }
+  return result;
+}
+
+ConstString ReadTypeName(ValueObjectSP type, Process *process) {
+  if (ValueObjectSP uncommon = GetChild(*type, "x")) {
+    ValueObjectSP name = GetChild(*uncommon, "name");
+    ValueObjectSP package = GetChild(*uncommon, "pkgpath");
+    if (name && name->GetPointerValue() != 0 && package &&
+        package->GetPointerValue() != 0) {
+      ConstString package_const_str = ReadString(*package, process);
+      ConstString name_const_str = ReadString(*name, process);
+      if (package_const_str.GetLength() == 0)
+        return name_const_str;
+      return ConstString((package_const_str.GetStringRef() + "." +
+                          name_const_str.GetStringRef())
+                             .str());
+    }
+  }
+  ValueObjectSP name = GetChild(*type, "_string");
+  if (name)
+    return ReadString(*name, process);
+  return ConstString("");
+}
+
+CompilerType LookupRuntimeType(ValueObjectSP type, ExecutionContext *exe_ctx,
+                               bool *is_direct) {
+  uint8_t kind = GetChild(*type, "kind")->GetValueAsUnsigned(0);
+  *is_direct = GoASTContext::IsDirectIface(kind);
+  if (GoASTContext::IsPointerKind(kind)) {
+    CompilerType type_ptr = type->GetCompilerType().GetPointerType();
+    Error err;
+    ValueObjectSP elem =
+        type->CreateValueObjectFromAddress("elem", type->GetAddressOf() +
+                                                       type->GetByteSize(),
+                                           *exe_ctx, type_ptr)
+            ->Dereference(err);
+    if (err.Fail())
+      return CompilerType();
+    bool tmp_direct;
+    return LookupRuntimeType(elem, exe_ctx, &tmp_direct).GetPointerType();
+  }
+  Target *target = exe_ctx->GetTargetPtr();
+  Process *process = exe_ctx->GetProcessPtr();
 
-ConstString
-ReadTypeName(ValueObjectSP type, Process* process)
-{
-    if (ValueObjectSP uncommon = GetChild(*type, "x"))
-    {
-        ValueObjectSP name = GetChild(*uncommon, "name");
-        ValueObjectSP package = GetChild(*uncommon, "pkgpath");
-        if (name && name->GetPointerValue() != 0 && package && package->GetPointerValue() != 0)
-        {
-            ConstString package_const_str = ReadString(*package, process);
-            ConstString name_const_str = ReadString(*name, process);
-            if (package_const_str.GetLength() == 0)
-                return name_const_str;
-            return ConstString((package_const_str.GetStringRef() + "." + name_const_str.GetStringRef()).str());
-        }
-    }
-    ValueObjectSP name = GetChild(*type, "_string");
-    if (name)
-        return ReadString(*name, process);
-    return ConstString("");
-}
-
-CompilerType
-LookupRuntimeType(ValueObjectSP type, ExecutionContext* exe_ctx, bool* is_direct)
-{
-    uint8_t kind = GetChild(*type, "kind")->GetValueAsUnsigned(0);
-    *is_direct = GoASTContext::IsDirectIface(kind);
-    if (GoASTContext::IsPointerKind(kind))
-    {
-        CompilerType type_ptr = type->GetCompilerType().GetPointerType();
-        Error err;
-        ValueObjectSP elem = type->CreateValueObjectFromAddress("elem", type->GetAddressOf() + type->GetByteSize(), *exe_ctx, type_ptr)->Dereference(err);
-        if (err.Fail())
-            return CompilerType();
-        bool tmp_direct;
-        return LookupRuntimeType(elem, exe_ctx, &tmp_direct).GetPointerType();
-    }
-    Target *target = exe_ctx->GetTargetPtr();
-    Process *process = exe_ctx->GetProcessPtr();
-    
-    ConstString const_typename = ReadTypeName(type, process);
-    if (const_typename.GetLength() == 0)
-        return CompilerType();
-    
-    SymbolContext sc;
-    TypeList type_list;
-    llvm::DenseSet<SymbolFile *> searched_symbol_files;
-    uint32_t num_matches = target->GetImages().FindTypes (sc,
-                                                          const_typename,
-                                                          false,
-                                                          2,
-                                                          searched_symbol_files,
-                                                          type_list);
-    if (num_matches > 0) {
-        return type_list.GetTypeAtIndex(0)->GetFullCompilerType();
-    }
+  ConstString const_typename = ReadTypeName(type, process);
+  if (const_typename.GetLength() == 0)
     return CompilerType();
-}
 
+  SymbolContext sc;
+  TypeList type_list;
+  llvm::DenseSet<SymbolFile *> searched_symbol_files;
+  uint32_t num_matches = target->GetImages().FindTypes(
+      sc, const_typename, false, 2, searched_symbol_files, type_list);
+  if (num_matches > 0) {
+    return type_list.GetTypeAtIndex(0)->GetFullCompilerType();
+  }
+  return CompilerType();
+}
 }
 
-bool
-GoLanguageRuntime::CouldHaveDynamicValue (ValueObject &in_value)
-{
-    return GoASTContext::IsGoInterface(in_value.GetCompilerType());
-}
-
-bool
-GoLanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
-                                            TypeAndOrName &class_type_or_name, Address &dynamic_address,
-                                            Value::ValueType &value_type)
-{
-    value_type = Value::eValueTypeScalar;
-    class_type_or_name.Clear();
-    if (CouldHaveDynamicValue (in_value))
-    {
-        Error err;
-        ValueObjectSP iface = in_value.GetStaticValue();
-        ValueObjectSP data_sp = GetChild(*iface, "data", false);
-        if (!data_sp)
-            return false;
-
-        if (ValueObjectSP tab = GetChild(*iface, "tab"))
-            iface = tab;
-        ValueObjectSP type = GetChild(*iface, "_type");
-        if (!type)
-        {
-            return false;
-        }
-        
-        bool direct;
-        ExecutionContext exe_ctx (in_value.GetExecutionContextRef());
-        CompilerType final_type = LookupRuntimeType(type, &exe_ctx, &direct);
-        if (!final_type)
-            return false;
-        if (direct)
-        {
-            class_type_or_name.SetCompilerType(final_type);
-        }
-        else
-        {
-            // TODO: implement reference types or fix caller to support dynamic types that aren't pointers
-            // so we don't have to introduce this extra pointer.
-            class_type_or_name.SetCompilerType(final_type.GetPointerType());
-        }
-
-        dynamic_address.SetLoadAddress(data_sp->GetPointerValue(), exe_ctx.GetTargetPtr());
-
-        return true;
-    }
-    return false;
+bool GoLanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
+  return GoASTContext::IsGoInterface(in_value.GetCompilerType());
+}
+
+bool GoLanguageRuntime::GetDynamicTypeAndAddress(
+    ValueObject &in_value, lldb::DynamicValueType use_dynamic,
+    TypeAndOrName &class_type_or_name, Address &dynamic_address,
+    Value::ValueType &value_type) {
+  value_type = Value::eValueTypeScalar;
+  class_type_or_name.Clear();
+  if (CouldHaveDynamicValue(in_value)) {
+    Error err;
+    ValueObjectSP iface = in_value.GetStaticValue();
+    ValueObjectSP data_sp = GetChild(*iface, "data", false);
+    if (!data_sp)
+      return false;
+
+    if (ValueObjectSP tab = GetChild(*iface, "tab"))
+      iface = tab;
+    ValueObjectSP type = GetChild(*iface, "_type");
+    if (!type) {
+      return false;
+    }
+
+    bool direct;
+    ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
+    CompilerType final_type = LookupRuntimeType(type, &exe_ctx, &direct);
+    if (!final_type)
+      return false;
+    if (direct) {
+      class_type_or_name.SetCompilerType(final_type);
+    } else {
+      // TODO: implement reference types or fix caller to support dynamic types
+      // that aren't pointers
+      // so we don't have to introduce this extra pointer.
+      class_type_or_name.SetCompilerType(final_type.GetPointerType());
+    }
+
+    dynamic_address.SetLoadAddress(data_sp->GetPointerValue(),
+                                   exe_ctx.GetTargetPtr());
+
+    return true;
+  }
+  return false;
 }
 
 TypeAndOrName
-GoLanguageRuntime::FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value)
-{
-    return type_and_or_name;
+GoLanguageRuntime::FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+                                    ValueObject &static_value) {
+  return type_and_or_name;
 }
 
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
 LanguageRuntime *
-GoLanguageRuntime::CreateInstance (Process *process, lldb::LanguageType language)
-{
-    if (language == eLanguageTypeGo)
-        return new GoLanguageRuntime (process);
-    else
-        return NULL;
-}
-
-void
-GoLanguageRuntime::Initialize()
-{
-    PluginManager::RegisterPlugin (GetPluginNameStatic(),
-                                   "Go Language Runtime",
-                                   CreateInstance);
-}
-
-void
-GoLanguageRuntime::Terminate()
-{
-    PluginManager::UnregisterPlugin (CreateInstance);
-}
-
-lldb_private::ConstString
-GoLanguageRuntime::GetPluginNameStatic()
-{
-    static ConstString g_name("golang");
-    return g_name;
+GoLanguageRuntime::CreateInstance(Process *process,
+                                  lldb::LanguageType language) {
+  if (language == eLanguageTypeGo)
+    return new GoLanguageRuntime(process);
+  else
+    return NULL;
+}
+
+void GoLanguageRuntime::Initialize() {
+  PluginManager::RegisterPlugin(GetPluginNameStatic(), "Go Language Runtime",
+                                CreateInstance);
+}
+
+void GoLanguageRuntime::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+lldb_private::ConstString GoLanguageRuntime::GetPluginNameStatic() {
+  static ConstString g_name("golang");
+  return g_name;
 }
 
 //------------------------------------------------------------------
 // PluginInterface protocol
 //------------------------------------------------------------------
-lldb_private::ConstString
-GoLanguageRuntime::GetPluginName()
-{
-    return GetPluginNameStatic();
-}
-
-uint32_t
-GoLanguageRuntime::GetPluginVersion()
-{
-    return 1;
+lldb_private::ConstString GoLanguageRuntime::GetPluginName() {
+  return GetPluginNameStatic();
 }
 
+uint32_t GoLanguageRuntime::GetPluginVersion() { return 1; }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.h Tue Sep  6 15:57:50 2016
@@ -14,80 +14,73 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Breakpoint/BreakpointResolver.h"
-#include "lldb/Target/LanguageRuntime.h"
 #include "lldb/Core/Value.h"
+#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
-    
-    class GoLanguageRuntime :
-    public lldb_private::LanguageRuntime
-    {
-    public:
-        ~GoLanguageRuntime() override = default;
-
-        //------------------------------------------------------------------
-        // Static Functions
-        //------------------------------------------------------------------
-        static void
-        Initialize();
-        
-        static void
-        Terminate();
-        
-        static lldb_private::LanguageRuntime *
-        CreateInstance(Process *process, lldb::LanguageType language);
-        
-        static lldb_private::ConstString
-        GetPluginNameStatic();
-
-        lldb::LanguageType
-        GetLanguageType() const override
-        {
-            return lldb::eLanguageTypeGo;
-        }
-
-        bool
-        GetObjectDescription(Stream &str, ValueObject &object) override
-        {
-            // TODO(ribrdb): Maybe call String() method?
-            return false;
-        }
-
-        bool
-        GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override
-        {
-            return false;
-        }
-
-        bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
-                                      TypeAndOrName &class_type_or_name, Address &address,
-                                      Value::ValueType &value_type) override;
-
-        bool CouldHaveDynamicValue(ValueObject &in_value) override;
-
-        lldb::BreakpointResolverSP
-        CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override
-        {
-            return lldb::BreakpointResolverSP();
-        }
-
-        TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override;
-
-        //------------------------------------------------------------------
-        // PluginInterface protocol
-        //------------------------------------------------------------------
-        lldb_private::ConstString
-        GetPluginName() override;
-        
-        uint32_t
-        GetPluginVersion() override;
-        
-    private:
-        GoLanguageRuntime(Process *process) : lldb_private::LanguageRuntime(process) { } // Call CreateInstance instead.
-    };
-    
+
+class GoLanguageRuntime : public lldb_private::LanguageRuntime {
+public:
+  ~GoLanguageRuntime() override = default;
+
+  //------------------------------------------------------------------
+  // Static Functions
+  //------------------------------------------------------------------
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb_private::LanguageRuntime *
+  CreateInstance(Process *process, lldb::LanguageType language);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  lldb::LanguageType GetLanguageType() const override {
+    return lldb::eLanguageTypeGo;
+  }
+
+  bool GetObjectDescription(Stream &str, ValueObject &object) override {
+    // TODO(ribrdb): Maybe call String() method?
+    return false;
+  }
+
+  bool GetObjectDescription(Stream &str, Value &value,
+                            ExecutionContextScope *exe_scope) override {
+    return false;
+  }
+
+  bool GetDynamicTypeAndAddress(ValueObject &in_value,
+                                lldb::DynamicValueType use_dynamic,
+                                TypeAndOrName &class_type_or_name,
+                                Address &address,
+                                Value::ValueType &value_type) override;
+
+  bool CouldHaveDynamicValue(ValueObject &in_value) override;
+
+  lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
+                                                     bool catch_bp,
+                                                     bool throw_bp) override {
+    return lldb::BreakpointResolverSP();
+  }
+
+  TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+                                 ValueObject &static_value) override;
+
+  //------------------------------------------------------------------
+  // PluginInterface protocol
+  //------------------------------------------------------------------
+  lldb_private::ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+
+private:
+  GoLanguageRuntime(Process *process)
+      : lldb_private::LanguageRuntime(process) {
+  } // Call CreateInstance instead.
+};
+
 } // namespace lldb_private
 
 #endif // liblldb_GoLanguageRuntime_h_

Modified: lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.cpp Tue Sep  6 15:57:50 2016
@@ -23,154 +23,135 @@
 using namespace lldb;
 using namespace lldb_private;
 
-JavaLanguageRuntime::JavaLanguageRuntime(Process *process) : LanguageRuntime(process)
-{
-}
+JavaLanguageRuntime::JavaLanguageRuntime(Process *process)
+    : LanguageRuntime(process) {}
 
 LanguageRuntime *
-JavaLanguageRuntime::CreateInstance(Process *process, lldb::LanguageType language)
-{
-    if (language == eLanguageTypeJava)
-        return new JavaLanguageRuntime(process);
-    return nullptr;
-}
-
-void
-JavaLanguageRuntime::Initialize()
-{
-    PluginManager::RegisterPlugin(GetPluginNameStatic(), "Java language runtime", CreateInstance);
-}
-
-void
-JavaLanguageRuntime::Terminate()
-{
-    PluginManager::UnregisterPlugin(CreateInstance);
-}
-
-lldb_private::ConstString
-JavaLanguageRuntime::GetPluginNameStatic()
-{
-    static ConstString g_name("java");
-    return g_name;
-}
-
-lldb_private::ConstString
-JavaLanguageRuntime::GetPluginName()
-{
-    return GetPluginNameStatic();
-}
-
-uint32_t
-JavaLanguageRuntime::GetPluginVersion()
-{
-    return 1;
-}
-
-bool
-JavaLanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value)
-{
-    return true;
-}
-
-static ConstString
-GetDynamicTypeId(ExecutionContext *exe_ctx, Target *target, ValueObject &in_value)
-{
-    SymbolContext sc;
-    TypeList class_types;
-    llvm::DenseSet<SymbolFile *> searched_symbol_files;
-    size_t num_matches = target->GetImages().FindTypes(sc, ConstString("Object"),
-                                                       true, // name_is_fully_qualified
-                                                       UINT32_MAX, searched_symbol_files, class_types);
-    for (size_t i = 0; i < num_matches; ++i)
-    {
-        TypeSP type_sp = class_types.GetTypeAtIndex(i);
-        CompilerType compiler_type = type_sp->GetFullCompilerType();
-
-        if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava ||
-            compiler_type.GetTypeName() != ConstString("java::lang::Object"))
-            continue;
-
-        if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType())
-        {
-            uint64_t type_id = JavaASTContext::CalculateDynamicTypeId(exe_ctx, compiler_type, in_value);
-            if (type_id != UINT64_MAX)
-            {
-                char id[32];
-                snprintf(id, sizeof(id), "0x%" PRIX64, type_id);
-                return ConstString(id);
-            }
-        }
-    }
-    return ConstString();
+JavaLanguageRuntime::CreateInstance(Process *process,
+                                    lldb::LanguageType language) {
+  if (language == eLanguageTypeJava)
+    return new JavaLanguageRuntime(process);
+  return nullptr;
+}
+
+void JavaLanguageRuntime::Initialize() {
+  PluginManager::RegisterPlugin(GetPluginNameStatic(), "Java language runtime",
+                                CreateInstance);
+}
+
+void JavaLanguageRuntime::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+lldb_private::ConstString JavaLanguageRuntime::GetPluginNameStatic() {
+  static ConstString g_name("java");
+  return g_name;
+}
+
+lldb_private::ConstString JavaLanguageRuntime::GetPluginName() {
+  return GetPluginNameStatic();
 }
 
-bool
-JavaLanguageRuntime::GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
-                                              TypeAndOrName &class_type_or_name, Address &dynamic_address,
-                                              Value::ValueType &value_type)
-{
-    class_type_or_name.Clear();
-
-    // null references don't have a dynamic type
-    if (in_value.IsNilReference())
-        return false;
-
-    ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
-    Target *target = exe_ctx.GetTargetPtr();
-    if (!target)
-        return false;
-
-    ConstString linkage_name;
-    CompilerType in_type = in_value.GetCompilerType();
-    if (in_type.IsPossibleDynamicType(nullptr, false, false))
-        linkage_name = GetDynamicTypeId(&exe_ctx, target, in_value);
-    else
-        linkage_name = JavaASTContext::GetLinkageName(in_type);
-
-    if (!linkage_name)
-        return false;
-
-    class_type_or_name.SetName(in_type.GetNonReferenceType().GetTypeName());
-
-    SymbolContext sc;
-    TypeList class_types;
-    llvm::DenseSet<SymbolFile *> searched_symbol_files;
-    size_t num_matches = target->GetImages().FindTypes(sc, linkage_name,
-                                                       true, // name_is_fully_qualified
-                                                       UINT32_MAX, searched_symbol_files, class_types);
-
-    for (size_t i = 0; i < num_matches; ++i)
-    {
-        TypeSP type_sp = class_types.GetTypeAtIndex(i);
-        CompilerType compiler_type = type_sp->GetFullCompilerType();
-
-        if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava)
-            continue;
-
-        if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType())
-        {
-            class_type_or_name.SetTypeSP(type_sp);
-
-            Value &value = in_value.GetValue();
-            value_type = value.GetValueType();
-            dynamic_address.SetRawAddress(value.GetScalar().ULongLong(0));
-            return true;
-        }
+uint32_t JavaLanguageRuntime::GetPluginVersion() { return 1; }
+
+bool JavaLanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
+  return true;
+}
+
+static ConstString GetDynamicTypeId(ExecutionContext *exe_ctx, Target *target,
+                                    ValueObject &in_value) {
+  SymbolContext sc;
+  TypeList class_types;
+  llvm::DenseSet<SymbolFile *> searched_symbol_files;
+  size_t num_matches = target->GetImages().FindTypes(
+      sc, ConstString("Object"),
+      true, // name_is_fully_qualified
+      UINT32_MAX, searched_symbol_files, class_types);
+  for (size_t i = 0; i < num_matches; ++i) {
+    TypeSP type_sp = class_types.GetTypeAtIndex(i);
+    CompilerType compiler_type = type_sp->GetFullCompilerType();
+
+    if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava ||
+        compiler_type.GetTypeName() != ConstString("java::lang::Object"))
+      continue;
+
+    if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType()) {
+      uint64_t type_id = JavaASTContext::CalculateDynamicTypeId(
+          exe_ctx, compiler_type, in_value);
+      if (type_id != UINT64_MAX) {
+        char id[32];
+        snprintf(id, sizeof(id), "0x%" PRIX64, type_id);
+        return ConstString(id);
+      }
     }
+  }
+  return ConstString();
+}
+
+bool JavaLanguageRuntime::GetDynamicTypeAndAddress(
+    ValueObject &in_value, lldb::DynamicValueType use_dynamic,
+    TypeAndOrName &class_type_or_name, Address &dynamic_address,
+    Value::ValueType &value_type) {
+  class_type_or_name.Clear();
+
+  // null references don't have a dynamic type
+  if (in_value.IsNilReference())
     return false;
+
+  ExecutionContext exe_ctx(in_value.GetExecutionContextRef());
+  Target *target = exe_ctx.GetTargetPtr();
+  if (!target)
+    return false;
+
+  ConstString linkage_name;
+  CompilerType in_type = in_value.GetCompilerType();
+  if (in_type.IsPossibleDynamicType(nullptr, false, false))
+    linkage_name = GetDynamicTypeId(&exe_ctx, target, in_value);
+  else
+    linkage_name = JavaASTContext::GetLinkageName(in_type);
+
+  if (!linkage_name)
+    return false;
+
+  class_type_or_name.SetName(in_type.GetNonReferenceType().GetTypeName());
+
+  SymbolContext sc;
+  TypeList class_types;
+  llvm::DenseSet<SymbolFile *> searched_symbol_files;
+  size_t num_matches = target->GetImages().FindTypes(
+      sc, linkage_name,
+      true, // name_is_fully_qualified
+      UINT32_MAX, searched_symbol_files, class_types);
+
+  for (size_t i = 0; i < num_matches; ++i) {
+    TypeSP type_sp = class_types.GetTypeAtIndex(i);
+    CompilerType compiler_type = type_sp->GetFullCompilerType();
+
+    if (compiler_type.GetMinimumLanguage() != eLanguageTypeJava)
+      continue;
+
+    if (compiler_type.GetCompleteType() && compiler_type.IsCompleteType()) {
+      class_type_or_name.SetTypeSP(type_sp);
+
+      Value &value = in_value.GetValue();
+      value_type = value.GetValueType();
+      dynamic_address.SetRawAddress(value.GetScalar().ULongLong(0));
+      return true;
+    }
+  }
+  return false;
 }
 
 TypeAndOrName
-JavaLanguageRuntime::FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value)
-{
-    CompilerType static_type(static_value.GetCompilerType());
-
-    TypeAndOrName ret(type_and_or_name);
-    if (type_and_or_name.HasType())
-    {
-        CompilerType orig_type = type_and_or_name.GetCompilerType();
-        if (static_type.IsReferenceType())
-            ret.SetCompilerType(orig_type.GetLValueReferenceType());
-    }
-    return ret;
+JavaLanguageRuntime::FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+                                      ValueObject &static_value) {
+  CompilerType static_type(static_value.GetCompilerType());
+
+  TypeAndOrName ret(type_and_or_name);
+  if (type_and_or_name.HasType()) {
+    CompilerType orig_type = type_and_or_name.GetCompilerType();
+    if (static_type.IsReferenceType())
+      ret.SetCompilerType(orig_type.GetLValueReferenceType());
+  }
+  return ret;
 }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/Java/JavaLanguageRuntime.h Tue Sep  6 15:57:50 2016
@@ -19,70 +19,58 @@
 #include "lldb/Target/LanguageRuntime.h"
 #include "lldb/lldb-private.h"
 
-namespace lldb_private
-{
+namespace lldb_private {
 
-class JavaLanguageRuntime : public LanguageRuntime
-{
+class JavaLanguageRuntime : public LanguageRuntime {
 public:
-    static void
-    Initialize();
+  static void Initialize();
 
-    static void
-    Terminate();
+  static void Terminate();
 
-    static lldb_private::LanguageRuntime *
-    CreateInstance(Process *process, lldb::LanguageType language);
+  static lldb_private::LanguageRuntime *
+  CreateInstance(Process *process, lldb::LanguageType language);
 
-    static lldb_private::ConstString
-    GetPluginNameStatic();
-
-    lldb_private::ConstString
-    GetPluginName() override;
-
-    uint32_t
-    GetPluginVersion() override;
-
-    lldb::LanguageType
-    GetLanguageType() const override
-    {
-        return lldb::eLanguageTypeJava;
-    }
-
-    bool
-    GetObjectDescription(Stream &str, ValueObject &object) override
-    {
-        return false;
-    }
-
-    bool
-    GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) override
-    {
-        return false;
-    }
-
-    lldb::BreakpointResolverSP
-    CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override
-    {
-        return nullptr;
-    }
-
-    TypeAndOrName
-    FixUpDynamicType(const TypeAndOrName &type_and_or_name, ValueObject &static_value) override;
-
-    bool
-    CouldHaveDynamicValue(ValueObject &in_value) override;
-
-    bool
-    GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic,
-                             TypeAndOrName &class_type_or_name, Address &address,
-                             Value::ValueType &value_type) override;
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  lldb_private::ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+
+  lldb::LanguageType GetLanguageType() const override {
+    return lldb::eLanguageTypeJava;
+  }
+
+  bool GetObjectDescription(Stream &str, ValueObject &object) override {
+    return false;
+  }
+
+  bool GetObjectDescription(Stream &str, Value &value,
+                            ExecutionContextScope *exe_scope) override {
+    return false;
+  }
+
+  lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
+                                                     bool catch_bp,
+                                                     bool throw_bp) override {
+    return nullptr;
+  }
+
+  TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+                                 ValueObject &static_value) override;
+
+  bool CouldHaveDynamicValue(ValueObject &in_value) override;
+
+  bool GetDynamicTypeAndAddress(ValueObject &in_value,
+                                lldb::DynamicValueType use_dynamic,
+                                TypeAndOrName &class_type_or_name,
+                                Address &address,
+                                Value::ValueType &value_type) override;
 
 protected:
-    JavaLanguageRuntime(Process *process);
+  JavaLanguageRuntime(Process *process);
 
 private:
-    DISALLOW_COPY_AND_ASSIGN(JavaLanguageRuntime);
+  DISALLOW_COPY_AND_ASSIGN(JavaLanguageRuntime);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- AppleObjCClassDescriptorV2.cpp -----------------------------*- C++ -*-===//
+//===-- AppleObjCClassDescriptorV2.cpp -----------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -15,557 +16,533 @@
 using namespace lldb;
 using namespace lldb_private;
 
-bool
-ClassDescriptorV2::Read_objc_class (Process* process, std::unique_ptr<objc_class_t> &objc_class) const
-{
-    objc_class.reset(new objc_class_t);
-    
-    bool ret = objc_class->Read (process, m_objc_class_ptr);
-    
-    if (!ret)
-        objc_class.reset();
-    
-    return ret;
-}
-
-bool
-ClassDescriptorV2::objc_class_t::Read(Process *process, lldb::addr_t addr)
-{
-    size_t ptr_size = process->GetAddressByteSize();
-    
-    size_t objc_class_size = ptr_size   // uintptr_t isa;
-    + ptr_size   // Class superclass;
-    + ptr_size   // void *cache;
-    + ptr_size   // IMP *vtable;
-    + ptr_size;  // uintptr_t data_NEVER_USE;
-    
-    DataBufferHeap objc_class_buf (objc_class_size, '\0');
-    Error error;
-    
-    process->ReadMemory(addr, objc_class_buf.GetBytes(), objc_class_size, error);
-    if (error.Fail())
-    {
-        return false;
-    }
-    
-    DataExtractor extractor(objc_class_buf.GetBytes(), objc_class_size, process->GetByteOrder(), process->GetAddressByteSize());
-    
-    lldb::offset_t cursor = 0;
-    
-    m_isa           = extractor.GetAddress_unchecked(&cursor);   // uintptr_t isa;
-    m_superclass    = extractor.GetAddress_unchecked(&cursor);   // Class superclass;
-    m_cache_ptr     = extractor.GetAddress_unchecked(&cursor);   // void *cache;
-    m_vtable_ptr    = extractor.GetAddress_unchecked(&cursor);   // IMP *vtable;
-    lldb::addr_t data_NEVER_USE = extractor.GetAddress_unchecked(&cursor);   // uintptr_t data_NEVER_USE;
-    
-    m_flags         = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3);
-    m_data_ptr      = data_NEVER_USE & ~(lldb::addr_t)3;
-    
-    return true;
-}
-
-bool
-ClassDescriptorV2::class_rw_t::Read(Process *process, lldb::addr_t addr)
-{
-    size_t ptr_size = process->GetAddressByteSize();
-    
-    size_t size = sizeof(uint32_t)  // uint32_t flags;
-    + sizeof(uint32_t)  // uint32_t version;
-    + ptr_size          // const class_ro_t *ro;
-    + ptr_size          // union { method_list_t **method_lists; method_list_t *method_list; };
-    + ptr_size          // struct chained_property_list *properties;
-    + ptr_size          // const protocol_list_t **protocols;
-    + ptr_size          // Class firstSubclass;
-    + ptr_size;         // Class nextSiblingClass;
-    
-    DataBufferHeap buffer (size, '\0');
-    Error error;
-    
-    process->ReadMemory(addr, buffer.GetBytes(), size, error);
-    if (error.Fail())
-    {
-        return false;
-    }
-    
-    DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize());
-    
-    lldb::offset_t cursor = 0;
-    
-    m_flags             = extractor.GetU32_unchecked(&cursor);
-    m_version           = extractor.GetU32_unchecked(&cursor);
-    m_ro_ptr            = extractor.GetAddress_unchecked(&cursor);
-    m_method_list_ptr   = extractor.GetAddress_unchecked(&cursor);
-    m_properties_ptr    = extractor.GetAddress_unchecked(&cursor);
-    m_firstSubclass     = extractor.GetAddress_unchecked(&cursor);
-    m_nextSiblingClass  = extractor.GetAddress_unchecked(&cursor);
-    
-    return true;
-}
-
-bool
-ClassDescriptorV2::class_ro_t::Read(Process *process, lldb::addr_t addr)
-{
-    size_t ptr_size = process->GetAddressByteSize();
-    
-    size_t size = sizeof(uint32_t)             // uint32_t flags;
-    + sizeof(uint32_t)                         // uint32_t instanceStart;
-    + sizeof(uint32_t)                         // uint32_t instanceSize;
-    + (ptr_size == 8 ? sizeof(uint32_t) : 0)   // uint32_t reserved; // __LP64__ only
-    + ptr_size                                 // const uint8_t *ivarLayout;
-    + ptr_size                                 // const char *name;
-    + ptr_size                                 // const method_list_t *baseMethods;
-    + ptr_size                                 // const protocol_list_t *baseProtocols;
-    + ptr_size                                 // const ivar_list_t *ivars;
-    + ptr_size                                 // const uint8_t *weakIvarLayout;
-    + ptr_size;                                // const property_list_t *baseProperties;
-    
-    DataBufferHeap buffer (size, '\0');
-    Error error;
-    
-    process->ReadMemory(addr, buffer.GetBytes(), size, error);
-    if (error.Fail())
-    {
-        return false;
-    }
-    
-    DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize());
-    
-    lldb::offset_t cursor = 0;
-    
-    m_flags             = extractor.GetU32_unchecked(&cursor);
-    m_instanceStart     = extractor.GetU32_unchecked(&cursor);
-    m_instanceSize      = extractor.GetU32_unchecked(&cursor);
-    if (ptr_size == 8)
-        m_reserved      = extractor.GetU32_unchecked(&cursor);
-    else
-        m_reserved      = 0;
-    m_ivarLayout_ptr     = extractor.GetAddress_unchecked(&cursor);
-    m_name_ptr           = extractor.GetAddress_unchecked(&cursor);
-    m_baseMethods_ptr    = extractor.GetAddress_unchecked(&cursor);
-    m_baseProtocols_ptr  = extractor.GetAddress_unchecked(&cursor);
-    m_ivars_ptr          = extractor.GetAddress_unchecked(&cursor);
-    m_weakIvarLayout_ptr = extractor.GetAddress_unchecked(&cursor);
-    m_baseProperties_ptr = extractor.GetAddress_unchecked(&cursor);
-    
-    DataBufferHeap name_buf(1024, '\0');
-    
-    process->ReadCStringFromMemory(m_name_ptr, (char*)name_buf.GetBytes(), name_buf.GetByteSize(), error);
-    
-    if (error.Fail())
-    {
-        return false;
-    }
-    
-    m_name.assign((char*)name_buf.GetBytes());
-    
-    return true;
+bool ClassDescriptorV2::Read_objc_class(
+    Process *process, std::unique_ptr<objc_class_t> &objc_class) const {
+  objc_class.reset(new objc_class_t);
+
+  bool ret = objc_class->Read(process, m_objc_class_ptr);
+
+  if (!ret)
+    objc_class.reset();
+
+  return ret;
 }
 
-bool
-ClassDescriptorV2::Read_class_row (Process* process, const objc_class_t &objc_class, std::unique_ptr<class_ro_t> &class_ro, std::unique_ptr<class_rw_t> &class_rw) const
-{
-    class_ro.reset();
-    class_rw.reset();
-    
-    Error error;
-    uint32_t class_row_t_flags = process->ReadUnsignedIntegerFromMemory(objc_class.m_data_ptr, sizeof(uint32_t), 0, error);
-    if (!error.Success())
-        return false;
-    
-    if (class_row_t_flags & RW_REALIZED)
-    {
-        class_rw.reset(new class_rw_t);
-        
-        if (!class_rw->Read(process, objc_class.m_data_ptr))
-        {
-            class_rw.reset();
-            return false;
-        }
-        
-        class_ro.reset(new class_ro_t);
-        
-        if (!class_ro->Read(process, class_rw->m_ro_ptr))
-        {
-            class_rw.reset();
-            class_ro.reset();
-            return false;
-        }
-    }
-    else
-    {
-        class_ro.reset(new class_ro_t);
-        
-        if (!class_ro->Read(process, objc_class.m_data_ptr))
-        {
-            class_ro.reset();
-            return false;
-        }
-    }
-    
-    return true;
+bool ClassDescriptorV2::objc_class_t::Read(Process *process,
+                                           lldb::addr_t addr) {
+  size_t ptr_size = process->GetAddressByteSize();
+
+  size_t objc_class_size = ptr_size    // uintptr_t isa;
+                           + ptr_size  // Class superclass;
+                           + ptr_size  // void *cache;
+                           + ptr_size  // IMP *vtable;
+                           + ptr_size; // uintptr_t data_NEVER_USE;
+
+  DataBufferHeap objc_class_buf(objc_class_size, '\0');
+  Error error;
+
+  process->ReadMemory(addr, objc_class_buf.GetBytes(), objc_class_size, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  DataExtractor extractor(objc_class_buf.GetBytes(), objc_class_size,
+                          process->GetByteOrder(),
+                          process->GetAddressByteSize());
+
+  lldb::offset_t cursor = 0;
+
+  m_isa = extractor.GetAddress_unchecked(&cursor);        // uintptr_t isa;
+  m_superclass = extractor.GetAddress_unchecked(&cursor); // Class superclass;
+  m_cache_ptr = extractor.GetAddress_unchecked(&cursor);  // void *cache;
+  m_vtable_ptr = extractor.GetAddress_unchecked(&cursor); // IMP *vtable;
+  lldb::addr_t data_NEVER_USE =
+      extractor.GetAddress_unchecked(&cursor); // uintptr_t data_NEVER_USE;
+
+  m_flags = (uint8_t)(data_NEVER_USE & (lldb::addr_t)3);
+  m_data_ptr = data_NEVER_USE & ~(lldb::addr_t)3;
+
+  return true;
 }
 
-bool
-ClassDescriptorV2::method_list_t::Read(Process *process, lldb::addr_t addr)
-{
-    size_t size = sizeof(uint32_t)  // uint32_t entsize_NEVER_USE;
-    + sizeof(uint32_t); // uint32_t count;
-    
-    DataBufferHeap buffer (size, '\0');
-    Error error;
-    
-    process->ReadMemory(addr, buffer.GetBytes(), size, error);
-    if (error.Fail())
-    {
-        return false;
-    }
-    
-    DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize());
-    
-    lldb::offset_t cursor = 0;
-    
-    m_entsize   = extractor.GetU32_unchecked(&cursor) & ~(uint32_t)3;
-    m_count     = extractor.GetU32_unchecked(&cursor);
-    m_first_ptr  = addr + cursor;
-    
-    return true;
-}
-
-bool
-ClassDescriptorV2::method_t::Read(Process *process, lldb::addr_t addr)
-{
-    size_t size = GetSize(process);
-    
-    DataBufferHeap buffer (size, '\0');
-    Error error;
-    
-    process->ReadMemory(addr, buffer.GetBytes(), size, error);
-    if (error.Fail())
-    {
-        return false;
+bool ClassDescriptorV2::class_rw_t::Read(Process *process, lldb::addr_t addr) {
+  size_t ptr_size = process->GetAddressByteSize();
+
+  size_t size = sizeof(uint32_t)   // uint32_t flags;
+                + sizeof(uint32_t) // uint32_t version;
+                + ptr_size         // const class_ro_t *ro;
+                + ptr_size         // union { method_list_t **method_lists;
+                                   // method_list_t *method_list; };
+                + ptr_size         // struct chained_property_list *properties;
+                + ptr_size         // const protocol_list_t **protocols;
+                + ptr_size         // Class firstSubclass;
+                + ptr_size;        // Class nextSiblingClass;
+
+  DataBufferHeap buffer(size, '\0');
+  Error error;
+
+  process->ReadMemory(addr, buffer.GetBytes(), size, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(),
+                          process->GetAddressByteSize());
+
+  lldb::offset_t cursor = 0;
+
+  m_flags = extractor.GetU32_unchecked(&cursor);
+  m_version = extractor.GetU32_unchecked(&cursor);
+  m_ro_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_method_list_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_properties_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_firstSubclass = extractor.GetAddress_unchecked(&cursor);
+  m_nextSiblingClass = extractor.GetAddress_unchecked(&cursor);
+
+  return true;
+}
+
+bool ClassDescriptorV2::class_ro_t::Read(Process *process, lldb::addr_t addr) {
+  size_t ptr_size = process->GetAddressByteSize();
+
+  size_t size = sizeof(uint32_t)   // uint32_t flags;
+                + sizeof(uint32_t) // uint32_t instanceStart;
+                + sizeof(uint32_t) // uint32_t instanceSize;
+                + (ptr_size == 8 ? sizeof(uint32_t)
+                                 : 0) // uint32_t reserved; // __LP64__ only
+                + ptr_size            // const uint8_t *ivarLayout;
+                + ptr_size            // const char *name;
+                + ptr_size            // const method_list_t *baseMethods;
+                + ptr_size            // const protocol_list_t *baseProtocols;
+                + ptr_size            // const ivar_list_t *ivars;
+                + ptr_size            // const uint8_t *weakIvarLayout;
+                + ptr_size;           // const property_list_t *baseProperties;
+
+  DataBufferHeap buffer(size, '\0');
+  Error error;
+
+  process->ReadMemory(addr, buffer.GetBytes(), size, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(),
+                          process->GetAddressByteSize());
+
+  lldb::offset_t cursor = 0;
+
+  m_flags = extractor.GetU32_unchecked(&cursor);
+  m_instanceStart = extractor.GetU32_unchecked(&cursor);
+  m_instanceSize = extractor.GetU32_unchecked(&cursor);
+  if (ptr_size == 8)
+    m_reserved = extractor.GetU32_unchecked(&cursor);
+  else
+    m_reserved = 0;
+  m_ivarLayout_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_name_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_baseMethods_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_baseProtocols_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_ivars_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_weakIvarLayout_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_baseProperties_ptr = extractor.GetAddress_unchecked(&cursor);
+
+  DataBufferHeap name_buf(1024, '\0');
+
+  process->ReadCStringFromMemory(m_name_ptr, (char *)name_buf.GetBytes(),
+                                 name_buf.GetByteSize(), error);
+
+  if (error.Fail()) {
+    return false;
+  }
+
+  m_name.assign((char *)name_buf.GetBytes());
+
+  return true;
+}
+
+bool ClassDescriptorV2::Read_class_row(
+    Process *process, const objc_class_t &objc_class,
+    std::unique_ptr<class_ro_t> &class_ro,
+    std::unique_ptr<class_rw_t> &class_rw) const {
+  class_ro.reset();
+  class_rw.reset();
+
+  Error error;
+  uint32_t class_row_t_flags = process->ReadUnsignedIntegerFromMemory(
+      objc_class.m_data_ptr, sizeof(uint32_t), 0, error);
+  if (!error.Success())
+    return false;
+
+  if (class_row_t_flags & RW_REALIZED) {
+    class_rw.reset(new class_rw_t);
+
+    if (!class_rw->Read(process, objc_class.m_data_ptr)) {
+      class_rw.reset();
+      return false;
     }
-    
-    DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize());
-    
-    lldb::offset_t cursor = 0;
-    
-    m_name_ptr   = extractor.GetAddress_unchecked(&cursor);
-    m_types_ptr  = extractor.GetAddress_unchecked(&cursor);
-    m_imp_ptr    = extractor.GetAddress_unchecked(&cursor);
-    
-    process->ReadCStringFromMemory(m_name_ptr, m_name, error);
-    if (error.Fail())
-    {
-        return false;
+
+    class_ro.reset(new class_ro_t);
+
+    if (!class_ro->Read(process, class_rw->m_ro_ptr)) {
+      class_rw.reset();
+      class_ro.reset();
+      return false;
     }
-    
-    process->ReadCStringFromMemory(m_types_ptr, m_types, error);
-    if (error.Fail())
-    {
-        return false;
+  } else {
+    class_ro.reset(new class_ro_t);
+
+    if (!class_ro->Read(process, objc_class.m_data_ptr)) {
+      class_ro.reset();
+      return false;
     }
-    
-    return true;
+  }
+
+  return true;
 }
 
-bool
-ClassDescriptorV2::ivar_list_t::Read(Process *process, lldb::addr_t addr)
-{
-    size_t size = sizeof(uint32_t)  // uint32_t entsize;
-    + sizeof(uint32_t); // uint32_t count;
-    
-    DataBufferHeap buffer (size, '\0');
-    Error error;
-    
-    process->ReadMemory(addr, buffer.GetBytes(), size, error);
-    if (error.Fail())
-    {
-        return false;
+bool ClassDescriptorV2::method_list_t::Read(Process *process,
+                                            lldb::addr_t addr) {
+  size_t size = sizeof(uint32_t)    // uint32_t entsize_NEVER_USE;
+                + sizeof(uint32_t); // uint32_t count;
+
+  DataBufferHeap buffer(size, '\0');
+  Error error;
+
+  process->ReadMemory(addr, buffer.GetBytes(), size, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(),
+                          process->GetAddressByteSize());
+
+  lldb::offset_t cursor = 0;
+
+  m_entsize = extractor.GetU32_unchecked(&cursor) & ~(uint32_t)3;
+  m_count = extractor.GetU32_unchecked(&cursor);
+  m_first_ptr = addr + cursor;
+
+  return true;
+}
+
+bool ClassDescriptorV2::method_t::Read(Process *process, lldb::addr_t addr) {
+  size_t size = GetSize(process);
+
+  DataBufferHeap buffer(size, '\0');
+  Error error;
+
+  process->ReadMemory(addr, buffer.GetBytes(), size, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(),
+                          process->GetAddressByteSize());
+
+  lldb::offset_t cursor = 0;
+
+  m_name_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_types_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_imp_ptr = extractor.GetAddress_unchecked(&cursor);
+
+  process->ReadCStringFromMemory(m_name_ptr, m_name, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  process->ReadCStringFromMemory(m_types_ptr, m_types, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  return true;
+}
+
+bool ClassDescriptorV2::ivar_list_t::Read(Process *process, lldb::addr_t addr) {
+  size_t size = sizeof(uint32_t)    // uint32_t entsize;
+                + sizeof(uint32_t); // uint32_t count;
+
+  DataBufferHeap buffer(size, '\0');
+  Error error;
+
+  process->ReadMemory(addr, buffer.GetBytes(), size, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(),
+                          process->GetAddressByteSize());
+
+  lldb::offset_t cursor = 0;
+
+  m_entsize = extractor.GetU32_unchecked(&cursor);
+  m_count = extractor.GetU32_unchecked(&cursor);
+  m_first_ptr = addr + cursor;
+
+  return true;
+}
+
+bool ClassDescriptorV2::ivar_t::Read(Process *process, lldb::addr_t addr) {
+  size_t size = GetSize(process);
+
+  DataBufferHeap buffer(size, '\0');
+  Error error;
+
+  process->ReadMemory(addr, buffer.GetBytes(), size, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(),
+                          process->GetAddressByteSize());
+
+  lldb::offset_t cursor = 0;
+
+  m_offset_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_name_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_type_ptr = extractor.GetAddress_unchecked(&cursor);
+  m_alignment = extractor.GetU32_unchecked(&cursor);
+  m_size = extractor.GetU32_unchecked(&cursor);
+
+  process->ReadCStringFromMemory(m_name_ptr, m_name, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  process->ReadCStringFromMemory(m_type_ptr, m_type, error);
+  if (error.Fail()) {
+    return false;
+  }
+
+  return true;
+}
+
+bool ClassDescriptorV2::Describe(
+    std::function<void(ObjCLanguageRuntime::ObjCISA)> const &superclass_func,
+    std::function<bool(const char *, const char *)> const &instance_method_func,
+    std::function<bool(const char *, const char *)> const &class_method_func,
+    std::function<bool(const char *, const char *, lldb::addr_t,
+                       uint64_t)> const &ivar_func) const {
+  lldb_private::Process *process = m_runtime.GetProcess();
+
+  std::unique_ptr<objc_class_t> objc_class;
+  std::unique_ptr<class_ro_t> class_ro;
+  std::unique_ptr<class_rw_t> class_rw;
+
+  if (!Read_objc_class(process, objc_class))
+    return 0;
+  if (!Read_class_row(process, *objc_class, class_ro, class_rw))
+    return 0;
+
+  static ConstString NSObject_name("NSObject");
+
+  if (m_name != NSObject_name && superclass_func)
+    superclass_func(objc_class->m_superclass);
+
+  if (instance_method_func) {
+    std::unique_ptr<method_list_t> base_method_list;
+
+    base_method_list.reset(new method_list_t);
+    if (!base_method_list->Read(process, class_ro->m_baseMethods_ptr))
+      return false;
+
+    if (base_method_list->m_entsize != method_t::GetSize(process))
+      return false;
+
+    std::unique_ptr<method_t> method;
+    method.reset(new method_t);
+
+    for (uint32_t i = 0, e = base_method_list->m_count; i < e; ++i) {
+      method->Read(process, base_method_list->m_first_ptr +
+                                (i * base_method_list->m_entsize));
+
+      if (instance_method_func(method->m_name.c_str(), method->m_types.c_str()))
+        break;
     }
-    
-    DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize());
-    
-    lldb::offset_t cursor = 0;
-    
-    m_entsize   = extractor.GetU32_unchecked(&cursor);
-    m_count     = extractor.GetU32_unchecked(&cursor);
-    m_first_ptr = addr + cursor;
-    
-    return true;
-}
-
-bool
-ClassDescriptorV2::ivar_t::Read(Process *process, lldb::addr_t addr)
-{
-    size_t size = GetSize(process);
-    
-    DataBufferHeap buffer (size, '\0');
-    Error error;
-    
-    process->ReadMemory(addr, buffer.GetBytes(), size, error);
-    if (error.Fail())
-    {
-        return false;
+  }
+
+  if (class_method_func) {
+    AppleObjCRuntime::ClassDescriptorSP metaclass(GetMetaclass());
+
+    // We don't care about the metaclass's superclass, or its class methods.
+    // Its instance methods are
+    // our class methods.
+
+    if (metaclass) {
+      metaclass->Describe(
+          std::function<void(ObjCLanguageRuntime::ObjCISA)>(nullptr),
+          class_method_func,
+          std::function<bool(const char *, const char *)>(nullptr),
+          std::function<bool(const char *, const char *, lldb::addr_t,
+                             uint64_t)>(nullptr));
     }
-    
-    DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(), process->GetAddressByteSize());
-    
-    lldb::offset_t cursor = 0;
-    
-    m_offset_ptr = extractor.GetAddress_unchecked(&cursor);
-    m_name_ptr   = extractor.GetAddress_unchecked(&cursor);
-    m_type_ptr   = extractor.GetAddress_unchecked(&cursor);
-    m_alignment  = extractor.GetU32_unchecked(&cursor);
-    m_size       = extractor.GetU32_unchecked(&cursor);
-    
-    process->ReadCStringFromMemory(m_name_ptr, m_name, error);
-    if (error.Fail())
-    {
+  }
+
+  if (ivar_func) {
+    if (class_ro->m_ivars_ptr != 0) {
+      ivar_list_t ivar_list;
+      if (!ivar_list.Read(process, class_ro->m_ivars_ptr))
         return false;
-    }
-    
-    process->ReadCStringFromMemory(m_type_ptr, m_type, error);
-    if (error.Fail())
-    {
+
+      if (ivar_list.m_entsize != ivar_t::GetSize(process))
         return false;
+
+      ivar_t ivar;
+
+      for (uint32_t i = 0, e = ivar_list.m_count; i < e; ++i) {
+        ivar.Read(process, ivar_list.m_first_ptr + (i * ivar_list.m_entsize));
+
+        if (ivar_func(ivar.m_name.c_str(), ivar.m_type.c_str(),
+                      ivar.m_offset_ptr, ivar.m_size))
+          break;
+      }
     }
-    
-    return true;
+  }
+
+  return true;
 }
 
-bool
-ClassDescriptorV2::Describe (std::function <void (ObjCLanguageRuntime::ObjCISA)> const &superclass_func,
-                             std::function <bool (const char *, const char *)> const &instance_method_func,
-                             std::function <bool (const char *, const char *)> const &class_method_func,
-                             std::function <bool (const char *, const char *, lldb::addr_t, uint64_t)> const &ivar_func) const
-{
+ConstString ClassDescriptorV2::GetClassName() {
+  if (!m_name) {
     lldb_private::Process *process = m_runtime.GetProcess();
-    
-    std::unique_ptr<objc_class_t> objc_class;
-    std::unique_ptr<class_ro_t> class_ro;
-    std::unique_ptr<class_rw_t> class_rw;
-    
-    if (!Read_objc_class(process, objc_class))
-        return 0;
-    if (!Read_class_row(process, *objc_class, class_ro, class_rw))
-        return 0;
-    
-    static ConstString NSObject_name("NSObject");
-    
-    if (m_name != NSObject_name && superclass_func)
-        superclass_func(objc_class->m_superclass);
-    
-    if (instance_method_func)
-    {
-        std::unique_ptr<method_list_t> base_method_list;
-        
-        base_method_list.reset(new method_list_t);
-        if (!base_method_list->Read(process, class_ro->m_baseMethods_ptr))
-            return false;
-        
-        if (base_method_list->m_entsize != method_t::GetSize(process))
-            return false;
-        
-        std::unique_ptr<method_t> method;
-        method.reset(new method_t);
-        
-        for (uint32_t i = 0, e = base_method_list->m_count; i < e; ++i)
-        {
-            method->Read(process, base_method_list->m_first_ptr + (i * base_method_list->m_entsize));
-            
-            if (instance_method_func(method->m_name.c_str(), method->m_types.c_str()))
-                break;
-        }
-    }
-    
-    if (class_method_func)
-    {
-        AppleObjCRuntime::ClassDescriptorSP metaclass(GetMetaclass());
-        
-        // We don't care about the metaclass's superclass, or its class methods.  Its instance methods are
-        // our class methods.
-        
-        if (metaclass) {
-            metaclass->Describe(std::function <void (ObjCLanguageRuntime::ObjCISA)> (nullptr),
-                                class_method_func,
-                                std::function <bool (const char *, const char *)> (nullptr),
-                                std::function <bool (const char *, const char *, lldb::addr_t, uint64_t)> (nullptr));
-        }
-    }
-    
-    if (ivar_func)
-    {
-        if (class_ro->m_ivars_ptr != 0)
-        {            
-            ivar_list_t ivar_list;
-            if (!ivar_list.Read(process, class_ro->m_ivars_ptr))
-                return false;
-            
-            if (ivar_list.m_entsize != ivar_t::GetSize(process))
-                return false;
-            
-            ivar_t ivar;
-            
-            for (uint32_t i = 0, e = ivar_list.m_count; i < e; ++i)
-            {
-                ivar.Read(process, ivar_list.m_first_ptr + (i * ivar_list.m_entsize));
-                
-                if (ivar_func(ivar.m_name.c_str(), ivar.m_type.c_str(), ivar.m_offset_ptr, ivar.m_size))
-                    break;
-            }
-        }
+
+    if (process) {
+      std::unique_ptr<objc_class_t> objc_class;
+      std::unique_ptr<class_ro_t> class_ro;
+      std::unique_ptr<class_rw_t> class_rw;
+
+      if (!Read_objc_class(process, objc_class))
+        return m_name;
+      if (!Read_class_row(process, *objc_class, class_ro, class_rw))
+        return m_name;
+
+      m_name = ConstString(class_ro->m_name.c_str());
     }
-    
-    return true;
+  }
+  return m_name;
 }
 
-ConstString
-ClassDescriptorV2::GetClassName ()
-{
-    if (!m_name)
-    {
-        lldb_private::Process *process = m_runtime.GetProcess();
-        
-        if (process)
-        {
-            std::unique_ptr<objc_class_t> objc_class;
-            std::unique_ptr<class_ro_t> class_ro;
-            std::unique_ptr<class_rw_t> class_rw;
-            
-            if (!Read_objc_class(process, objc_class))
-                return m_name;
-            if (!Read_class_row(process, *objc_class, class_ro, class_rw))
-                return m_name;
-            
-            m_name = ConstString(class_ro->m_name.c_str());
-        }
-    }
-    return m_name;
+ObjCLanguageRuntime::ClassDescriptorSP ClassDescriptorV2::GetSuperclass() {
+  lldb_private::Process *process = m_runtime.GetProcess();
+
+  if (!process)
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+
+  std::unique_ptr<objc_class_t> objc_class;
+
+  if (!Read_objc_class(process, objc_class))
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+
+  return m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(
+      objc_class->m_superclass);
 }
 
-ObjCLanguageRuntime::ClassDescriptorSP
-ClassDescriptorV2::GetSuperclass ()
-{
-    lldb_private::Process *process = m_runtime.GetProcess();
-    
-    if (!process)
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    
-    std::unique_ptr<objc_class_t> objc_class;
-    
-    if (!Read_objc_class(process, objc_class))
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    
-    return m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(objc_class->m_superclass);
+ObjCLanguageRuntime::ClassDescriptorSP ClassDescriptorV2::GetMetaclass() const {
+  lldb_private::Process *process = m_runtime.GetProcess();
+
+  if (!process)
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+
+  std::unique_ptr<objc_class_t> objc_class;
+
+  if (!Read_objc_class(process, objc_class))
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+
+  lldb::addr_t candidate_isa = m_runtime.GetPointerISA(objc_class->m_isa);
+
+  return ObjCLanguageRuntime::ClassDescriptorSP(
+      new ClassDescriptorV2(m_runtime, candidate_isa, nullptr));
 }
 
-ObjCLanguageRuntime::ClassDescriptorSP
-ClassDescriptorV2::GetMetaclass () const
-{
-    lldb_private::Process *process = m_runtime.GetProcess();
-    
-    if (!process)
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    
+uint64_t ClassDescriptorV2::GetInstanceSize() {
+  lldb_private::Process *process = m_runtime.GetProcess();
+
+  if (process) {
     std::unique_ptr<objc_class_t> objc_class;
-    
-    if (!Read_objc_class(process, objc_class))
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    
-    lldb::addr_t candidate_isa = m_runtime.GetPointerISA(objc_class->m_isa);
-    
-    return ObjCLanguageRuntime::ClassDescriptorSP(new ClassDescriptorV2(m_runtime, candidate_isa, nullptr));
-}
+    std::unique_ptr<class_ro_t> class_ro;
+    std::unique_ptr<class_rw_t> class_rw;
 
-uint64_t
-ClassDescriptorV2::GetInstanceSize ()
-{
-    lldb_private::Process *process = m_runtime.GetProcess();
-    
-    if (process)
-    {
-        std::unique_ptr<objc_class_t> objc_class;
-        std::unique_ptr<class_ro_t> class_ro;
-        std::unique_ptr<class_rw_t> class_rw;
-        
-        if (!Read_objc_class(process, objc_class))
-            return 0;
-        if (!Read_class_row(process, *objc_class, class_ro, class_rw))
-            return 0;
-        
-        return class_ro->m_instanceSize;
-    }
-    
-    return 0;
-}
+    if (!Read_objc_class(process, objc_class))
+      return 0;
+    if (!Read_class_row(process, *objc_class, class_ro, class_rw))
+      return 0;
 
-ClassDescriptorV2::iVarsStorage::iVarsStorage() : m_filled(false), m_ivars(), m_mutex()
-{
-}
+    return class_ro->m_instanceSize;
+  }
 
-size_t
-ClassDescriptorV2::iVarsStorage::size ()
-{
-    return m_ivars.size();
+  return 0;
 }
 
-ClassDescriptorV2::iVarDescriptor&
-ClassDescriptorV2::iVarsStorage::operator[] (size_t idx)
-{
-    return m_ivars[idx];
+ClassDescriptorV2::iVarsStorage::iVarsStorage()
+    : m_filled(false), m_ivars(), m_mutex() {}
+
+size_t ClassDescriptorV2::iVarsStorage::size() { return m_ivars.size(); }
+
+ClassDescriptorV2::iVarDescriptor &ClassDescriptorV2::iVarsStorage::
+operator[](size_t idx) {
+  return m_ivars[idx];
+}
+
+void ClassDescriptorV2::iVarsStorage::fill(AppleObjCRuntimeV2 &runtime,
+                                           ClassDescriptorV2 &descriptor) {
+  if (m_filled)
+    return;
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES | LIBLLDB_LOG_VERBOSE));
+  if (log)
+    log->Printf("[ClassDescriptorV2::iVarsStorage::fill] class_name = %s",
+                descriptor.GetClassName().AsCString("<unknown"));
+  m_filled = true;
+  ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp(
+      runtime.GetEncodingToType());
+  Process *process(runtime.GetProcess());
+  if (!encoding_to_type_sp)
+    return;
+  descriptor.Describe(nullptr, nullptr, nullptr, [this, process,
+                                                  encoding_to_type_sp,
+                                                  log](const char *name,
+                                                       const char *type,
+                                                       lldb::addr_t offset_ptr,
+                                                       uint64_t size) -> bool {
+    const bool for_expression = false;
+    const bool stop_loop = false;
+    if (log)
+      log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding "
+                  "= %s, offset_ptr = %" PRIx64 ", size = %" PRIu64,
+                  name, type, offset_ptr, size);
+    CompilerType ivar_type =
+        encoding_to_type_sp->RealizeType(type, for_expression);
+    if (ivar_type) {
+      if (log)
+        log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, "
+                    "encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64
+                    " , type_size = %" PRIu64,
+                    name, type, offset_ptr, size,
+                    ivar_type.GetByteSize(nullptr));
+      Scalar offset_scalar;
+      Error error;
+      const int offset_ptr_size = 4;
+      const bool is_signed = false;
+      size_t read = process->ReadScalarIntegerFromMemory(
+          offset_ptr, offset_ptr_size, is_signed, offset_scalar, error);
+      if (error.Success() && 4 == read) {
+        if (log)
+          log->Printf(
+              "[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64
+              " --> %" PRIu32,
+              offset_ptr, offset_scalar.SInt());
+        m_ivars.push_back(
+            {ConstString(name), ivar_type, size, offset_scalar.SInt()});
+      } else if (log)
+        log->Printf(
+            "[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64
+            " --> read fail, read = %zu",
+            offset_ptr, read);
+    }
+    return stop_loop;
+  });
 }
 
-void
-ClassDescriptorV2::iVarsStorage::fill (AppleObjCRuntimeV2& runtime, ClassDescriptorV2& descriptor)
-{
-    if (m_filled)
-        return;
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES | LIBLLDB_LOG_VERBOSE));
-    if (log)
-        log->Printf("[ClassDescriptorV2::iVarsStorage::fill] class_name = %s", descriptor.GetClassName().AsCString("<unknown"));
-    m_filled = true;
-    ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp(runtime.GetEncodingToType());
-    Process* process(runtime.GetProcess());
-    if (!encoding_to_type_sp)
-        return;
-    descriptor.Describe(nullptr,
-                        nullptr,
-                        nullptr,
-                        [this,process,encoding_to_type_sp,log](const char * name, const char * type, lldb::addr_t offset_ptr, uint64_t size) -> bool {
-                 const bool for_expression = false;
-                 const bool stop_loop = false;
-                 if (log)
-                     log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64,
-                                 name,type,offset_ptr,size);
-                 CompilerType ivar_type = encoding_to_type_sp->RealizeType(type, for_expression);
-                 if (ivar_type)
-                 {
-                     if (log)
-                         log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64 " , type_size = %" PRIu64,
-                                     name,type,offset_ptr,size,ivar_type.GetByteSize(nullptr));
-                     Scalar offset_scalar;
-                     Error error;
-                     const int offset_ptr_size = 4;
-                     const bool is_signed = false;
-                     size_t read = process->ReadScalarIntegerFromMemory(offset_ptr, offset_ptr_size, is_signed, offset_scalar, error);
-                     if (error.Success() && 4 == read)
-                     {
-                         if (log)
-                             log->Printf("[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64 " --> %" PRIu32,
-                                         offset_ptr, offset_scalar.SInt());
-                         m_ivars.push_back({ ConstString(name), ivar_type, size, offset_scalar.SInt() });
-                     }
-                     else if (log)
-                         log->Printf("[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64 " --> read fail, read = %zu",
-                                     offset_ptr, read);
-                 }
-                 return stop_loop;
-             });
-}
-
-void
-ClassDescriptorV2::GetIVarInformation ()
-{
-    m_ivars_storage.fill(m_runtime, *this);
+void ClassDescriptorV2::GetIVarInformation() {
+  m_ivars_storage.fill(m_runtime, *this);
 }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h Tue Sep  6 15:57:50 2016
@@ -16,397 +16,320 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "AppleObjCRuntimeV2.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
-class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor
-{
+class ClassDescriptorV2 : public ObjCLanguageRuntime::ClassDescriptor {
 public:
-    friend class lldb_private::AppleObjCRuntimeV2;
-    
-    ~ClassDescriptorV2() override = default;
-
-    ConstString
-    GetClassName() override;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP
-    GetSuperclass() override;
-    
-    ObjCLanguageRuntime::ClassDescriptorSP
-    GetMetaclass() const override;
-    
-    bool
-    IsValid() override
-    {
-        return true;    // any Objective-C v2 runtime class descriptor we vend is valid
-    }
-    
-    // a custom descriptor is used for tagged pointers
-    bool
-    GetTaggedPointerInfo(uint64_t* info_bits = nullptr,
-                         uint64_t* value_bits = nullptr,
-                         uint64_t* payload = nullptr) override
-    {
-        return false;
-    }
-    
-    uint64_t
-    GetInstanceSize() override;
-    
-    ObjCLanguageRuntime::ObjCISA
-    GetISA() override
-    {
-        return m_objc_class_ptr;
-    }
-    
-    bool
-    Describe(std::function <void (ObjCLanguageRuntime::ObjCISA)> const &superclass_func,
-             std::function <bool (const char *, const char *)> const &instance_method_func,
-             std::function <bool (const char *, const char *)> const &class_method_func,
-             std::function <bool (const char *, const char *,
-             lldb::addr_t, uint64_t)> const &ivar_func) const override;
-
-    size_t
-    GetNumIVars() override
-    {
-        GetIVarInformation();
-        return m_ivars_storage.size();
-    }
-    
-    iVarDescriptor
-    GetIVarAtIndex(size_t idx) override
-    {
-        if (idx >= GetNumIVars())
-            return iVarDescriptor();
-        return m_ivars_storage[idx];
-    }
-    
+  friend class lldb_private::AppleObjCRuntimeV2;
+
+  ~ClassDescriptorV2() override = default;
+
+  ConstString GetClassName() override;
+
+  ObjCLanguageRuntime::ClassDescriptorSP GetSuperclass() override;
+
+  ObjCLanguageRuntime::ClassDescriptorSP GetMetaclass() const override;
+
+  bool IsValid() override {
+    return true; // any Objective-C v2 runtime class descriptor we vend is valid
+  }
+
+  // a custom descriptor is used for tagged pointers
+  bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
+                            uint64_t *value_bits = nullptr,
+                            uint64_t *payload = nullptr) override {
+    return false;
+  }
+
+  uint64_t GetInstanceSize() override;
+
+  ObjCLanguageRuntime::ObjCISA GetISA() override { return m_objc_class_ptr; }
+
+  bool Describe(
+      std::function<void(ObjCLanguageRuntime::ObjCISA)> const &superclass_func,
+      std::function<bool(const char *, const char *)> const
+          &instance_method_func,
+      std::function<bool(const char *, const char *)> const &class_method_func,
+      std::function<bool(const char *, const char *, lldb::addr_t,
+                         uint64_t)> const &ivar_func) const override;
+
+  size_t GetNumIVars() override {
+    GetIVarInformation();
+    return m_ivars_storage.size();
+  }
+
+  iVarDescriptor GetIVarAtIndex(size_t idx) override {
+    if (idx >= GetNumIVars())
+      return iVarDescriptor();
+    return m_ivars_storage[idx];
+  }
+
 protected:
-    void
-    GetIVarInformation ();
-    
+  void GetIVarInformation();
+
 private:
-    static const uint32_t RW_REALIZED = (1 << 31);
-    
-    struct objc_class_t {
-        ObjCLanguageRuntime::ObjCISA    m_isa;              // The class's metaclass.
-        ObjCLanguageRuntime::ObjCISA    m_superclass;
-        lldb::addr_t                    m_cache_ptr;
-        lldb::addr_t                    m_vtable_ptr;
-        lldb::addr_t                    m_data_ptr;
-        uint8_t                         m_flags;
-        
-        objc_class_t () :
-        m_isa (0),
-        m_superclass (0),
-        m_cache_ptr (0),
-        m_vtable_ptr (0),
-        m_data_ptr (0),
-        m_flags (0)
-        {
-        }
-        
-        void
-        Clear()
-        {
-            m_isa = 0;
-            m_superclass = 0;
-            m_cache_ptr = 0;
-            m_vtable_ptr = 0;
-            m_data_ptr = 0;
-            m_flags = 0;
-        }
-        
-        bool
-        Read(Process *process, lldb::addr_t addr);
-    };
-    
-    struct class_ro_t {
-        uint32_t                        m_flags;
-        uint32_t                        m_instanceStart;
-        uint32_t                        m_instanceSize;
-        uint32_t                        m_reserved;
-        
-        lldb::addr_t                    m_ivarLayout_ptr;
-        lldb::addr_t                    m_name_ptr;
-        lldb::addr_t                    m_baseMethods_ptr;
-        lldb::addr_t                    m_baseProtocols_ptr;
-        lldb::addr_t                    m_ivars_ptr;
-        
-        lldb::addr_t                    m_weakIvarLayout_ptr;
-        lldb::addr_t                    m_baseProperties_ptr;
-        
-        std::string                     m_name;
-        
-        bool
-        Read(Process *process, lldb::addr_t addr);
-    };
-    
-    struct class_rw_t {
-        uint32_t                        m_flags;
-        uint32_t                        m_version;
-        
-        lldb::addr_t                    m_ro_ptr;
-        union {
-            lldb::addr_t                m_method_list_ptr;
-            lldb::addr_t                m_method_lists_ptr;
-        };
-        lldb::addr_t                    m_properties_ptr;
-        lldb::addr_t                    m_protocols_ptr;
-        
-        ObjCLanguageRuntime::ObjCISA    m_firstSubclass;
-        ObjCLanguageRuntime::ObjCISA    m_nextSiblingClass;
-        
-        bool
-        Read(Process *process, lldb::addr_t addr);
-    };
-    
-    struct method_list_t
-    {
-        uint32_t        m_entsize;
-        uint32_t        m_count;
-        lldb::addr_t    m_first_ptr;
-        
-        bool
-        Read(Process *process, lldb::addr_t addr);
-    };
-    
-    struct method_t
-    {
-        lldb::addr_t    m_name_ptr;
-        lldb::addr_t    m_types_ptr;
-        lldb::addr_t    m_imp_ptr;
-        
-        std::string     m_name;
-        std::string     m_types;
-        
-        static size_t GetSize(Process *process)
-        {
-            size_t ptr_size = process->GetAddressByteSize();
-            
-            return ptr_size     // SEL name;
-            + ptr_size   // const char *types;
-            + ptr_size;  // IMP imp;
-        }
-        
-        bool
-        Read(Process *process, lldb::addr_t addr);
-    };
-    
-    struct ivar_list_t
-    {
-        uint32_t        m_entsize;
-        uint32_t        m_count;
-        lldb::addr_t    m_first_ptr;
-        
-        bool Read(Process *process, lldb::addr_t addr);
-    };
-    
-    struct ivar_t
-    {
-        lldb::addr_t    m_offset_ptr;
-        lldb::addr_t    m_name_ptr;
-        lldb::addr_t    m_type_ptr;
-        uint32_t        m_alignment;
-        uint32_t        m_size;
-        
-        std::string     m_name;
-        std::string     m_type;
-        
-        static size_t GetSize(Process *process)
-        {
-            size_t ptr_size = process->GetAddressByteSize();
-            
-            return ptr_size             // uintptr_t *offset;
-            + ptr_size             // const char *name;
-            + ptr_size             // const char *type;
-            + sizeof(uint32_t)     // uint32_t alignment;
-            + sizeof(uint32_t);    // uint32_t size;
-        }
-        
-        bool
-        Read(Process *process, lldb::addr_t addr);
-    };
-    
-    class iVarsStorage
-    {
-    public:
-        iVarsStorage ();
-        
-        size_t
-        size ();
-        
-        iVarDescriptor&
-        operator[] (size_t idx);
-        
-        void
-        fill (AppleObjCRuntimeV2& runtime, ClassDescriptorV2& descriptor);
-        
-    private:
-        bool m_filled;
-        std::vector<iVarDescriptor> m_ivars;
-        std::recursive_mutex m_mutex;
+  static const uint32_t RW_REALIZED = (1 << 31);
+
+  struct objc_class_t {
+    ObjCLanguageRuntime::ObjCISA m_isa; // The class's metaclass.
+    ObjCLanguageRuntime::ObjCISA m_superclass;
+    lldb::addr_t m_cache_ptr;
+    lldb::addr_t m_vtable_ptr;
+    lldb::addr_t m_data_ptr;
+    uint8_t m_flags;
+
+    objc_class_t()
+        : m_isa(0), m_superclass(0), m_cache_ptr(0), m_vtable_ptr(0),
+          m_data_ptr(0), m_flags(0) {}
+
+    void Clear() {
+      m_isa = 0;
+      m_superclass = 0;
+      m_cache_ptr = 0;
+      m_vtable_ptr = 0;
+      m_data_ptr = 0;
+      m_flags = 0;
+    }
+
+    bool Read(Process *process, lldb::addr_t addr);
+  };
+
+  struct class_ro_t {
+    uint32_t m_flags;
+    uint32_t m_instanceStart;
+    uint32_t m_instanceSize;
+    uint32_t m_reserved;
+
+    lldb::addr_t m_ivarLayout_ptr;
+    lldb::addr_t m_name_ptr;
+    lldb::addr_t m_baseMethods_ptr;
+    lldb::addr_t m_baseProtocols_ptr;
+    lldb::addr_t m_ivars_ptr;
+
+    lldb::addr_t m_weakIvarLayout_ptr;
+    lldb::addr_t m_baseProperties_ptr;
+
+    std::string m_name;
+
+    bool Read(Process *process, lldb::addr_t addr);
+  };
+
+  struct class_rw_t {
+    uint32_t m_flags;
+    uint32_t m_version;
+
+    lldb::addr_t m_ro_ptr;
+    union {
+      lldb::addr_t m_method_list_ptr;
+      lldb::addr_t m_method_lists_ptr;
     };
-    
-    // The constructor should only be invoked by the runtime as it builds its caches
-    // or populates them.  A ClassDescriptorV2 should only ever exist in a cache.
-    ClassDescriptorV2(AppleObjCRuntimeV2 &runtime, ObjCLanguageRuntime::ObjCISA isa, const char *name) :
-        m_runtime (runtime),
-        m_objc_class_ptr (isa),
-        m_name (name),
-        m_ivars_storage()
-    {
+    lldb::addr_t m_properties_ptr;
+    lldb::addr_t m_protocols_ptr;
+
+    ObjCLanguageRuntime::ObjCISA m_firstSubclass;
+    ObjCLanguageRuntime::ObjCISA m_nextSiblingClass;
+
+    bool Read(Process *process, lldb::addr_t addr);
+  };
+
+  struct method_list_t {
+    uint32_t m_entsize;
+    uint32_t m_count;
+    lldb::addr_t m_first_ptr;
+
+    bool Read(Process *process, lldb::addr_t addr);
+  };
+
+  struct method_t {
+    lldb::addr_t m_name_ptr;
+    lldb::addr_t m_types_ptr;
+    lldb::addr_t m_imp_ptr;
+
+    std::string m_name;
+    std::string m_types;
+
+    static size_t GetSize(Process *process) {
+      size_t ptr_size = process->GetAddressByteSize();
+
+      return ptr_size    // SEL name;
+             + ptr_size  // const char *types;
+             + ptr_size; // IMP imp;
+    }
+
+    bool Read(Process *process, lldb::addr_t addr);
+  };
+
+  struct ivar_list_t {
+    uint32_t m_entsize;
+    uint32_t m_count;
+    lldb::addr_t m_first_ptr;
+
+    bool Read(Process *process, lldb::addr_t addr);
+  };
+
+  struct ivar_t {
+    lldb::addr_t m_offset_ptr;
+    lldb::addr_t m_name_ptr;
+    lldb::addr_t m_type_ptr;
+    uint32_t m_alignment;
+    uint32_t m_size;
+
+    std::string m_name;
+    std::string m_type;
+
+    static size_t GetSize(Process *process) {
+      size_t ptr_size = process->GetAddressByteSize();
+
+      return ptr_size            // uintptr_t *offset;
+             + ptr_size          // const char *name;
+             + ptr_size          // const char *type;
+             + sizeof(uint32_t)  // uint32_t alignment;
+             + sizeof(uint32_t); // uint32_t size;
     }
-    
-    bool
-    Read_objc_class (Process* process, std::unique_ptr<objc_class_t> &objc_class) const;
-    
-    bool
-    Read_class_row (Process* process, const objc_class_t &objc_class, std::unique_ptr<class_ro_t> &class_ro, std::unique_ptr<class_rw_t> &class_rw) const;
-    
-    AppleObjCRuntimeV2 &m_runtime;          // The runtime, so we can read information lazily.
-    lldb::addr_t        m_objc_class_ptr;   // The address of the objc_class_t.  (I.e., objects of this class type have this as their ISA)
-    ConstString         m_name;             // May be NULL
-    iVarsStorage        m_ivars_storage;
+
+    bool Read(Process *process, lldb::addr_t addr);
+  };
+
+  class iVarsStorage {
+  public:
+    iVarsStorage();
+
+    size_t size();
+
+    iVarDescriptor &operator[](size_t idx);
+
+    void fill(AppleObjCRuntimeV2 &runtime, ClassDescriptorV2 &descriptor);
+
+  private:
+    bool m_filled;
+    std::vector<iVarDescriptor> m_ivars;
+    std::recursive_mutex m_mutex;
+  };
+
+  // The constructor should only be invoked by the runtime as it builds its
+  // caches
+  // or populates them.  A ClassDescriptorV2 should only ever exist in a cache.
+  ClassDescriptorV2(AppleObjCRuntimeV2 &runtime,
+                    ObjCLanguageRuntime::ObjCISA isa, const char *name)
+      : m_runtime(runtime), m_objc_class_ptr(isa), m_name(name),
+        m_ivars_storage() {}
+
+  bool Read_objc_class(Process *process,
+                       std::unique_ptr<objc_class_t> &objc_class) const;
+
+  bool Read_class_row(Process *process, const objc_class_t &objc_class,
+                      std::unique_ptr<class_ro_t> &class_ro,
+                      std::unique_ptr<class_rw_t> &class_rw) const;
+
+  AppleObjCRuntimeV2
+      &m_runtime; // The runtime, so we can read information lazily.
+  lldb::addr_t m_objc_class_ptr; // The address of the objc_class_t.  (I.e.,
+                                 // objects of this class type have this as
+                                 // their ISA)
+  ConstString m_name;            // May be NULL
+  iVarsStorage m_ivars_storage;
 };
 
 // tagged pointer descriptor
-class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor
-{
+class ClassDescriptorV2Tagged : public ObjCLanguageRuntime::ClassDescriptor {
 public:
-    ClassDescriptorV2Tagged (ConstString class_name,
-                             uint64_t payload)
-    {
-        m_name = class_name;
-        if (!m_name)
-        {
-            m_valid = false;
-            return;
-        }
-        m_valid = true;
-        m_payload = payload;
-        m_info_bits = (m_payload & 0xF0ULL) >> 4;
-        m_value_bits = (m_payload & ~0x0000000000000000FFULL) >> 8;
-    }
-    
-    ClassDescriptorV2Tagged (ObjCLanguageRuntime::ClassDescriptorSP actual_class_sp,
-                             uint64_t payload)
-    {
-        if (!actual_class_sp)
-        {
-            m_valid = false;
-            return;
-        }
-        m_name = actual_class_sp->GetClassName();
-        if (!m_name)
-        {
-            m_valid = false;
-            return;
-        }
-        m_valid = true;
-        m_payload = payload;
-        m_info_bits = (m_payload & 0x0FULL);
-        m_value_bits = (m_payload & ~0x0FULL) >> 4;
-    }
-    
-    ~ClassDescriptorV2Tagged() override = default;
+  ClassDescriptorV2Tagged(ConstString class_name, uint64_t payload) {
+    m_name = class_name;
+    if (!m_name) {
+      m_valid = false;
+      return;
+    }
+    m_valid = true;
+    m_payload = payload;
+    m_info_bits = (m_payload & 0xF0ULL) >> 4;
+    m_value_bits = (m_payload & ~0x0000000000000000FFULL) >> 8;
+  }
 
-    ConstString
-    GetClassName() override
-    {
-        return m_name;
-    }
-    
-    ObjCLanguageRuntime::ClassDescriptorSP
-    GetSuperclass() override
-    {
-        // tagged pointers can represent a class that has a superclass, but since that information is not
-        // stored in the object itself, we would have to query the runtime to discover the hierarchy
-        // for the time being, we skip this step in the interest of static discovery
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    }
-    
-    ObjCLanguageRuntime::ClassDescriptorSP
-    GetMetaclass() const override
-    {
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    }
-    
-    bool
-    IsValid() override
-    {
-        return m_valid;
-    }
-    
-    bool
-    IsKVO() override
-    {
-        return false; // tagged pointers are not KVO'ed
-    }
-    
-    bool
-    IsCFType() override
-    {
-        return false; // tagged pointers are not CF objects
-    }
-    
-    bool
-    GetTaggedPointerInfo(uint64_t* info_bits = nullptr,
-                         uint64_t* value_bits = nullptr,
-                         uint64_t* payload = nullptr) override
-    {
-        if (info_bits)
-            *info_bits = GetInfoBits();
-        if (value_bits)
-            *value_bits = GetValueBits();
-        if (payload)
-            *payload = GetPayload();
-        return true;
-    }
-    
-    uint64_t
-    GetInstanceSize() override
-    {
-        return (IsValid() ? m_pointer_size : 0);
-    }
-    
-    ObjCLanguageRuntime::ObjCISA
-    GetISA() override
-    {
-        return 0; // tagged pointers have no ISA
-    }
-    
-    // these calls are not part of any formal tagged pointers specification
-    virtual uint64_t
-    GetValueBits ()
-    {
-        return (IsValid() ? m_value_bits : 0);
-    }
-    
-    virtual uint64_t
-    GetInfoBits ()
-    {
-        return (IsValid() ? m_info_bits : 0);
-    }
-    
-    virtual uint64_t
-    GetPayload ()
-    {
-        return (IsValid() ? m_payload : 0);
-    }
+  ClassDescriptorV2Tagged(
+      ObjCLanguageRuntime::ClassDescriptorSP actual_class_sp,
+      uint64_t payload) {
+    if (!actual_class_sp) {
+      m_valid = false;
+      return;
+    }
+    m_name = actual_class_sp->GetClassName();
+    if (!m_name) {
+      m_valid = false;
+      return;
+    }
+    m_valid = true;
+    m_payload = payload;
+    m_info_bits = (m_payload & 0x0FULL);
+    m_value_bits = (m_payload & ~0x0FULL) >> 4;
+  }
+
+  ~ClassDescriptorV2Tagged() override = default;
+
+  ConstString GetClassName() override { return m_name; }
+
+  ObjCLanguageRuntime::ClassDescriptorSP GetSuperclass() override {
+    // tagged pointers can represent a class that has a superclass, but since
+    // that information is not
+    // stored in the object itself, we would have to query the runtime to
+    // discover the hierarchy
+    // for the time being, we skip this step in the interest of static discovery
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+  }
+
+  ObjCLanguageRuntime::ClassDescriptorSP GetMetaclass() const override {
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+  }
+
+  bool IsValid() override { return m_valid; }
+
+  bool IsKVO() override {
+    return false; // tagged pointers are not KVO'ed
+  }
+
+  bool IsCFType() override {
+    return false; // tagged pointers are not CF objects
+  }
+
+  bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
+                            uint64_t *value_bits = nullptr,
+                            uint64_t *payload = nullptr) override {
+    if (info_bits)
+      *info_bits = GetInfoBits();
+    if (value_bits)
+      *value_bits = GetValueBits();
+    if (payload)
+      *payload = GetPayload();
+    return true;
+  }
+
+  uint64_t GetInstanceSize() override {
+    return (IsValid() ? m_pointer_size : 0);
+  }
+
+  ObjCLanguageRuntime::ObjCISA GetISA() override {
+    return 0; // tagged pointers have no ISA
+  }
+
+  // these calls are not part of any formal tagged pointers specification
+  virtual uint64_t GetValueBits() { return (IsValid() ? m_value_bits : 0); }
+
+  virtual uint64_t GetInfoBits() { return (IsValid() ? m_info_bits : 0); }
+
+  virtual uint64_t GetPayload() { return (IsValid() ? m_payload : 0); }
 
 private:
-    ConstString m_name;
-    uint8_t m_pointer_size;
-    bool m_valid;
-    uint64_t m_info_bits;
-    uint64_t m_value_bits;
-    uint64_t m_payload;
+  ConstString m_name;
+  uint8_t m_pointer_size;
+  bool m_valid;
+  uint64_t m_info_bits;
+  uint64_t m_value_bits;
+  uint64_t m_payload;
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_AppleObjCClassDescriptorV2_h_

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp Tue Sep  6 15:57:50 2016
@@ -23,659 +23,628 @@
 
 using namespace lldb_private;
 
-class lldb_private::AppleObjCExternalASTSource : public ClangExternalASTSourceCommon
-{
+class lldb_private::AppleObjCExternalASTSource
+    : public ClangExternalASTSourceCommon {
 public:
-    AppleObjCExternalASTSource (AppleObjCDeclVendor &decl_vendor) :
-        m_decl_vendor(decl_vendor)
-    {
-    }
+  AppleObjCExternalASTSource(AppleObjCDeclVendor &decl_vendor)
+      : m_decl_vendor(decl_vendor) {}
 
-    bool
-    FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName name) override
-    {
-        static unsigned int invocation_id = 0;
-        unsigned int current_id = invocation_id++;
+  bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx,
+                                      clang::DeclarationName name) override {
+    static unsigned int invocation_id = 0;
+    unsigned int current_id = invocation_id++;
 
-        Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
+    Log *log(GetLogIfAllCategoriesSet(
+        LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
 
-        if (log)
-        {
-            log->Printf("AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
-                        current_id,
-                        static_cast<void*>(&decl_ctx->getParentASTContext()),
-                        name.getAsString().c_str(), decl_ctx->getDeclKindName(),
-                        static_cast<const void*>(decl_ctx));
-        }
+    if (log) {
+      log->Printf("AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%"
+                  "u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
+                  current_id,
+                  static_cast<void *>(&decl_ctx->getParentASTContext()),
+                  name.getAsString().c_str(), decl_ctx->getDeclKindName(),
+                  static_cast<const void *>(decl_ctx));
+    }
+
+    do {
+      const clang::ObjCInterfaceDecl *interface_decl =
+          llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl_ctx);
 
-        do
-        {
-            const clang::ObjCInterfaceDecl *interface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(decl_ctx);
+      if (!interface_decl)
+        break;
 
-            if (!interface_decl)
-                break;
+      clang::ObjCInterfaceDecl *non_const_interface_decl =
+          const_cast<clang::ObjCInterfaceDecl *>(interface_decl);
 
-            clang::ObjCInterfaceDecl *non_const_interface_decl = const_cast<clang::ObjCInterfaceDecl*>(interface_decl);
+      if (!m_decl_vendor.FinishDecl(non_const_interface_decl))
+        break;
 
-            if (!m_decl_vendor.FinishDecl(non_const_interface_decl))
-                break;
+      clang::DeclContext::lookup_result result =
+          non_const_interface_decl->lookup(name);
 
-            clang::DeclContext::lookup_result result = non_const_interface_decl->lookup(name);
+      return (result.size() != 0);
+    } while (0);
 
-            return (result.size() != 0);
-        }
-        while(0);
+    SetNoExternalVisibleDeclsForName(decl_ctx, name);
+    return false;
+  }
 
-        SetNoExternalVisibleDeclsForName(decl_ctx, name);
-        return false;
+  void CompleteType(clang::TagDecl *tag_decl) override {
+    static unsigned int invocation_id = 0;
+    unsigned int current_id = invocation_id++;
+
+    Log *log(GetLogIfAllCategoriesSet(
+        LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
+
+    if (log) {
+      log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on "
+                  "(ASTContext*)%p Completing (TagDecl*)%p named %s",
+                  current_id, static_cast<void *>(&tag_decl->getASTContext()),
+                  static_cast<void *>(tag_decl),
+                  tag_decl->getName().str().c_str());
+
+      log->Printf("  AOEAS::CT[%u] Before:", current_id);
+      ASTDumper dumper((clang::Decl *)tag_decl);
+      dumper.ToLog(log, "    [CT] ");
+    }
+
+    if (log) {
+      log->Printf("  AOEAS::CT[%u] After:", current_id);
+      ASTDumper dumper((clang::Decl *)tag_decl);
+      dumper.ToLog(log, "    [CT] ");
     }
+    return;
+  }
 
-    void
-    CompleteType(clang::TagDecl *tag_decl) override
-    {
-        static unsigned int invocation_id = 0;
-        unsigned int current_id = invocation_id++;
+  void CompleteType(clang::ObjCInterfaceDecl *interface_decl) override {
+    static unsigned int invocation_id = 0;
+    unsigned int current_id = invocation_id++;
 
-        Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
+    Log *log(GetLogIfAllCategoriesSet(
+        LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
 
-        if (log)
-        {
-            log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on (ASTContext*)%p Completing (TagDecl*)%p named %s",
-                        current_id,
-                        static_cast<void*>(&tag_decl->getASTContext()),
-                        static_cast<void*>(tag_decl),
-                        tag_decl->getName().str().c_str());
-
-            log->Printf("  AOEAS::CT[%u] Before:", current_id);
-            ASTDumper dumper((clang::Decl*)tag_decl);
-            dumper.ToLog(log, "    [CT] ");
-        }
+    if (log) {
+      log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on "
+                  "(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
+                  current_id,
+                  static_cast<void *>(&interface_decl->getASTContext()),
+                  static_cast<void *>(interface_decl),
+                  interface_decl->getName().str().c_str());
+
+      log->Printf("  AOEAS::CT[%u] Before:", current_id);
+      ASTDumper dumper((clang::Decl *)interface_decl);
+      dumper.ToLog(log, "    [CT] ");
+    }
+
+    m_decl_vendor.FinishDecl(interface_decl);
+
+    if (log) {
+      log->Printf("  [CT] After:");
+      ASTDumper dumper((clang::Decl *)interface_decl);
+      dumper.ToLog(log, "    [CT] ");
+    }
+    return;
+  }
+
+  bool layoutRecordType(
+      const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
+      llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+      llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+          &BaseOffsets,
+      llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+          &VirtualBaseOffsets) override {
+    return false;
+  }
+
+  void StartTranslationUnit(clang::ASTConsumer *Consumer) override {
+    clang::TranslationUnitDecl *translation_unit_decl =
+        m_decl_vendor.m_ast_ctx.getASTContext()->getTranslationUnitDecl();
+    translation_unit_decl->setHasExternalVisibleStorage();
+    translation_unit_decl->setHasExternalLexicalStorage();
+  }
 
-        if (log)
-        {
-            log->Printf("  AOEAS::CT[%u] After:", current_id);
-            ASTDumper dumper((clang::Decl*)tag_decl);
-            dumper.ToLog(log, "    [CT] ");
-        }
-        return;
-    }
+private:
+  AppleObjCDeclVendor &m_decl_vendor;
+};
 
-    void
-    CompleteType(clang::ObjCInterfaceDecl *interface_decl) override
-    {
-        static unsigned int invocation_id = 0;
-        unsigned int current_id = invocation_id++;
+AppleObjCDeclVendor::AppleObjCDeclVendor(ObjCLanguageRuntime &runtime)
+    : DeclVendor(), m_runtime(runtime), m_ast_ctx(runtime.GetProcess()
+                                                      ->GetTarget()
+                                                      .GetArchitecture()
+                                                      .GetTriple()
+                                                      .getTriple()
+                                                      .c_str()),
+      m_type_realizer_sp(m_runtime.GetEncodingToType()) {
+  m_external_source = new AppleObjCExternalASTSource(*this);
+  llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> external_source_owning_ptr(
+      m_external_source);
+  m_ast_ctx.getASTContext()->setExternalSource(external_source_owning_ptr);
+}
 
-        Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
+clang::ObjCInterfaceDecl *
+AppleObjCDeclVendor::GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa) {
+  ISAToInterfaceMap::const_iterator iter = m_isa_to_interface.find(isa);
 
-        if (log)
-        {
-            log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on (ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
-                        current_id,
-                        static_cast<void*>(&interface_decl->getASTContext()),
-                        static_cast<void*>(interface_decl),
-                        interface_decl->getName().str().c_str());
-
-            log->Printf("  AOEAS::CT[%u] Before:", current_id);
-            ASTDumper dumper((clang::Decl*)interface_decl);
-            dumper.ToLog(log, "    [CT] ");
-        }
+  if (iter != m_isa_to_interface.end())
+    return iter->second;
 
-        m_decl_vendor.FinishDecl(interface_decl);
+  clang::ASTContext *ast_ctx = m_ast_ctx.getASTContext();
 
-        if (log)
-        {
-            log->Printf("  [CT] After:");
-            ASTDumper dumper((clang::Decl*)interface_decl);
-            dumper.ToLog(log, "    [CT] ");
-        }
-        return;
-    }
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor =
+      m_runtime.GetClassDescriptorFromISA(isa);
 
-    bool
-    layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
-                     llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
-                     llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
-                     llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override
-    {
-        return false;
-    }
+  if (!descriptor)
+    return NULL;
 
-    void
-    StartTranslationUnit(clang::ASTConsumer *Consumer) override
-    {
-        clang::TranslationUnitDecl *translation_unit_decl = m_decl_vendor.m_ast_ctx.getASTContext()->getTranslationUnitDecl();
-        translation_unit_decl->setHasExternalVisibleStorage();
-        translation_unit_decl->setHasExternalLexicalStorage();
-    }
-private:
-    AppleObjCDeclVendor                                    &m_decl_vendor;
-};
+  const ConstString &name(descriptor->GetClassName());
 
-AppleObjCDeclVendor::AppleObjCDeclVendor(ObjCLanguageRuntime &runtime) :
-    DeclVendor(),
-    m_runtime(runtime),
-    m_ast_ctx(runtime.GetProcess()->GetTarget().GetArchitecture().GetTriple().getTriple().c_str()),
-    m_type_realizer_sp(m_runtime.GetEncodingToType())
-{
-    m_external_source = new AppleObjCExternalASTSource (*this);
-    llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> external_source_owning_ptr (m_external_source);
-    m_ast_ctx.getASTContext()->setExternalSource(external_source_owning_ptr);
-}
+  clang::IdentifierInfo &identifier_info =
+      ast_ctx->Idents.get(name.GetStringRef());
 
-clang::ObjCInterfaceDecl*
-AppleObjCDeclVendor::GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa)
-{
-    ISAToInterfaceMap::const_iterator iter = m_isa_to_interface.find(isa);
-    
-    if (iter != m_isa_to_interface.end())
-        return iter->second;
-    
-    clang::ASTContext *ast_ctx = m_ast_ctx.getASTContext();
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor = m_runtime.GetClassDescriptorFromISA(isa);
-    
-    if (!descriptor)
-        return NULL;
-    
-    const ConstString &name(descriptor->GetClassName());
-    
-    clang::IdentifierInfo &identifier_info = ast_ctx->Idents.get(name.GetStringRef());
-
-    clang::ObjCInterfaceDecl *new_iface_decl = clang::ObjCInterfaceDecl::Create(*ast_ctx,
-                                                                                ast_ctx->getTranslationUnitDecl(),
-                                                                                clang::SourceLocation(),
-                                                                                &identifier_info,
-                                                                                nullptr,
-                                                                                nullptr);
-    
-    ClangASTMetadata meta_data;
-    meta_data.SetISAPtr(isa);
-    m_external_source->SetMetadata(new_iface_decl, meta_data);
-    
-    new_iface_decl->setHasExternalVisibleStorage();
-    new_iface_decl->setHasExternalLexicalStorage();
-    
-    ast_ctx->getTranslationUnitDecl()->addDecl(new_iface_decl);
-    
-    m_isa_to_interface[isa] = new_iface_decl;
-    
-    return new_iface_decl;
+  clang::ObjCInterfaceDecl *new_iface_decl = clang::ObjCInterfaceDecl::Create(
+      *ast_ctx, ast_ctx->getTranslationUnitDecl(), clang::SourceLocation(),
+      &identifier_info, nullptr, nullptr);
+
+  ClangASTMetadata meta_data;
+  meta_data.SetISAPtr(isa);
+  m_external_source->SetMetadata(new_iface_decl, meta_data);
+
+  new_iface_decl->setHasExternalVisibleStorage();
+  new_iface_decl->setHasExternalLexicalStorage();
+
+  ast_ctx->getTranslationUnitDecl()->addDecl(new_iface_decl);
+
+  m_isa_to_interface[isa] = new_iface_decl;
+
+  return new_iface_decl;
 }
 
-class ObjCRuntimeMethodType
-{
+class ObjCRuntimeMethodType {
 public:
-    ObjCRuntimeMethodType (const char *types) : m_is_valid(false)
-    {
-        const char *cursor = types;
-        enum ParserState {
-            Start = 0,
-            InType,
-            InPos
-        } state = Start;
-        const char *type = NULL;
-        int brace_depth = 0;
-        
-        uint32_t stepsLeft = 256;
-        
-        while (1)
-        {
-            if (--stepsLeft == 0)
-            {
-                m_is_valid = false;
-                return;
-            }
-            
-            switch (state)
-            {
-            case Start:
-                {
-                    switch (*cursor)
-                    {
-                    default:
-                        state = InType;
-                        type = cursor;
-                        break;
-                    case '\0':
-                        m_is_valid = true;
-                        return;
-                    case '0': case '1': case '2': case '3': case '4':
-                    case '5': case '6': case '7': case '8': case '9':
-                        m_is_valid = false;
-                        return;
-                    }
-                }
-                break;
-            case InType:
-                {
-                    switch (*cursor)
-                    {
-                    default:
-                        ++cursor;
-                        break;
-                    case '0': case '1': case '2': case '3': case '4':
-                    case '5': case '6': case '7': case '8': case '9':
-                        if (!brace_depth)
-                        {
-                            state = InPos;
-                            if (type)
-                            {
-                                m_type_vector.push_back(std::string(type, (cursor - type)));
-                            }
-                            else
-                            {
-                                m_is_valid = false;
-                                return;
-                            }
-                            type = NULL;
-                        }
-                        else
-                        {
-                            ++cursor;
-                        }
-                        break;
-                    case '[': case '{': case '(':
-                        ++brace_depth;
-                        ++cursor;
-                        break;
-                    case ']': case '}': case ')':
-                        if (!brace_depth)
-                        {
-                            m_is_valid = false;
-                            return;
-                        }
-                        --brace_depth;
-                        ++cursor;
-                        break;
-                    case '\0':
-                        m_is_valid = false;
-                        return;
-                    }
-                }
-                break;
-            case InPos:
-                {
-                    switch (*cursor)
-                    {
-                    default:
-                        state = InType;
-                        type = cursor;
-                        break;
-                    case '0': case '1': case '2': case '3': case '4':
-                    case '5': case '6': case '7': case '8': case '9':
-                        ++cursor;
-                        break;
-                    case '\0':
-                        m_is_valid = true;
-                        return;
-                    }
-                }
-                break;
-            }
-        }
-    }
-    
-    clang::ObjCMethodDecl *BuildMethod (clang::ObjCInterfaceDecl *interface_decl, const char *name, bool instance, ObjCLanguageRuntime::EncodingToTypeSP type_realizer_sp)
-    {
-        if (!m_is_valid || m_type_vector.size() < 3)
-            return NULL;
-        
-        clang::ASTContext &ast_ctx(interface_decl->getASTContext());
-        
-        clang::QualType return_qual_type;
-        
-        const bool isInstance = instance;
-        const bool isVariadic = false;
-        const bool isSynthesized = false;
-        const bool isImplicitlyDeclared = true;
-        const bool isDefined = false;
-        const clang::ObjCMethodDecl::ImplementationControl impControl = clang::ObjCMethodDecl::None;
-        const bool HasRelatedResultType = false;
-        const bool for_expression = true;
-        
-        std::vector <clang::IdentifierInfo *> selector_components;
-        
-        const char *name_cursor = name;
-        bool is_zero_argument = true;
-        
-        
-        while (*name_cursor != '\0')
-        {
-            const char *colon_loc = strchr(name_cursor, ':');
-            if (!colon_loc)
-            {
-                selector_components.push_back(&ast_ctx.Idents.get(llvm::StringRef(name_cursor)));
-                break;
-            }
-            else
-            {
-                is_zero_argument = false;
-                selector_components.push_back(&ast_ctx.Idents.get(llvm::StringRef(name_cursor, colon_loc - name_cursor)));
-                name_cursor = colon_loc + 1;
+  ObjCRuntimeMethodType(const char *types) : m_is_valid(false) {
+    const char *cursor = types;
+    enum ParserState { Start = 0, InType, InPos } state = Start;
+    const char *type = NULL;
+    int brace_depth = 0;
+
+    uint32_t stepsLeft = 256;
+
+    while (1) {
+      if (--stepsLeft == 0) {
+        m_is_valid = false;
+        return;
+      }
+
+      switch (state) {
+      case Start: {
+        switch (*cursor) {
+        default:
+          state = InType;
+          type = cursor;
+          break;
+        case '\0':
+          m_is_valid = true;
+          return;
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+          m_is_valid = false;
+          return;
+        }
+      } break;
+      case InType: {
+        switch (*cursor) {
+        default:
+          ++cursor;
+          break;
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+          if (!brace_depth) {
+            state = InPos;
+            if (type) {
+              m_type_vector.push_back(std::string(type, (cursor - type)));
+            } else {
+              m_is_valid = false;
+              return;
             }
-        }
-        
-        clang::Selector sel = ast_ctx.Selectors.getSelector(is_zero_argument ? 0 : selector_components.size(), selector_components.data());
+            type = NULL;
+          } else {
+            ++cursor;
+          }
+          break;
+        case '[':
+        case '{':
+        case '(':
+          ++brace_depth;
+          ++cursor;
+          break;
+        case ']':
+        case '}':
+        case ')':
+          if (!brace_depth) {
+            m_is_valid = false;
+            return;
+          }
+          --brace_depth;
+          ++cursor;
+          break;
+        case '\0':
+          m_is_valid = false;
+          return;
+        }
+      } break;
+      case InPos: {
+        switch (*cursor) {
+        default:
+          state = InType;
+          type = cursor;
+          break;
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+          ++cursor;
+          break;
+        case '\0':
+          m_is_valid = true;
+          return;
+        }
+      } break;
+      }
+    }
+  }
+
+  clang::ObjCMethodDecl *
+  BuildMethod(clang::ObjCInterfaceDecl *interface_decl, const char *name,
+              bool instance,
+              ObjCLanguageRuntime::EncodingToTypeSP type_realizer_sp) {
+    if (!m_is_valid || m_type_vector.size() < 3)
+      return NULL;
+
+    clang::ASTContext &ast_ctx(interface_decl->getASTContext());
+
+    clang::QualType return_qual_type;
+
+    const bool isInstance = instance;
+    const bool isVariadic = false;
+    const bool isSynthesized = false;
+    const bool isImplicitlyDeclared = true;
+    const bool isDefined = false;
+    const clang::ObjCMethodDecl::ImplementationControl impControl =
+        clang::ObjCMethodDecl::None;
+    const bool HasRelatedResultType = false;
+    const bool for_expression = true;
+
+    std::vector<clang::IdentifierInfo *> selector_components;
+
+    const char *name_cursor = name;
+    bool is_zero_argument = true;
+
+    while (*name_cursor != '\0') {
+      const char *colon_loc = strchr(name_cursor, ':');
+      if (!colon_loc) {
+        selector_components.push_back(
+            &ast_ctx.Idents.get(llvm::StringRef(name_cursor)));
+        break;
+      } else {
+        is_zero_argument = false;
+        selector_components.push_back(&ast_ctx.Idents.get(
+            llvm::StringRef(name_cursor, colon_loc - name_cursor)));
+        name_cursor = colon_loc + 1;
+      }
+    }
+
+    clang::Selector sel = ast_ctx.Selectors.getSelector(
+        is_zero_argument ? 0 : selector_components.size(),
+        selector_components.data());
+
+    clang::QualType ret_type =
+        ClangUtil::GetQualType(type_realizer_sp->RealizeType(
+            interface_decl->getASTContext(), m_type_vector[0].c_str(),
+            for_expression));
+
+    if (ret_type.isNull())
+      return NULL;
+
+    clang::ObjCMethodDecl *ret = clang::ObjCMethodDecl::Create(
+        ast_ctx, clang::SourceLocation(), clang::SourceLocation(), sel,
+        ret_type, NULL, interface_decl, isInstance, isVariadic, isSynthesized,
+        isImplicitlyDeclared, isDefined, impControl, HasRelatedResultType);
+
+    std::vector<clang::ParmVarDecl *> parm_vars;
+
+    for (size_t ai = 3, ae = m_type_vector.size(); ai != ae; ++ai) {
+      const bool for_expression = true;
+      clang::QualType arg_type =
+          ClangUtil::GetQualType(type_realizer_sp->RealizeType(
+              ast_ctx, m_type_vector[ai].c_str(), for_expression));
+
+      if (arg_type.isNull())
+        return NULL; // well, we just wasted a bunch of time.  Wish we could
+                     // delete the stuff we'd just made!
+
+      parm_vars.push_back(clang::ParmVarDecl::Create(
+          ast_ctx, ret, clang::SourceLocation(), clang::SourceLocation(), NULL,
+          arg_type, NULL, clang::SC_None, NULL));
+    }
+
+    ret->setMethodParams(ast_ctx,
+                         llvm::ArrayRef<clang::ParmVarDecl *>(parm_vars),
+                         llvm::ArrayRef<clang::SourceLocation>());
+
+    return ret;
+  }
 
-        clang::QualType ret_type = ClangUtil::GetQualType(
-            type_realizer_sp->RealizeType(interface_decl->getASTContext(), m_type_vector[0].c_str(), for_expression));
+  explicit operator bool() { return m_is_valid; }
+
+  size_t GetNumTypes() { return m_type_vector.size(); }
+
+  const char *GetTypeAtIndex(size_t idx) { return m_type_vector[idx].c_str(); }
 
-        if (ret_type.isNull())
-            return NULL;
-        
-        clang::ObjCMethodDecl *ret = clang::ObjCMethodDecl::Create(ast_ctx,
-                                                                   clang::SourceLocation(),
-                                                                   clang::SourceLocation(),
-                                                                   sel,
-                                                                   ret_type,
-                                                                   NULL,
-                                                                   interface_decl,
-                                                                   isInstance,
-                                                                   isVariadic,
-                                                                   isSynthesized,
-                                                                   isImplicitlyDeclared,
-                                                                   isDefined,
-                                                                   impControl,
-                                                                   HasRelatedResultType);
-        
-        std::vector <clang::ParmVarDecl*> parm_vars;
-        
-        for (size_t ai = 3, ae = m_type_vector.size();
-             ai != ae;
-             ++ai)
-        {
-            const bool for_expression = true;
-            clang::QualType arg_type = ClangUtil::GetQualType(
-                type_realizer_sp->RealizeType(ast_ctx, m_type_vector[ai].c_str(), for_expression));
-
-            if (arg_type.isNull())
-                return NULL; // well, we just wasted a bunch of time.  Wish we could delete the stuff we'd just made!
-
-            parm_vars.push_back(clang::ParmVarDecl::Create(ast_ctx,
-                                                           ret,
-                                                           clang::SourceLocation(),
-                                                           clang::SourceLocation(),
-                                                           NULL,
-                                                           arg_type,
-                                                           NULL,
-                                                           clang::SC_None,
-                                                           NULL));
-        }
-        
-        ret->setMethodParams(ast_ctx, llvm::ArrayRef<clang::ParmVarDecl*>(parm_vars), llvm::ArrayRef<clang::SourceLocation>());
-        
-        return ret;
-    }
-    
-    explicit operator bool ()
-    {
-        return m_is_valid;
-    }
-    
-    size_t
-    GetNumTypes ()
-    {
-        return m_type_vector.size();
-    }
-    
-    const char*
-    GetTypeAtIndex (size_t idx)
-    {
-        return m_type_vector[idx].c_str();
-    }
-    
 private:
-    typedef std::vector <std::string> TypeVector;
-    
-    TypeVector  m_type_vector;
-    bool        m_is_valid;
+  typedef std::vector<std::string> TypeVector;
+
+  TypeVector m_type_vector;
+  bool m_is_valid;
 };
 
-bool
-AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl)
-{
-    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
-    
-    ClangASTMetadata *metadata = m_external_source->GetMetadata(interface_decl);
-    ObjCLanguageRuntime::ObjCISA objc_isa = 0;
-    if (metadata)
-     objc_isa = metadata->GetISAPtr();
-    
-    if (!objc_isa)
-        return false;
-    
-    if (!interface_decl->hasExternalVisibleStorage())
-        return true;
-    
-    interface_decl->startDefinition();
-    
-    interface_decl->setHasExternalVisibleStorage(false);
-    interface_decl->setHasExternalLexicalStorage(false);
-    
-    ObjCLanguageRuntime::ClassDescriptorSP descriptor = m_runtime.GetClassDescriptorFromISA(objc_isa);
-    
-    if (!descriptor)
-        return false;
-    
-    auto superclass_func = [interface_decl, this](ObjCLanguageRuntime::ObjCISA isa)
-    {
-        clang::ObjCInterfaceDecl *superclass_decl = GetDeclForISA(isa);
-        
-        if (!superclass_decl)
-            return;
-        
-        FinishDecl(superclass_decl);
-        clang::ASTContext *context = m_ast_ctx.getASTContext();
-        interface_decl->setSuperClass(
-                context->getTrivialTypeSourceInfo(context->getObjCInterfaceType(superclass_decl)));
-    };
-    
-    auto instance_method_func = [log, interface_decl, this](const char *name, const char *types) -> bool
-    {        
-        if (!name || !types)
-            return false; // skip this one
-
-        ObjCRuntimeMethodType method_type(types);
-        
-        clang::ObjCMethodDecl *method_decl = method_type.BuildMethod (interface_decl, name, true, m_type_realizer_sp);
-        
-        if (log)
-            log->Printf("[  AOTV::FD] Instance method [%s] [%s]", name, types);
-        
-        if (method_decl)
-            interface_decl->addDecl(method_decl);
-        
-        return false;
-    };
-    
-    auto class_method_func = [log, interface_decl, this](const char *name, const char *types) -> bool
-    {
-        if (!name || !types)
-            return false; // skip this one
-        
-        ObjCRuntimeMethodType method_type(types);
-        
-        clang::ObjCMethodDecl *method_decl = method_type.BuildMethod (interface_decl, name, false, m_type_realizer_sp);
-        
-        if (log)
-            log->Printf("[  AOTV::FD] Class method [%s] [%s]", name, types);
-        
-        if (method_decl)
-            interface_decl->addDecl(method_decl);
-        
-        return false;
-    };
-    
-    auto ivar_func = [log, interface_decl, this](const char *name, const char *type, lldb::addr_t offset_ptr, uint64_t size) -> bool
-    {
-        if (!name || !type)
-            return false;
-        
-        const bool for_expression = false;
-        
-        if (log)
-            log->Printf("[  AOTV::FD] Instance variable [%s] [%s], offset at %" PRIx64, name, type, offset_ptr);
-        
-        CompilerType ivar_type = m_runtime.GetEncodingToType()->RealizeType(m_ast_ctx, type, for_expression);
-        
-        if (ivar_type.IsValid())
-        {
-            clang::TypeSourceInfo * const type_source_info = nullptr;
-            const bool is_synthesized = false;
-            clang::ObjCIvarDecl *ivar_decl = clang::ObjCIvarDecl::Create(
-                *m_ast_ctx.getASTContext(), interface_decl, clang::SourceLocation(), clang::SourceLocation(),
-                &m_ast_ctx.getASTContext()->Idents.get(name), ClangUtil::GetQualType(ivar_type),
-                type_source_info, // TypeSourceInfo *
-                clang::ObjCIvarDecl::Public, 0, is_synthesized);
-
-            if (ivar_decl)
-            {
-                interface_decl->addDecl(ivar_decl);
-            }
-        }
-        
-        return false;
-    };
-    
+bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
+  Log *log(GetLogIfAllCategoriesSet(
+      LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
+
+  ClangASTMetadata *metadata = m_external_source->GetMetadata(interface_decl);
+  ObjCLanguageRuntime::ObjCISA objc_isa = 0;
+  if (metadata)
+    objc_isa = metadata->GetISAPtr();
+
+  if (!objc_isa)
+    return false;
+
+  if (!interface_decl->hasExternalVisibleStorage())
+    return true;
+
+  interface_decl->startDefinition();
+
+  interface_decl->setHasExternalVisibleStorage(false);
+  interface_decl->setHasExternalLexicalStorage(false);
+
+  ObjCLanguageRuntime::ClassDescriptorSP descriptor =
+      m_runtime.GetClassDescriptorFromISA(objc_isa);
+
+  if (!descriptor)
+    return false;
+
+  auto superclass_func = [interface_decl,
+                          this](ObjCLanguageRuntime::ObjCISA isa) {
+    clang::ObjCInterfaceDecl *superclass_decl = GetDeclForISA(isa);
+
+    if (!superclass_decl)
+      return;
+
+    FinishDecl(superclass_decl);
+    clang::ASTContext *context = m_ast_ctx.getASTContext();
+    interface_decl->setSuperClass(context->getTrivialTypeSourceInfo(
+        context->getObjCInterfaceType(superclass_decl)));
+  };
+
+  auto instance_method_func =
+      [log, interface_decl, this](const char *name, const char *types) -> bool {
+    if (!name || !types)
+      return false; // skip this one
+
+    ObjCRuntimeMethodType method_type(types);
+
+    clang::ObjCMethodDecl *method_decl =
+        method_type.BuildMethod(interface_decl, name, true, m_type_realizer_sp);
+
     if (log)
-    {
-        ASTDumper method_dumper ((clang::Decl*)interface_decl);
-        
-        log->Printf("[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C interface for %s", descriptor->GetClassName().AsCString());
-    }
-    
-    
-    if (!descriptor->Describe(superclass_func,
-                              instance_method_func,
-                              class_method_func,
-                              ivar_func))
-        return false;
-    
+      log->Printf("[  AOTV::FD] Instance method [%s] [%s]", name, types);
+
+    if (method_decl)
+      interface_decl->addDecl(method_decl);
+
+    return false;
+  };
+
+  auto class_method_func = [log, interface_decl,
+                            this](const char *name, const char *types) -> bool {
+    if (!name || !types)
+      return false; // skip this one
+
+    ObjCRuntimeMethodType method_type(types);
+
+    clang::ObjCMethodDecl *method_decl = method_type.BuildMethod(
+        interface_decl, name, false, m_type_realizer_sp);
+
+    if (log)
+      log->Printf("[  AOTV::FD] Class method [%s] [%s]", name, types);
+
+    if (method_decl)
+      interface_decl->addDecl(method_decl);
+
+    return false;
+  };
+
+  auto ivar_func = [log, interface_decl,
+                    this](const char *name, const char *type,
+                          lldb::addr_t offset_ptr, uint64_t size) -> bool {
+    if (!name || !type)
+      return false;
+
+    const bool for_expression = false;
+
     if (log)
-    {
-        ASTDumper method_dumper ((clang::Decl*)interface_decl);
-        
-        log->Printf("[AppleObjCDeclVendor::FinishDecl] Finished Objective-C interface");
-        
-        method_dumper.ToLog(log, "  [AOTV::FD] ");
+      log->Printf(
+          "[  AOTV::FD] Instance variable [%s] [%s], offset at %" PRIx64, name,
+          type, offset_ptr);
+
+    CompilerType ivar_type = m_runtime.GetEncodingToType()->RealizeType(
+        m_ast_ctx, type, for_expression);
+
+    if (ivar_type.IsValid()) {
+      clang::TypeSourceInfo *const type_source_info = nullptr;
+      const bool is_synthesized = false;
+      clang::ObjCIvarDecl *ivar_decl = clang::ObjCIvarDecl::Create(
+          *m_ast_ctx.getASTContext(), interface_decl, clang::SourceLocation(),
+          clang::SourceLocation(), &m_ast_ctx.getASTContext()->Idents.get(name),
+          ClangUtil::GetQualType(ivar_type),
+          type_source_info, // TypeSourceInfo *
+          clang::ObjCIvarDecl::Public, 0, is_synthesized);
+
+      if (ivar_decl) {
+        interface_decl->addDecl(ivar_decl);
+      }
     }
-    
-    return true;
+
+    return false;
+  };
+
+  if (log) {
+    ASTDumper method_dumper((clang::Decl *)interface_decl);
+
+    log->Printf("[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C "
+                "interface for %s",
+                descriptor->GetClassName().AsCString());
+  }
+
+  if (!descriptor->Describe(superclass_func, instance_method_func,
+                            class_method_func, ivar_func))
+    return false;
+
+  if (log) {
+    ASTDumper method_dumper((clang::Decl *)interface_decl);
+
+    log->Printf(
+        "[AppleObjCDeclVendor::FinishDecl] Finished Objective-C interface");
+
+    method_dumper.ToLog(log, "  [AOTV::FD] ");
+  }
+
+  return true;
 }
 
 uint32_t
-AppleObjCDeclVendor::FindDecls (const ConstString &name,
-                                bool append,
-                                uint32_t max_matches,
-                                std::vector <clang::NamedDecl *> &decls)
-{
-    static unsigned int invocation_id = 0;
-    unsigned int current_id = invocation_id++;
-    
-    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));  // FIXME - a more appropriate log channel?
-    
-    if (log)
-        log->Printf("AppleObjCDeclVendor::FindTypes [%u] ('%s', %s, %u, )",
-                    current_id,
-                    (const char*)name.AsCString(),
-                    append ? "true" : "false",
-                    max_matches);
-    
-    if (!append)
-        decls.clear();
-    
-    uint32_t ret = 0;
-    
-    do
-    {
-        // See if the type is already in our ASTContext.
-        
-        clang::ASTContext *ast_ctx = m_ast_ctx.getASTContext();
-        
-        clang::IdentifierInfo &identifier_info = ast_ctx->Idents.get(name.GetStringRef());
-        clang::DeclarationName decl_name = ast_ctx->DeclarationNames.getIdentifier(&identifier_info);
-        
-        clang::DeclContext::lookup_result lookup_result = ast_ctx->getTranslationUnitDecl()->lookup(decl_name);
-        
-        if (!lookup_result.empty())
-        {
-            if (clang::ObjCInterfaceDecl *result_iface_decl = llvm::dyn_cast<clang::ObjCInterfaceDecl>(lookup_result[0]))
-            {
-                if (log)
-                {
-                    clang::QualType result_iface_type = ast_ctx->getObjCInterfaceType(result_iface_decl);
-                    ASTDumper dumper(result_iface_type);
-                    
-                    uint64_t isa_value = LLDB_INVALID_ADDRESS;
-                    ClangASTMetadata *metadata = m_external_source->GetMetadata(result_iface_decl);
-                    if (metadata)
-                        isa_value = metadata->GetISAPtr();
-                    
-                    log->Printf("AOCTV::FT [%u] Found %s (isa 0x%" PRIx64 ") in the ASTContext",
-                                current_id,
-                                dumper.GetCString(),
-                                isa_value);
-                }
-                    
-                decls.push_back(result_iface_decl);
-                ret++;
-                break;
-            }
-            else
-            {
-                if (log)
-                    log->Printf("AOCTV::FT [%u] There's something in the ASTContext, but it's not something we know about",
-                                current_id);
-                break;
-            }
-        }
-        else if(log)
-        {
-            log->Printf("AOCTV::FT [%u] Couldn't find %s in the ASTContext",
-                        current_id,
-                        name.AsCString());
-        }
-        
-        // It's not.  If it exists, we have to put it into our ASTContext.
-                
-        ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA(name);
-    
-        if (!isa)
-        {
-            if (log)
-                log->Printf("AOCTV::FT [%u] Couldn't find the isa",
-                            current_id);
-            
-            break;
-        }
-        
-        clang::ObjCInterfaceDecl *iface_decl = GetDeclForISA(isa);
-        
-        if (!iface_decl)
-        {
-            if (log)
-                log->Printf("AOCTV::FT [%u] Couldn't get the Objective-C interface for isa 0x%" PRIx64,
-                            current_id,
-                            (uint64_t)isa);
-            
-            break;
-        }
-        
-        if (log)
-        {
-            clang::QualType new_iface_type = ast_ctx->getObjCInterfaceType(iface_decl);
-            ASTDumper dumper(new_iface_type);
-            log->Printf("AOCTV::FT [%u] Created %s (isa 0x%" PRIx64 ")",
-                        current_id,
-                        dumper.GetCString(),
-                        (uint64_t)isa);
+AppleObjCDeclVendor::FindDecls(const ConstString &name, bool append,
+                               uint32_t max_matches,
+                               std::vector<clang::NamedDecl *> &decls) {
+  static unsigned int invocation_id = 0;
+  unsigned int current_id = invocation_id++;
+
+  Log *log(GetLogIfAllCategoriesSet(
+      LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
+
+  if (log)
+    log->Printf("AppleObjCDeclVendor::FindTypes [%u] ('%s', %s, %u, )",
+                current_id, (const char *)name.AsCString(),
+                append ? "true" : "false", max_matches);
+
+  if (!append)
+    decls.clear();
+
+  uint32_t ret = 0;
+
+  do {
+    // See if the type is already in our ASTContext.
+
+    clang::ASTContext *ast_ctx = m_ast_ctx.getASTContext();
+
+    clang::IdentifierInfo &identifier_info =
+        ast_ctx->Idents.get(name.GetStringRef());
+    clang::DeclarationName decl_name =
+        ast_ctx->DeclarationNames.getIdentifier(&identifier_info);
+
+    clang::DeclContext::lookup_result lookup_result =
+        ast_ctx->getTranslationUnitDecl()->lookup(decl_name);
+
+    if (!lookup_result.empty()) {
+      if (clang::ObjCInterfaceDecl *result_iface_decl =
+              llvm::dyn_cast<clang::ObjCInterfaceDecl>(lookup_result[0])) {
+        if (log) {
+          clang::QualType result_iface_type =
+              ast_ctx->getObjCInterfaceType(result_iface_decl);
+          ASTDumper dumper(result_iface_type);
+
+          uint64_t isa_value = LLDB_INVALID_ADDRESS;
+          ClangASTMetadata *metadata =
+              m_external_source->GetMetadata(result_iface_decl);
+          if (metadata)
+            isa_value = metadata->GetISAPtr();
+
+          log->Printf("AOCTV::FT [%u] Found %s (isa 0x%" PRIx64
+                      ") in the ASTContext",
+                      current_id, dumper.GetCString(), isa_value);
         }
-        
-        decls.push_back(iface_decl);
+
+        decls.push_back(result_iface_decl);
         ret++;
         break;
-    } while (0);
-    
-    return ret;
+      } else {
+        if (log)
+          log->Printf("AOCTV::FT [%u] There's something in the ASTContext, but "
+                      "it's not something we know about",
+                      current_id);
+        break;
+      }
+    } else if (log) {
+      log->Printf("AOCTV::FT [%u] Couldn't find %s in the ASTContext",
+                  current_id, name.AsCString());
+    }
+
+    // It's not.  If it exists, we have to put it into our ASTContext.
+
+    ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA(name);
+
+    if (!isa) {
+      if (log)
+        log->Printf("AOCTV::FT [%u] Couldn't find the isa", current_id);
+
+      break;
+    }
+
+    clang::ObjCInterfaceDecl *iface_decl = GetDeclForISA(isa);
+
+    if (!iface_decl) {
+      if (log)
+        log->Printf("AOCTV::FT [%u] Couldn't get the Objective-C interface for "
+                    "isa 0x%" PRIx64,
+                    current_id, (uint64_t)isa);
+
+      break;
+    }
+
+    if (log) {
+      clang::QualType new_iface_type =
+          ast_ctx->getObjCInterfaceType(iface_decl);
+      ASTDumper dumper(new_iface_type);
+      log->Printf("AOCTV::FT [%u] Created %s (isa 0x%" PRIx64 ")", current_id,
+                  dumper.GetCString(), (uint64_t)isa);
+    }
+
+    decls.push_back(iface_decl);
+    ret++;
+    break;
+  } while (0);
+
+  return ret;
 }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h Tue Sep  6 15:57:50 2016
@@ -14,40 +14,38 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/DeclVendor.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
 
 class AppleObjCExternalASTSource;
-    
-class AppleObjCDeclVendor : public DeclVendor
-{
+
+class AppleObjCDeclVendor : public DeclVendor {
 public:
-    AppleObjCDeclVendor(ObjCLanguageRuntime &runtime);
-    
-    uint32_t
-    FindDecls(const ConstString &name,
-              bool append,
-              uint32_t max_matches,
-              std::vector <clang::NamedDecl *> &decls) override;
-        
-    friend class AppleObjCExternalASTSource;
+  AppleObjCDeclVendor(ObjCLanguageRuntime &runtime);
+
+  uint32_t FindDecls(const ConstString &name, bool append, uint32_t max_matches,
+                     std::vector<clang::NamedDecl *> &decls) override;
+
+  friend class AppleObjCExternalASTSource;
 
 private:
-    clang::ObjCInterfaceDecl   *GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa);
-    bool                        FinishDecl(clang::ObjCInterfaceDecl *decl);
-    
-    ObjCLanguageRuntime        &m_runtime;
-    ClangASTContext             m_ast_ctx;
-    ObjCLanguageRuntime::EncodingToTypeSP m_type_realizer_sp;
-    AppleObjCExternalASTSource *m_external_source;
-    
-    typedef llvm::DenseMap<ObjCLanguageRuntime::ObjCISA, clang::ObjCInterfaceDecl *> ISAToInterfaceMap;
+  clang::ObjCInterfaceDecl *GetDeclForISA(ObjCLanguageRuntime::ObjCISA isa);
+  bool FinishDecl(clang::ObjCInterfaceDecl *decl);
+
+  ObjCLanguageRuntime &m_runtime;
+  ClangASTContext m_ast_ctx;
+  ObjCLanguageRuntime::EncodingToTypeSP m_type_realizer_sp;
+  AppleObjCExternalASTSource *m_external_source;
+
+  typedef llvm::DenseMap<ObjCLanguageRuntime::ObjCISA,
+                         clang::ObjCInterfaceDecl *>
+      ISAToInterfaceMap;
 
-    ISAToInterfaceMap           m_isa_to_interface;
+  ISAToInterfaceMap m_isa_to_interface;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- AppleObjCRuntime.cpp -------------------------------------*- C++ -*-===//
+//===-- AppleObjCRuntime.cpp -------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -39,516 +40,450 @@
 using namespace lldb;
 using namespace lldb_private;
 
-#define PO_FUNCTION_TIMEOUT_USEC 15*1000*1000
+#define PO_FUNCTION_TIMEOUT_USEC 15 * 1000 * 1000
 
-AppleObjCRuntime::~AppleObjCRuntime()
-{
-}
+AppleObjCRuntime::~AppleObjCRuntime() {}
 
-AppleObjCRuntime::AppleObjCRuntime(Process *process) :
-    ObjCLanguageRuntime (process),
-    m_read_objc_library (false),
-    m_objc_trampoline_handler_ap (),
-    m_Foundation_major()
-{
-    ReadObjCLibraryIfNeeded (process->GetTarget().GetImages());
-}
-
-bool
-AppleObjCRuntime::GetObjectDescription (Stream &str, ValueObject &valobj)
-{
-    CompilerType compiler_type(valobj.GetCompilerType());
-    bool is_signed;
-    // ObjC objects can only be pointers (or numbers that actually represents pointers
-    // but haven't been typecast, because reasons..)
-    if (!compiler_type.IsIntegerType (is_signed) && !compiler_type.IsPointerType ())
-        return false;
-    
-    // Make the argument list: we pass one arg, the address of our pointer, to the print function.
-    Value val;
-    
-    if (!valobj.ResolveValue(val.GetScalar()))
-        return false;
-    
-    // Value Objects may not have a process in their ExecutionContextRef.  But we need to have one
-    // in the ref we pass down to eventually call description.  Get it from the target if it isn't
-    // present.
-    ExecutionContext exe_ctx;
-    if (valobj.GetProcessSP())
-    {
-        exe_ctx = ExecutionContext(valobj.GetExecutionContextRef());
-    }
-    else
-    {
-        exe_ctx.SetContext(valobj.GetTargetSP(), true);
-        if (!exe_ctx.HasProcessScope())
-            return false;
-    }
-    return GetObjectDescription(str, val, exe_ctx.GetBestExecutionContextScope());
-                   
-}
-bool
-AppleObjCRuntime::GetObjectDescription (Stream &strm, Value &value, ExecutionContextScope *exe_scope)
-{
-    if (!m_read_objc_library)
-        return false;
-        
-    ExecutionContext exe_ctx;
-    exe_scope->CalculateExecutionContext(exe_ctx);
-    Process *process = exe_ctx.GetProcessPtr();
-    if (!process)
-        return false;
-    
-    // We need other parts of the exe_ctx, but the processes have to match.
-    assert (m_process == process);
-    
-    // Get the function address for the print function.
-    const Address *function_address = GetPrintForDebuggerAddr();
-    if (!function_address)
-        return false;
-    
-    Target *target = exe_ctx.GetTargetPtr();
-    CompilerType compiler_type = value.GetCompilerType();
-    if (compiler_type)
-    {
-        if (!ClangASTContext::IsObjCObjectPointerType(compiler_type))
-        {
-            strm.Printf ("Value doesn't point to an ObjC object.\n");
-            return false;
-        }
-    }
-    else 
-    {
-        // If it is not a pointer, see if we can make it into a pointer.
-        ClangASTContext *ast_context = target->GetScratchClangASTContext();
-        CompilerType opaque_type = ast_context->GetBasicType(eBasicTypeObjCID);
-        if (!opaque_type)
-            opaque_type = ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
-        //value.SetContext(Value::eContextTypeClangType, opaque_type_ptr);
-        value.SetCompilerType (opaque_type);
-    }
+AppleObjCRuntime::AppleObjCRuntime(Process *process)
+    : ObjCLanguageRuntime(process), m_read_objc_library(false),
+      m_objc_trampoline_handler_ap(), m_Foundation_major() {
+  ReadObjCLibraryIfNeeded(process->GetTarget().GetImages());
+}
+
+bool AppleObjCRuntime::GetObjectDescription(Stream &str, ValueObject &valobj) {
+  CompilerType compiler_type(valobj.GetCompilerType());
+  bool is_signed;
+  // ObjC objects can only be pointers (or numbers that actually represents
+  // pointers
+  // but haven't been typecast, because reasons..)
+  if (!compiler_type.IsIntegerType(is_signed) && !compiler_type.IsPointerType())
+    return false;
 
-    ValueList arg_value_list;
-    arg_value_list.PushValue(value);
-    
-    // This is the return value:
-    ClangASTContext *ast_context = target->GetScratchClangASTContext();
-    
-    CompilerType return_compiler_type = ast_context->GetCStringType(true);
-    Value ret;
-//    ret.SetContext(Value::eContextTypeClangType, return_compiler_type);
-    ret.SetCompilerType (return_compiler_type);
-    
-    if (exe_ctx.GetFramePtr() == NULL)
-    {
-        Thread *thread = exe_ctx.GetThreadPtr();
-        if (thread == NULL)
-        {
-            exe_ctx.SetThreadSP(process->GetThreadList().GetSelectedThread());
-            thread = exe_ctx.GetThreadPtr();
-        }
-        if (thread)
-        {
-            exe_ctx.SetFrameSP(thread->GetSelectedFrame());
-        }
-    }
+  // Make the argument list: we pass one arg, the address of our pointer, to the
+  // print function.
+  Value val;
 
-    // Now we're ready to call the function:
+  if (!valobj.ResolveValue(val.GetScalar()))
+    return false;
 
-    DiagnosticManager diagnostics;
-    lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;
+  // Value Objects may not have a process in their ExecutionContextRef.  But we
+  // need to have one
+  // in the ref we pass down to eventually call description.  Get it from the
+  // target if it isn't
+  // present.
+  ExecutionContext exe_ctx;
+  if (valobj.GetProcessSP()) {
+    exe_ctx = ExecutionContext(valobj.GetExecutionContextRef());
+  } else {
+    exe_ctx.SetContext(valobj.GetTargetSP(), true);
+    if (!exe_ctx.HasProcessScope())
+      return false;
+  }
+  return GetObjectDescription(str, val, exe_ctx.GetBestExecutionContextScope());
+}
+bool AppleObjCRuntime::GetObjectDescription(Stream &strm, Value &value,
+                                            ExecutionContextScope *exe_scope) {
+  if (!m_read_objc_library)
+    return false;
 
-    if (!m_print_object_caller_up)
-    {
-        Error error;
-         m_print_object_caller_up.reset(exe_scope->CalculateTarget()->GetFunctionCallerForLanguage (eLanguageTypeObjC,
-                                                                                                    return_compiler_type,
-                                                                                                    *function_address,
-                                                                                                    arg_value_list,
-                                                                                                    "objc-object-description",
-                                                                                                    error));
-        if (error.Fail())
-        {
-            m_print_object_caller_up.reset();
-            strm.Printf("Could not get function runner to call print for debugger function: %s.", error.AsCString());
-            return false;
-        }
-        m_print_object_caller_up->InsertFunction(exe_ctx, wrapper_struct_addr, diagnostics);
-    }
-    else
-    {
-        m_print_object_caller_up->WriteFunctionArguments(exe_ctx, wrapper_struct_addr, arg_value_list, diagnostics);
-    }
+  ExecutionContext exe_ctx;
+  exe_scope->CalculateExecutionContext(exe_ctx);
+  Process *process = exe_ctx.GetProcessPtr();
+  if (!process)
+    return false;
 
-    EvaluateExpressionOptions options;
-    options.SetUnwindOnError(true);
-    options.SetTryAllThreads(true);
-    options.SetStopOthers(true);
-    options.SetIgnoreBreakpoints(true);
-    options.SetTimeoutUsec(PO_FUNCTION_TIMEOUT_USEC);
-
-    ExpressionResults results =
-        m_print_object_caller_up->ExecuteFunction(exe_ctx, &wrapper_struct_addr, options, diagnostics, ret);
-    if (results != eExpressionCompleted)
-    {
-        strm.Printf("Error evaluating Print Object function: %d.\n", results);
-        return false;
-    }
-       
-    addr_t result_ptr = ret.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-    
-    char buf[512];
-    size_t cstr_len = 0;    
-    size_t full_buffer_len = sizeof (buf) - 1;
-    size_t curr_len = full_buffer_len;
-    while (curr_len == full_buffer_len)
-    {
-        Error error;
-        curr_len = process->ReadCStringFromMemory(result_ptr + cstr_len, buf, sizeof(buf), error);
-        strm.Write (buf, curr_len);
-        cstr_len += curr_len;
-    }
-    return cstr_len > 0;
-}
+  // We need other parts of the exe_ctx, but the processes have to match.
+  assert(m_process == process);
 
-lldb::ModuleSP
-AppleObjCRuntime::GetObjCModule ()
-{
-    ModuleSP module_sp (m_objc_module_wp.lock());
-    if (module_sp)
-        return module_sp;
+  // Get the function address for the print function.
+  const Address *function_address = GetPrintForDebuggerAddr();
+  if (!function_address)
+    return false;
 
-    Process *process = GetProcess();
-    if (process)
-    {
-        const ModuleList& modules = process->GetTarget().GetImages();
-        for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
-        {
-            module_sp = modules.GetModuleAtIndex(idx);
-            if (AppleObjCRuntime::AppleIsModuleObjCLibrary(module_sp))
-            {
-                m_objc_module_wp = module_sp;
-                return module_sp;
-            }
-        }
+  Target *target = exe_ctx.GetTargetPtr();
+  CompilerType compiler_type = value.GetCompilerType();
+  if (compiler_type) {
+    if (!ClangASTContext::IsObjCObjectPointerType(compiler_type)) {
+      strm.Printf("Value doesn't point to an ObjC object.\n");
+      return false;
     }
-    return ModuleSP();
-}
+  } else {
+    // If it is not a pointer, see if we can make it into a pointer.
+    ClangASTContext *ast_context = target->GetScratchClangASTContext();
+    CompilerType opaque_type = ast_context->GetBasicType(eBasicTypeObjCID);
+    if (!opaque_type)
+      opaque_type = ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
+    // value.SetContext(Value::eContextTypeClangType, opaque_type_ptr);
+    value.SetCompilerType(opaque_type);
+  }
+
+  ValueList arg_value_list;
+  arg_value_list.PushValue(value);
+
+  // This is the return value:
+  ClangASTContext *ast_context = target->GetScratchClangASTContext();
+
+  CompilerType return_compiler_type = ast_context->GetCStringType(true);
+  Value ret;
+  //    ret.SetContext(Value::eContextTypeClangType, return_compiler_type);
+  ret.SetCompilerType(return_compiler_type);
+
+  if (exe_ctx.GetFramePtr() == NULL) {
+    Thread *thread = exe_ctx.GetThreadPtr();
+    if (thread == NULL) {
+      exe_ctx.SetThreadSP(process->GetThreadList().GetSelectedThread());
+      thread = exe_ctx.GetThreadPtr();
+    }
+    if (thread) {
+      exe_ctx.SetFrameSP(thread->GetSelectedFrame());
+    }
+  }
+
+  // Now we're ready to call the function:
+
+  DiagnosticManager diagnostics;
+  lldb::addr_t wrapper_struct_addr = LLDB_INVALID_ADDRESS;
+
+  if (!m_print_object_caller_up) {
+    Error error;
+    m_print_object_caller_up.reset(
+        exe_scope->CalculateTarget()->GetFunctionCallerForLanguage(
+            eLanguageTypeObjC, return_compiler_type, *function_address,
+            arg_value_list, "objc-object-description", error));
+    if (error.Fail()) {
+      m_print_object_caller_up.reset();
+      strm.Printf("Could not get function runner to call print for debugger "
+                  "function: %s.",
+                  error.AsCString());
+      return false;
+    }
+    m_print_object_caller_up->InsertFunction(exe_ctx, wrapper_struct_addr,
+                                             diagnostics);
+  } else {
+    m_print_object_caller_up->WriteFunctionArguments(
+        exe_ctx, wrapper_struct_addr, arg_value_list, diagnostics);
+  }
+
+  EvaluateExpressionOptions options;
+  options.SetUnwindOnError(true);
+  options.SetTryAllThreads(true);
+  options.SetStopOthers(true);
+  options.SetIgnoreBreakpoints(true);
+  options.SetTimeoutUsec(PO_FUNCTION_TIMEOUT_USEC);
+
+  ExpressionResults results = m_print_object_caller_up->ExecuteFunction(
+      exe_ctx, &wrapper_struct_addr, options, diagnostics, ret);
+  if (results != eExpressionCompleted) {
+    strm.Printf("Error evaluating Print Object function: %d.\n", results);
+    return false;
+  }
 
-Address *
-AppleObjCRuntime::GetPrintForDebuggerAddr()
-{
-    if (!m_PrintForDebugger_addr.get())
-    {
-        const ModuleList &modules = m_process->GetTarget().GetImages();
-        
-        SymbolContextList contexts;
-        SymbolContext context;
-        
-        if ((!modules.FindSymbolsWithNameAndType(ConstString ("_NSPrintForDebugger"), eSymbolTypeCode, contexts)) &&
-           (!modules.FindSymbolsWithNameAndType(ConstString ("_CFPrintForDebugger"), eSymbolTypeCode, contexts)))
-            return NULL;
-        
-        contexts.GetContextAtIndex(0, context);
-        
-        m_PrintForDebugger_addr.reset(new Address(context.symbol->GetAddress()));
+  addr_t result_ptr = ret.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+
+  char buf[512];
+  size_t cstr_len = 0;
+  size_t full_buffer_len = sizeof(buf) - 1;
+  size_t curr_len = full_buffer_len;
+  while (curr_len == full_buffer_len) {
+    Error error;
+    curr_len = process->ReadCStringFromMemory(result_ptr + cstr_len, buf,
+                                              sizeof(buf), error);
+    strm.Write(buf, curr_len);
+    cstr_len += curr_len;
+  }
+  return cstr_len > 0;
+}
+
+lldb::ModuleSP AppleObjCRuntime::GetObjCModule() {
+  ModuleSP module_sp(m_objc_module_wp.lock());
+  if (module_sp)
+    return module_sp;
+
+  Process *process = GetProcess();
+  if (process) {
+    const ModuleList &modules = process->GetTarget().GetImages();
+    for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
+      module_sp = modules.GetModuleAtIndex(idx);
+      if (AppleObjCRuntime::AppleIsModuleObjCLibrary(module_sp)) {
+        m_objc_module_wp = module_sp;
+        return module_sp;
+      }
     }
-    
-    return m_PrintForDebugger_addr.get();
+  }
+  return ModuleSP();
 }
 
-bool
-AppleObjCRuntime::CouldHaveDynamicValue (ValueObject &in_value)
-{
-    return in_value.GetCompilerType().IsPossibleDynamicType (NULL,
-                                                          false, // do not check C++
-                                                          true); // check ObjC
-}
-
-bool
-AppleObjCRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, 
-                                            lldb::DynamicValueType use_dynamic, 
-                                            TypeAndOrName &class_type_or_name, 
-                                            Address &address,
-                                            Value::ValueType &value_type)
-{
-    return false;
-}
+Address *AppleObjCRuntime::GetPrintForDebuggerAddr() {
+  if (!m_PrintForDebugger_addr.get()) {
+    const ModuleList &modules = m_process->GetTarget().GetImages();
 
-TypeAndOrName
-AppleObjCRuntime::FixUpDynamicType (const TypeAndOrName& type_and_or_name,
-                                    ValueObject& static_value)
-{
-    CompilerType static_type(static_value.GetCompilerType());
-    Flags static_type_flags(static_type.GetTypeInfo());
-    
-    TypeAndOrName ret(type_and_or_name);
-    if (type_and_or_name.HasType())
-    {
-        // The type will always be the type of the dynamic object.  If our parent's type was a pointer,
-        // then our type should be a pointer to the type of the dynamic object.  If a reference, then the original type
-        // should be okay...
-        CompilerType orig_type = type_and_or_name.GetCompilerType();
-        CompilerType corrected_type = orig_type;
-        if (static_type_flags.AllSet(eTypeIsPointer))
-            corrected_type = orig_type.GetPointerType ();
-        ret.SetCompilerType(corrected_type);
-    }
-    else
-    {
-        // If we are here we need to adjust our dynamic type name to include the correct & or * symbol
-        std::string corrected_name (type_and_or_name.GetName().GetCString());
-        if (static_type_flags.AllSet(eTypeIsPointer))
-            corrected_name.append(" *");
-        // the parent type should be a correctly pointer'ed or referenc'ed type
-        ret.SetCompilerType(static_type);
-        ret.SetName(corrected_name.c_str());
-    }
-    return ret;
+    SymbolContextList contexts;
+    SymbolContext context;
+
+    if ((!modules.FindSymbolsWithNameAndType(ConstString("_NSPrintForDebugger"),
+                                             eSymbolTypeCode, contexts)) &&
+        (!modules.FindSymbolsWithNameAndType(ConstString("_CFPrintForDebugger"),
+                                             eSymbolTypeCode, contexts)))
+      return NULL;
+
+    contexts.GetContextAtIndex(0, context);
+
+    m_PrintForDebugger_addr.reset(new Address(context.symbol->GetAddress()));
+  }
+
+  return m_PrintForDebugger_addr.get();
 }
 
-bool
-AppleObjCRuntime::AppleIsModuleObjCLibrary (const ModuleSP &module_sp)
-{
-    if (module_sp)
-    {
-        const FileSpec &module_file_spec = module_sp->GetFileSpec();
-        static ConstString ObjCName ("libobjc.A.dylib");
-        
-        if (module_file_spec)
-        {
-            if (module_file_spec.GetFilename() == ObjCName)
-                return true;
-        }
-    }
-    return false;
+bool AppleObjCRuntime::CouldHaveDynamicValue(ValueObject &in_value) {
+  return in_value.GetCompilerType().IsPossibleDynamicType(
+      NULL,
+      false, // do not check C++
+      true); // check ObjC
 }
 
-// we use the version of Foundation to make assumptions about the ObjC runtime on a target
-uint32_t
-AppleObjCRuntime::GetFoundationVersion ()
-{
-    if (!m_Foundation_major.hasValue())
-    {
-        const ModuleList& modules = m_process->GetTarget().GetImages();
-        uint32_t major = UINT32_MAX;
-        for (uint32_t idx = 0; idx < modules.GetSize(); idx++)
-        {
-            lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
-            if (!module_sp)
-                continue;
-            if (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),"Foundation") == 0)
-            {
-                module_sp->GetVersion(&major,1);
-                m_Foundation_major = major;
-                return major;
-            }
-        }
-        return LLDB_INVALID_MODULE_VERSION;
-    }
-    else
-        return m_Foundation_major.getValue();
+bool AppleObjCRuntime::GetDynamicTypeAndAddress(
+    ValueObject &in_value, lldb::DynamicValueType use_dynamic,
+    TypeAndOrName &class_type_or_name, Address &address,
+    Value::ValueType &value_type) {
+  return false;
 }
 
-void
-AppleObjCRuntime::GetValuesForGlobalCFBooleans(lldb::addr_t& cf_true,
-                                               lldb::addr_t& cf_false)
-{
-    cf_true = cf_false = LLDB_INVALID_ADDRESS;
-}
-
-bool
-AppleObjCRuntime::IsModuleObjCLibrary (const ModuleSP &module_sp)
-{
-    return AppleIsModuleObjCLibrary(module_sp);
-}
-
-bool
-AppleObjCRuntime::ReadObjCLibrary (const ModuleSP &module_sp)
-{
-    // Maybe check here and if we have a handler already, and the UUID of this module is the same as the one in the
-    // current module, then we don't have to reread it?
-    m_objc_trampoline_handler_ap.reset(new AppleObjCTrampolineHandler (m_process->shared_from_this(), module_sp));
-    if (m_objc_trampoline_handler_ap.get() != NULL)
-    {
-        m_read_objc_library = true;
+TypeAndOrName
+AppleObjCRuntime::FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+                                   ValueObject &static_value) {
+  CompilerType static_type(static_value.GetCompilerType());
+  Flags static_type_flags(static_type.GetTypeInfo());
+
+  TypeAndOrName ret(type_and_or_name);
+  if (type_and_or_name.HasType()) {
+    // The type will always be the type of the dynamic object.  If our parent's
+    // type was a pointer,
+    // then our type should be a pointer to the type of the dynamic object.  If
+    // a reference, then the original type
+    // should be okay...
+    CompilerType orig_type = type_and_or_name.GetCompilerType();
+    CompilerType corrected_type = orig_type;
+    if (static_type_flags.AllSet(eTypeIsPointer))
+      corrected_type = orig_type.GetPointerType();
+    ret.SetCompilerType(corrected_type);
+  } else {
+    // If we are here we need to adjust our dynamic type name to include the
+    // correct & or * symbol
+    std::string corrected_name(type_and_or_name.GetName().GetCString());
+    if (static_type_flags.AllSet(eTypeIsPointer))
+      corrected_name.append(" *");
+    // the parent type should be a correctly pointer'ed or referenc'ed type
+    ret.SetCompilerType(static_type);
+    ret.SetName(corrected_name.c_str());
+  }
+  return ret;
+}
+
+bool AppleObjCRuntime::AppleIsModuleObjCLibrary(const ModuleSP &module_sp) {
+  if (module_sp) {
+    const FileSpec &module_file_spec = module_sp->GetFileSpec();
+    static ConstString ObjCName("libobjc.A.dylib");
+
+    if (module_file_spec) {
+      if (module_file_spec.GetFilename() == ObjCName)
         return true;
     }
-    else
-        return false;
+  }
+  return false;
 }
 
-ThreadPlanSP
-AppleObjCRuntime::GetStepThroughTrampolinePlan (Thread &thread, bool stop_others)
-{
-    ThreadPlanSP thread_plan_sp;
-    if (m_objc_trampoline_handler_ap.get())
-        thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan (thread, stop_others);
-    return thread_plan_sp;
+// we use the version of Foundation to make assumptions about the ObjC runtime
+// on a target
+uint32_t AppleObjCRuntime::GetFoundationVersion() {
+  if (!m_Foundation_major.hasValue()) {
+    const ModuleList &modules = m_process->GetTarget().GetImages();
+    uint32_t major = UINT32_MAX;
+    for (uint32_t idx = 0; idx < modules.GetSize(); idx++) {
+      lldb::ModuleSP module_sp = modules.GetModuleAtIndex(idx);
+      if (!module_sp)
+        continue;
+      if (strcmp(module_sp->GetFileSpec().GetFilename().AsCString(""),
+                 "Foundation") == 0) {
+        module_sp->GetVersion(&major, 1);
+        m_Foundation_major = major;
+        return major;
+      }
+    }
+    return LLDB_INVALID_MODULE_VERSION;
+  } else
+    return m_Foundation_major.getValue();
+}
+
+void AppleObjCRuntime::GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
+                                                    lldb::addr_t &cf_false) {
+  cf_true = cf_false = LLDB_INVALID_ADDRESS;
+}
+
+bool AppleObjCRuntime::IsModuleObjCLibrary(const ModuleSP &module_sp) {
+  return AppleIsModuleObjCLibrary(module_sp);
+}
+
+bool AppleObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) {
+  // Maybe check here and if we have a handler already, and the UUID of this
+  // module is the same as the one in the
+  // current module, then we don't have to reread it?
+  m_objc_trampoline_handler_ap.reset(
+      new AppleObjCTrampolineHandler(m_process->shared_from_this(), module_sp));
+  if (m_objc_trampoline_handler_ap.get() != NULL) {
+    m_read_objc_library = true;
+    return true;
+  } else
+    return false;
+}
+
+ThreadPlanSP AppleObjCRuntime::GetStepThroughTrampolinePlan(Thread &thread,
+                                                            bool stop_others) {
+  ThreadPlanSP thread_plan_sp;
+  if (m_objc_trampoline_handler_ap.get())
+    thread_plan_sp = m_objc_trampoline_handler_ap->GetStepThroughDispatchPlan(
+        thread, stop_others);
+  return thread_plan_sp;
 }
 
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
 ObjCLanguageRuntime::ObjCRuntimeVersions
-AppleObjCRuntime::GetObjCVersion (Process *process, ModuleSP &objc_module_sp)
-{
-    if (!process)
-        return ObjCRuntimeVersions::eObjC_VersionUnknown;
+AppleObjCRuntime::GetObjCVersion(Process *process, ModuleSP &objc_module_sp) {
+  if (!process)
+    return ObjCRuntimeVersions::eObjC_VersionUnknown;
 
-    Target &target = process->GetTarget();
-    if (target.GetArchitecture().GetTriple().getVendor() != llvm::Triple::VendorType::Apple)
-        return ObjCRuntimeVersions::eObjC_VersionUnknown;
+  Target &target = process->GetTarget();
+  if (target.GetArchitecture().GetTriple().getVendor() !=
+      llvm::Triple::VendorType::Apple)
+    return ObjCRuntimeVersions::eObjC_VersionUnknown;
 
-    const ModuleList &target_modules = target.GetImages();
-    std::lock_guard<std::recursive_mutex> gaurd(target_modules.GetMutex());
+  const ModuleList &target_modules = target.GetImages();
+  std::lock_guard<std::recursive_mutex> gaurd(target_modules.GetMutex());
+
+  size_t num_images = target_modules.GetSize();
+  for (size_t i = 0; i < num_images; i++) {
+    ModuleSP module_sp = target_modules.GetModuleAtIndexUnlocked(i);
+    // One tricky bit here is that we might get called as part of the initial
+    // module loading, but
+    // before all the pre-run libraries get winnowed from the module list.  So
+    // there might actually
+    // be an old and incorrect ObjC library sitting around in the list, and we
+    // don't want to look at that.
+    // That's why we call IsLoadedInTarget.
+
+    if (AppleIsModuleObjCLibrary(module_sp) &&
+        module_sp->IsLoadedInTarget(&target)) {
+      objc_module_sp = module_sp;
+      ObjectFile *ofile = module_sp->GetObjectFile();
+      if (!ofile)
+        return ObjCRuntimeVersions::eObjC_VersionUnknown;
 
-    size_t num_images = target_modules.GetSize();
-    for (size_t i = 0; i < num_images; i++)
-    {
-        ModuleSP module_sp = target_modules.GetModuleAtIndexUnlocked(i);
-        // One tricky bit here is that we might get called as part of the initial module loading, but
-        // before all the pre-run libraries get winnowed from the module list.  So there might actually
-        // be an old and incorrect ObjC library sitting around in the list, and we don't want to look at that.
-        // That's why we call IsLoadedInTarget.
-        
-        if (AppleIsModuleObjCLibrary (module_sp) && module_sp->IsLoadedInTarget(&target))
-        {
-            objc_module_sp = module_sp;
-            ObjectFile *ofile = module_sp->GetObjectFile();
-            if (!ofile)
-                return ObjCRuntimeVersions::eObjC_VersionUnknown;
-            
-            SectionList *sections = module_sp->GetSectionList();
-            if (!sections)
-                return ObjCRuntimeVersions::eObjC_VersionUnknown;
-            SectionSP v1_telltale_section_sp = sections->FindSectionByName(ConstString ("__OBJC"));
-            if (v1_telltale_section_sp)
-            {
-                return ObjCRuntimeVersions::eAppleObjC_V1;
-            }
-            return ObjCRuntimeVersions::eAppleObjC_V2;
-        }
+      SectionList *sections = module_sp->GetSectionList();
+      if (!sections)
+        return ObjCRuntimeVersions::eObjC_VersionUnknown;
+      SectionSP v1_telltale_section_sp =
+          sections->FindSectionByName(ConstString("__OBJC"));
+      if (v1_telltale_section_sp) {
+        return ObjCRuntimeVersions::eAppleObjC_V1;
+      }
+      return ObjCRuntimeVersions::eAppleObjC_V2;
     }
-            
-    return ObjCRuntimeVersions::eObjC_VersionUnknown;
+  }
+
+  return ObjCRuntimeVersions::eObjC_VersionUnknown;
 }
 
-void
-AppleObjCRuntime::SetExceptionBreakpoints ()
-{
-    const bool catch_bp = false;
-    const bool throw_bp = true;
-    const bool is_internal = true;
-    
-    if (!m_objc_exception_bp_sp)
-    {
-        m_objc_exception_bp_sp = LanguageRuntime::CreateExceptionBreakpoint (m_process->GetTarget(),
-                                                                            GetLanguageType(),
-                                                                            catch_bp, 
-                                                                            throw_bp, 
-                                                                            is_internal);
-        if (m_objc_exception_bp_sp)
-            m_objc_exception_bp_sp->SetBreakpointKind("ObjC exception");
-    }
-    else
-        m_objc_exception_bp_sp->SetEnabled(true);
+void AppleObjCRuntime::SetExceptionBreakpoints() {
+  const bool catch_bp = false;
+  const bool throw_bp = true;
+  const bool is_internal = true;
+
+  if (!m_objc_exception_bp_sp) {
+    m_objc_exception_bp_sp = LanguageRuntime::CreateExceptionBreakpoint(
+        m_process->GetTarget(), GetLanguageType(), catch_bp, throw_bp,
+        is_internal);
+    if (m_objc_exception_bp_sp)
+      m_objc_exception_bp_sp->SetBreakpointKind("ObjC exception");
+  } else
+    m_objc_exception_bp_sp->SetEnabled(true);
 }
 
+void AppleObjCRuntime::ClearExceptionBreakpoints() {
+  if (!m_process)
+    return;
 
-void
-AppleObjCRuntime::ClearExceptionBreakpoints ()
-{
-    if (!m_process)
-        return;
-    
-    if (m_objc_exception_bp_sp.get())
-    {
-        m_objc_exception_bp_sp->SetEnabled (false);
-    }
+  if (m_objc_exception_bp_sp.get()) {
+    m_objc_exception_bp_sp->SetEnabled(false);
+  }
 }
 
-bool
-AppleObjCRuntime::ExceptionBreakpointsAreSet ()
-{
-    return m_objc_exception_bp_sp && m_objc_exception_bp_sp->IsEnabled();
-}
-
-bool
-AppleObjCRuntime::ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason)
-{
-    if (!m_process)
-        return false;
-    
-    if (!stop_reason || 
-        stop_reason->GetStopReason() != eStopReasonBreakpoint)
-        return false;
-    
-    uint64_t break_site_id = stop_reason->GetValue();
-    return m_process->GetBreakpointSiteList().BreakpointSiteContainsBreakpoint (break_site_id,
-                                                                                m_objc_exception_bp_sp->GetID());
-}
-
-bool
-AppleObjCRuntime::CalculateHasNewLiteralsAndIndexing()
-{
-    if (!m_process)
-        return false;
-    
-    Target &target(m_process->GetTarget());
-    
-    static ConstString s_method_signature("-[NSDictionary objectForKeyedSubscript:]");
-    static ConstString s_arclite_method_signature("__arclite_objectForKeyedSubscript");
-    
-    SymbolContextList sc_list;
-    
-    if (target.GetImages().FindSymbolsWithNameAndType(s_method_signature, eSymbolTypeCode, sc_list) ||
-        target.GetImages().FindSymbolsWithNameAndType(s_arclite_method_signature, eSymbolTypeCode, sc_list))
-        return true;
-    else
-        return false;
+bool AppleObjCRuntime::ExceptionBreakpointsAreSet() {
+  return m_objc_exception_bp_sp && m_objc_exception_bp_sp->IsEnabled();
 }
 
-lldb::SearchFilterSP
-AppleObjCRuntime::CreateExceptionSearchFilter ()
-{
-    Target &target = m_process->GetTarget();
-    
-    if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple)
-    {
-        FileSpecList filter_modules;
-        filter_modules.Append(FileSpec("libobjc.A.dylib", false));
-        return target.GetSearchFilterForModuleList(&filter_modules);
-    }
-    else
-    {
-        return LanguageRuntime::CreateExceptionSearchFilter();
-    }
+bool AppleObjCRuntime::ExceptionBreakpointsExplainStop(
+    lldb::StopInfoSP stop_reason) {
+  if (!m_process)
+    return false;
+
+  if (!stop_reason || stop_reason->GetStopReason() != eStopReasonBreakpoint)
+    return false;
+
+  uint64_t break_site_id = stop_reason->GetValue();
+  return m_process->GetBreakpointSiteList().BreakpointSiteContainsBreakpoint(
+      break_site_id, m_objc_exception_bp_sp->GetID());
 }
 
-void
-AppleObjCRuntime::ReadObjCLibraryIfNeeded (const ModuleList &module_list)
-{
-    if (!HasReadObjCLibrary ())
-    {
-        std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
-
-        size_t num_modules = module_list.GetSize();
-        for (size_t i = 0; i < num_modules; i++)
-        {
-            auto mod = module_list.GetModuleAtIndex (i);
-            if (IsModuleObjCLibrary (mod))
-            {
-                ReadObjCLibrary (mod);
-                break;
-            }
-        }
-    }
+bool AppleObjCRuntime::CalculateHasNewLiteralsAndIndexing() {
+  if (!m_process)
+    return false;
+
+  Target &target(m_process->GetTarget());
+
+  static ConstString s_method_signature(
+      "-[NSDictionary objectForKeyedSubscript:]");
+  static ConstString s_arclite_method_signature(
+      "__arclite_objectForKeyedSubscript");
+
+  SymbolContextList sc_list;
+
+  if (target.GetImages().FindSymbolsWithNameAndType(s_method_signature,
+                                                    eSymbolTypeCode, sc_list) ||
+      target.GetImages().FindSymbolsWithNameAndType(s_arclite_method_signature,
+                                                    eSymbolTypeCode, sc_list))
+    return true;
+  else
+    return false;
 }
 
-void
-AppleObjCRuntime::ModulesDidLoad (const ModuleList &module_list)
-{
-    ReadObjCLibraryIfNeeded (module_list);
+lldb::SearchFilterSP AppleObjCRuntime::CreateExceptionSearchFilter() {
+  Target &target = m_process->GetTarget();
+
+  if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
+    FileSpecList filter_modules;
+    filter_modules.Append(FileSpec("libobjc.A.dylib", false));
+    return target.GetSearchFilterForModuleList(&filter_modules);
+  } else {
+    return LanguageRuntime::CreateExceptionSearchFilter();
+  }
+}
+
+void AppleObjCRuntime::ReadObjCLibraryIfNeeded(const ModuleList &module_list) {
+  if (!HasReadObjCLibrary()) {
+    std::lock_guard<std::recursive_mutex> guard(module_list.GetMutex());
+
+    size_t num_modules = module_list.GetSize();
+    for (size_t i = 0; i < num_modules; i++) {
+      auto mod = module_list.GetModuleAtIndex(i);
+      if (IsModuleObjCLibrary(mod)) {
+        ReadObjCLibrary(mod);
+        break;
+      }
+    }
+  }
 }
 
+void AppleObjCRuntime::ModulesDidLoad(const ModuleList &module_list) {
+  ReadObjCLibraryIfNeeded(module_list);
+}

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h Tue Sep  6 15:57:50 2016
@@ -16,137 +16,112 @@
 #include "llvm/ADT/Optional.h"
 
 // Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Target/LanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "AppleObjCTrampolineHandler.h"
 #include "AppleThreadPlanStepThroughObjCTrampoline.h"
+#include "lldb/Target/LanguageRuntime.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
-    
-class AppleObjCRuntime :
-        public lldb_private::ObjCLanguageRuntime
-{
+
+class AppleObjCRuntime : public lldb_private::ObjCLanguageRuntime {
 public:
-    ~AppleObjCRuntime() override;
+  ~AppleObjCRuntime() override;
 
-    //------------------------------------------------------------------
-    // Static Functions
-    //------------------------------------------------------------------
-    // Note there is no CreateInstance, Initialize & Terminate functions here, 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 Functions
+  //------------------------------------------------------------------
+  // Note there is no CreateInstance, Initialize & Terminate functions here,
+  // 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;
     }
-    
-    // These are generic runtime functions:
-    bool
-    GetObjectDescription (Stream &str, Value &value, ExecutionContextScope *exe_scope) override;
-    
-    bool
-    GetObjectDescription (Stream &str, ValueObject &object) override;
-    
-    bool
-    CouldHaveDynamicValue (ValueObject &in_value) override;
-    
-    bool
-    GetDynamicTypeAndAddress (ValueObject &in_value, 
-                              lldb::DynamicValueType use_dynamic, 
-                              TypeAndOrName &class_type_or_name, 
-                              Address &address,
-                              Value::ValueType &value_type) override;
-
-    TypeAndOrName
-    FixUpDynamicType (const TypeAndOrName& type_and_or_name,
-                      ValueObject& static_value) override;
-    
-    // These are the ObjC specific functions.
-    
-    bool
-    IsModuleObjCLibrary (const lldb::ModuleSP &module_sp) override;
-    
-    bool
-    ReadObjCLibrary (const lldb::ModuleSP &module_sp) override;
-
-    bool
-    HasReadObjCLibrary ()  override
-    {
-        return m_read_objc_library;
-    }
-    
-    lldb::ThreadPlanSP
-    GetStepThroughTrampolinePlan (Thread &thread, bool stop_others) override;
-    
-    // Get the "libobjc.A.dylib" module from the current target if we can find
-    // it, also cache it once it is found to ensure quick lookups.
-    lldb::ModuleSP
-    GetObjCModule ();
-    
-    // Sync up with the target
-
-    void
-    ModulesDidLoad (const ModuleList &module_list) override;
-
-    void
-    SetExceptionBreakpoints() override;
-
-    void
-    ClearExceptionBreakpoints() override;
-    
-    bool
-    ExceptionBreakpointsAreSet() override;
-    
-    bool
-    ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
-    
-    lldb::SearchFilterSP
-    CreateExceptionSearchFilter() override;
-    
-    uint32_t
-    GetFoundationVersion();
-    
-    virtual void
-    GetValuesForGlobalCFBooleans(lldb::addr_t& cf_true,
-                                 lldb::addr_t& cf_false);
-    
+  }
+
+  // These are generic runtime functions:
+  bool GetObjectDescription(Stream &str, Value &value,
+                            ExecutionContextScope *exe_scope) override;
+
+  bool GetObjectDescription(Stream &str, ValueObject &object) override;
+
+  bool CouldHaveDynamicValue(ValueObject &in_value) override;
+
+  bool GetDynamicTypeAndAddress(ValueObject &in_value,
+                                lldb::DynamicValueType use_dynamic,
+                                TypeAndOrName &class_type_or_name,
+                                Address &address,
+                                Value::ValueType &value_type) override;
+
+  TypeAndOrName FixUpDynamicType(const TypeAndOrName &type_and_or_name,
+                                 ValueObject &static_value) override;
+
+  // These are the ObjC specific functions.
+
+  bool IsModuleObjCLibrary(const lldb::ModuleSP &module_sp) override;
+
+  bool ReadObjCLibrary(const lldb::ModuleSP &module_sp) override;
+
+  bool HasReadObjCLibrary() override { return m_read_objc_library; }
+
+  lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread,
+                                                  bool stop_others) override;
+
+  // Get the "libobjc.A.dylib" module from the current target if we can find
+  // it, also cache it once it is found to ensure quick lookups.
+  lldb::ModuleSP GetObjCModule();
+
+  // Sync up with the target
+
+  void ModulesDidLoad(const ModuleList &module_list) override;
+
+  void SetExceptionBreakpoints() override;
+
+  void ClearExceptionBreakpoints() override;
+
+  bool ExceptionBreakpointsAreSet() override;
+
+  bool ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override;
+
+  lldb::SearchFilterSP CreateExceptionSearchFilter() override;
+
+  uint32_t GetFoundationVersion();
+
+  virtual void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
+                                            lldb::addr_t &cf_false);
+
 protected:
-    // Call CreateInstance instead.
-    AppleObjCRuntime(Process *process);
+  // Call CreateInstance instead.
+  AppleObjCRuntime(Process *process);
+
+  bool CalculateHasNewLiteralsAndIndexing() override;
+
+  static bool AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp);
+
+  static ObjCRuntimeVersions GetObjCVersion(Process *process,
+                                            lldb::ModuleSP &objc_module_sp);
 
-    bool
-    CalculateHasNewLiteralsAndIndexing() override;
-    
-    static bool
-    AppleIsModuleObjCLibrary(const lldb::ModuleSP &module_sp);
-
-    static ObjCRuntimeVersions
-    GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp);
-
-    void
-    ReadObjCLibraryIfNeeded(const ModuleList &module_list);
-
-    Address *
-    GetPrintForDebuggerAddr();
-    
-    std::unique_ptr<Address>  m_PrintForDebugger_addr;
-    bool m_read_objc_library;
-    std::unique_ptr<lldb_private::AppleObjCTrampolineHandler> m_objc_trampoline_handler_ap;
-    lldb::BreakpointSP m_objc_exception_bp_sp;
-    lldb::ModuleWP m_objc_module_wp;
-    std::unique_ptr<FunctionCaller>  m_print_object_caller_up;
-    
-    llvm::Optional<uint32_t> m_Foundation_major;
+  void ReadObjCLibraryIfNeeded(const ModuleList &module_list);
+
+  Address *GetPrintForDebuggerAddr();
+
+  std::unique_ptr<Address> m_PrintForDebugger_addr;
+  bool m_read_objc_library;
+  std::unique_ptr<lldb_private::AppleObjCTrampolineHandler>
+      m_objc_trampoline_handler_ap;
+  lldb::BreakpointSP m_objc_exception_bp_sp;
+  lldb::ModuleWP m_objc_module_wp;
+  std::unique_ptr<FunctionCaller> m_print_object_caller_up;
+
+  llvm::Optional<uint32_t> m_Foundation_major;
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_AppleObjCRuntime_h_

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- AppleObjCRuntimeV1.cpp --------------------------------------*- C++ -*-===//
+//===-- AppleObjCRuntimeV1.cpp --------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -8,8 +9,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "AppleObjCRuntimeV1.h"
-#include "AppleObjCTrampolineHandler.h"
 #include "AppleObjCDeclVendor.h"
+#include "AppleObjCTrampolineHandler.h"
 
 #include "clang/AST/Type.h"
 
@@ -36,425 +37,403 @@
 using namespace lldb;
 using namespace lldb_private;
 
-AppleObjCRuntimeV1::AppleObjCRuntimeV1(Process *process) :
-    AppleObjCRuntime (process),
-    m_hash_signature (),
-    m_isa_hash_table_ptr (LLDB_INVALID_ADDRESS)
-{
-}
+AppleObjCRuntimeV1::AppleObjCRuntimeV1(Process *process)
+    : AppleObjCRuntime(process), 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
+// 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
-bool
-AppleObjCRuntimeV1::GetDynamicTypeAndAddress (ValueObject &in_value,
-                                              lldb::DynamicValueType use_dynamic,
-                                              TypeAndOrName &class_type_or_name,
-                                              Address &address,
-                                              Value::ValueType &value_type)
-{
-    class_type_or_name.Clear();
-    value_type = Value::ValueType::eValueTypeScalar;
-    if (CouldHaveDynamicValue(in_value))
-    {
-        auto class_descriptor(GetClassDescriptor(in_value));
-        if (class_descriptor && class_descriptor->IsValid() && class_descriptor->GetClassName())
-        {
-            const addr_t object_ptr = in_value.GetPointerValue();
-            address.SetRawAddress(object_ptr);
-            class_type_or_name.SetName(class_descriptor->GetClassName());
-        }
+bool AppleObjCRuntimeV1::GetDynamicTypeAndAddress(
+    ValueObject &in_value, lldb::DynamicValueType use_dynamic,
+    TypeAndOrName &class_type_or_name, Address &address,
+    Value::ValueType &value_type) {
+  class_type_or_name.Clear();
+  value_type = Value::ValueType::eValueTypeScalar;
+  if (CouldHaveDynamicValue(in_value)) {
+    auto class_descriptor(GetClassDescriptor(in_value));
+    if (class_descriptor && class_descriptor->IsValid() &&
+        class_descriptor->GetClassName()) {
+      const addr_t object_ptr = in_value.GetPointerValue();
+      address.SetRawAddress(object_ptr);
+      class_type_or_name.SetName(class_descriptor->GetClassName());
     }
-    return class_type_or_name.IsEmpty() == false;
+  }
+  return class_type_or_name.IsEmpty() == false;
 }
 
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
 lldb_private::LanguageRuntime *
-AppleObjCRuntimeV1::CreateInstance (Process *process, lldb::LanguageType language)
-{
-    // FIXME: This should be a MacOS or iOS process, and we need to look for the OBJC section to make
-    // sure we aren't using the V1 runtime.
-    if (language == eLanguageTypeObjC)
-    {
-        ModuleSP objc_module_sp;
-        
-        if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == ObjCRuntimeVersions::eAppleObjC_V1)
-            return new AppleObjCRuntimeV1 (process);
-        else
-            return NULL;
-    }
+AppleObjCRuntimeV1::CreateInstance(Process *process,
+                                   lldb::LanguageType language) {
+  // FIXME: This should be a MacOS or iOS process, and we need to look for the
+  // OBJC section to make
+  // sure we aren't using the V1 runtime.
+  if (language == eLanguageTypeObjC) {
+    ModuleSP objc_module_sp;
+
+    if (AppleObjCRuntime::GetObjCVersion(process, objc_module_sp) ==
+        ObjCRuntimeVersions::eAppleObjC_V1)
+      return new AppleObjCRuntimeV1(process);
     else
-        return NULL;
+      return NULL;
+  } else
+    return NULL;
 }
 
-
-void
-AppleObjCRuntimeV1::Initialize()
-{
-    PluginManager::RegisterPlugin (GetPluginNameStatic(),
-                                   "Apple Objective C Language Runtime - Version 1",
-                                   CreateInstance);    
+void AppleObjCRuntimeV1::Initialize() {
+  PluginManager::RegisterPlugin(
+      GetPluginNameStatic(), "Apple Objective C Language Runtime - Version 1",
+      CreateInstance);
 }
 
-void
-AppleObjCRuntimeV1::Terminate()
-{
-    PluginManager::UnregisterPlugin (CreateInstance);
+void AppleObjCRuntimeV1::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
 }
 
-lldb_private::ConstString
-AppleObjCRuntimeV1::GetPluginNameStatic()
-{
-    static ConstString g_name("apple-objc-v1");
-    return g_name;
+lldb_private::ConstString AppleObjCRuntimeV1::GetPluginNameStatic() {
+  static ConstString g_name("apple-objc-v1");
+  return g_name;
 }
 
 //------------------------------------------------------------------
 // PluginInterface protocol
 //------------------------------------------------------------------
-ConstString
-AppleObjCRuntimeV1::GetPluginName()
-{
-    return GetPluginNameStatic();
+ConstString AppleObjCRuntimeV1::GetPluginName() {
+  return GetPluginNameStatic();
 }
 
-uint32_t
-AppleObjCRuntimeV1::GetPluginVersion()
-{
-    return 1;
-}
+uint32_t AppleObjCRuntimeV1::GetPluginVersion() { return 1; }
 
 BreakpointResolverSP
-AppleObjCRuntimeV1::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp)
-{
-    BreakpointResolverSP resolver_sp;
-    
-    if (throw_bp)
-        resolver_sp.reset (new BreakpointResolverName (bkpt,
-                                                       "objc_exception_throw",
-                                                       eFunctionNameTypeBase,
-                                                       eLanguageTypeUnknown,
-                                                       Breakpoint::Exact,
-                                                       0,
-                                                       eLazyBoolNo));
-    // FIXME: don't do catch yet.
-    return resolver_sp;
+AppleObjCRuntimeV1::CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp,
+                                            bool throw_bp) {
+  BreakpointResolverSP resolver_sp;
+
+  if (throw_bp)
+    resolver_sp.reset(new BreakpointResolverName(
+        bkpt, "objc_exception_throw", eFunctionNameTypeBase,
+        eLanguageTypeUnknown, Breakpoint::Exact, 0, eLazyBoolNo));
+  // FIXME: don't do catch yet.
+  return resolver_sp;
 }
 
 struct BufStruct {
-    char contents[2048];
+  char contents[2048];
 };
 
-UtilityFunction *
-AppleObjCRuntimeV1::CreateObjectChecker(const char *name)
-{
-    std::unique_ptr<BufStruct> buf(new BufStruct);
-    
-    assert(snprintf(&buf->contents[0], sizeof(buf->contents),
-                    "struct __objc_class                                                    \n"
-                    "{                                                                      \n"
-                    "   struct __objc_class *isa;                                           \n"
-                    "   struct __objc_class *super_class;                                   \n"
-                    "   const char *name;                                                   \n"
-                    "   // rest of struct elided because unused                             \n"
-                    "};                                                                     \n"
-                    "                                                                       \n"
-                    "struct __objc_object                                                   \n"
-                    "{                                                                      \n"
-                    "   struct __objc_class *isa;                                           \n"
-                    "};                                                                     \n"
-                    "                                                                       \n"
-                    "extern \"C\" void                                                      \n"
-                    "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector)                  \n"
-                    "{                                                                      \n"
-                    "   struct __objc_object *obj = (struct __objc_object*)$__lldb_arg_obj; \n"
-                    "   (int)strlen(obj->isa->name);                                        \n"
-                    "}                                                                      \n",
-                    name) < (int)sizeof(buf->contents));
-
-    Error error;
-    return GetTargetRef().GetUtilityFunctionForLanguage(buf->contents, eLanguageTypeObjC, name, error);
-}
-
-AppleObjCRuntimeV1::ClassDescriptorV1::ClassDescriptorV1 (ValueObject &isa_pointer)
-{
-    Initialize (isa_pointer.GetValueAsUnsigned(0),
-                isa_pointer.GetProcessSP());
-}
-
-AppleObjCRuntimeV1::ClassDescriptorV1::ClassDescriptorV1 (ObjCISA isa, lldb::ProcessSP process_sp)
-{
-    Initialize (isa, process_sp);
-}
-
-void
-AppleObjCRuntimeV1::ClassDescriptorV1::Initialize (ObjCISA isa, lldb::ProcessSP process_sp)
-{
-    if (!isa || !process_sp)
-    {
-        m_valid = false;
-        return;
-    }
-    
-    m_valid = true;
-    
-    Error error;
-    
-    m_isa = process_sp->ReadPointerFromMemory(isa, error);
-    
-    if (error.Fail())
-    {
-        m_valid = false;
-        return;
-    }
-    
-    uint32_t ptr_size = process_sp->GetAddressByteSize();
-    
-    if (!IsPointerValid(m_isa,ptr_size))
-    {
-        m_valid = false;
-        return;
-    }
+UtilityFunction *AppleObjCRuntimeV1::CreateObjectChecker(const char *name) {
+  std::unique_ptr<BufStruct> buf(new BufStruct);
 
-    m_parent_isa = process_sp->ReadPointerFromMemory(m_isa + ptr_size,error);
-    
-    if (error.Fail())
-    {
-        m_valid = false;
-        return;
-    }
-    
-    if (!IsPointerValid(m_parent_isa,ptr_size,true))
-    {
-        m_valid = false;
-        return;
-    }
-    
-    lldb::addr_t name_ptr = process_sp->ReadPointerFromMemory(m_isa + 2 * ptr_size,error);
-    
-    if (error.Fail())
-    {
-        m_valid = false;
-        return;
-    }
-    
-    lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024, 0));
-    
-    size_t count = process_sp->ReadCStringFromMemory(name_ptr, (char*)buffer_sp->GetBytes(), 1024, error);
-    
-    if (error.Fail())
-    {
-        m_valid = false;
-        return;
-    }
-    
-    if (count)
-        m_name = ConstString((char*)buffer_sp->GetBytes());
-    else
-        m_name = ConstString();
-    
-    m_instance_size = process_sp->ReadUnsignedIntegerFromMemory(m_isa + 5 * ptr_size, ptr_size, 0, error);
-    
-    if (error.Fail())
-    {
-        m_valid = false;
-        return;
-    }
-    
-    m_process_wp = lldb::ProcessWP(process_sp);
+  assert(snprintf(&buf->contents[0], sizeof(buf->contents),
+                  "struct __objc_class                                         "
+                  "           \n"
+                  "{                                                           "
+                  "           \n"
+                  "   struct __objc_class *isa;                                "
+                  "           \n"
+                  "   struct __objc_class *super_class;                        "
+                  "           \n"
+                  "   const char *name;                                        "
+                  "           \n"
+                  "   // rest of struct elided because unused                  "
+                  "           \n"
+                  "};                                                          "
+                  "           \n"
+                  "                                                            "
+                  "           \n"
+                  "struct __objc_object                                        "
+                  "           \n"
+                  "{                                                           "
+                  "           \n"
+                  "   struct __objc_class *isa;                                "
+                  "           \n"
+                  "};                                                          "
+                  "           \n"
+                  "                                                            "
+                  "           \n"
+                  "extern \"C\" void                                           "
+                  "           \n"
+                  "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector)       "
+                  "           \n"
+                  "{                                                           "
+                  "           \n"
+                  "   struct __objc_object *obj = (struct "
+                  "__objc_object*)$__lldb_arg_obj; \n"
+                  "   (int)strlen(obj->isa->name);                             "
+                  "           \n"
+                  "}                                                           "
+                  "           \n",
+                  name) < (int)sizeof(buf->contents));
+
+  Error error;
+  return GetTargetRef().GetUtilityFunctionForLanguage(
+      buf->contents, eLanguageTypeObjC, name, error);
+}
+
+AppleObjCRuntimeV1::ClassDescriptorV1::ClassDescriptorV1(
+    ValueObject &isa_pointer) {
+  Initialize(isa_pointer.GetValueAsUnsigned(0), isa_pointer.GetProcessSP());
+}
+
+AppleObjCRuntimeV1::ClassDescriptorV1::ClassDescriptorV1(
+    ObjCISA isa, lldb::ProcessSP process_sp) {
+  Initialize(isa, process_sp);
+}
+
+void AppleObjCRuntimeV1::ClassDescriptorV1::Initialize(
+    ObjCISA isa, lldb::ProcessSP process_sp) {
+  if (!isa || !process_sp) {
+    m_valid = false;
+    return;
+  }
+
+  m_valid = true;
+
+  Error error;
+
+  m_isa = process_sp->ReadPointerFromMemory(isa, error);
+
+  if (error.Fail()) {
+    m_valid = false;
+    return;
+  }
+
+  uint32_t ptr_size = process_sp->GetAddressByteSize();
+
+  if (!IsPointerValid(m_isa, ptr_size)) {
+    m_valid = false;
+    return;
+  }
+
+  m_parent_isa = process_sp->ReadPointerFromMemory(m_isa + ptr_size, error);
+
+  if (error.Fail()) {
+    m_valid = false;
+    return;
+  }
+
+  if (!IsPointerValid(m_parent_isa, ptr_size, true)) {
+    m_valid = false;
+    return;
+  }
+
+  lldb::addr_t name_ptr =
+      process_sp->ReadPointerFromMemory(m_isa + 2 * ptr_size, error);
+
+  if (error.Fail()) {
+    m_valid = false;
+    return;
+  }
+
+  lldb::DataBufferSP buffer_sp(new DataBufferHeap(1024, 0));
+
+  size_t count = process_sp->ReadCStringFromMemory(
+      name_ptr, (char *)buffer_sp->GetBytes(), 1024, error);
+
+  if (error.Fail()) {
+    m_valid = false;
+    return;
+  }
+
+  if (count)
+    m_name = ConstString((char *)buffer_sp->GetBytes());
+  else
+    m_name = ConstString();
+
+  m_instance_size = process_sp->ReadUnsignedIntegerFromMemory(
+      m_isa + 5 * ptr_size, ptr_size, 0, error);
+
+  if (error.Fail()) {
+    m_valid = false;
+    return;
+  }
+
+  m_process_wp = lldb::ProcessWP(process_sp);
 }
 
 AppleObjCRuntime::ClassDescriptorSP
-AppleObjCRuntimeV1::ClassDescriptorV1::GetSuperclass ()
-{
-    if (!m_valid)
-        return AppleObjCRuntime::ClassDescriptorSP();
-    ProcessSP process_sp = m_process_wp.lock();
-    if (!process_sp)
-        return AppleObjCRuntime::ClassDescriptorSP();
-    return ObjCLanguageRuntime::ClassDescriptorSP(new AppleObjCRuntimeV1::ClassDescriptorV1(m_parent_isa,process_sp));
+AppleObjCRuntimeV1::ClassDescriptorV1::GetSuperclass() {
+  if (!m_valid)
+    return AppleObjCRuntime::ClassDescriptorSP();
+  ProcessSP process_sp = m_process_wp.lock();
+  if (!process_sp)
+    return AppleObjCRuntime::ClassDescriptorSP();
+  return ObjCLanguageRuntime::ClassDescriptorSP(
+      new AppleObjCRuntimeV1::ClassDescriptorV1(m_parent_isa, process_sp));
 }
 
 AppleObjCRuntime::ClassDescriptorSP
-AppleObjCRuntimeV1::ClassDescriptorV1::GetMetaclass () const
-{
-    return ClassDescriptorSP();
-}
-
-bool
-AppleObjCRuntimeV1::ClassDescriptorV1::Describe (std::function <void (ObjCLanguageRuntime::ObjCISA)> const &superclass_func,
-                                                 std::function <bool (const char *, const char *)> const &instance_method_func,
-                                                 std::function <bool (const char *, const char *)> const &class_method_func,
-                                                 std::function <bool (const char *, const char *, lldb::addr_t, uint64_t)> const &ivar_func) const
-{
-    return false;
-}
-
-lldb::addr_t
-AppleObjCRuntimeV1::GetISAHashTablePointer ()
-{
-    if (m_isa_hash_table_ptr == LLDB_INVALID_ADDRESS)
-    {
-        ModuleSP objc_module_sp(GetObjCModule());
-        
-        if (!objc_module_sp)
-            return LLDB_INVALID_ADDRESS;
-        
-        static ConstString g_objc_debug_class_hash("_objc_debug_class_hash");
-        
-        const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(g_objc_debug_class_hash, lldb::eSymbolTypeData);
-        if (symbol && symbol->ValueIsAddress())
-        {
-            Process *process = GetProcess();
-            if (process)
-            {
-
-                lldb::addr_t objc_debug_class_hash_addr = symbol->GetAddressRef().GetLoadAddress(&process->GetTarget());
-            
-                if (objc_debug_class_hash_addr != LLDB_INVALID_ADDRESS)
-                {
-                    Error error;
-                    lldb::addr_t objc_debug_class_hash_ptr = process->ReadPointerFromMemory(objc_debug_class_hash_addr, error);
-                    if (objc_debug_class_hash_ptr != 0 &&
-                        objc_debug_class_hash_ptr != LLDB_INVALID_ADDRESS)
-                    {
-                        m_isa_hash_table_ptr = objc_debug_class_hash_ptr;
-                    }
-                }
-            }
+AppleObjCRuntimeV1::ClassDescriptorV1::GetMetaclass() const {
+  return ClassDescriptorSP();
+}
+
+bool AppleObjCRuntimeV1::ClassDescriptorV1::Describe(
+    std::function<void(ObjCLanguageRuntime::ObjCISA)> const &superclass_func,
+    std::function<bool(const char *, const char *)> const &instance_method_func,
+    std::function<bool(const char *, const char *)> const &class_method_func,
+    std::function<bool(const char *, const char *, lldb::addr_t,
+                       uint64_t)> const &ivar_func) const {
+  return false;
+}
+
+lldb::addr_t AppleObjCRuntimeV1::GetISAHashTablePointer() {
+  if (m_isa_hash_table_ptr == LLDB_INVALID_ADDRESS) {
+    ModuleSP objc_module_sp(GetObjCModule());
+
+    if (!objc_module_sp)
+      return LLDB_INVALID_ADDRESS;
+
+    static ConstString g_objc_debug_class_hash("_objc_debug_class_hash");
+
+    const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(
+        g_objc_debug_class_hash, lldb::eSymbolTypeData);
+    if (symbol && symbol->ValueIsAddress()) {
+      Process *process = GetProcess();
+      if (process) {
+
+        lldb::addr_t objc_debug_class_hash_addr =
+            symbol->GetAddressRef().GetLoadAddress(&process->GetTarget());
+
+        if (objc_debug_class_hash_addr != LLDB_INVALID_ADDRESS) {
+          Error error;
+          lldb::addr_t objc_debug_class_hash_ptr =
+              process->ReadPointerFromMemory(objc_debug_class_hash_addr, error);
+          if (objc_debug_class_hash_ptr != 0 &&
+              objc_debug_class_hash_ptr != LLDB_INVALID_ADDRESS) {
+            m_isa_hash_table_ptr = objc_debug_class_hash_ptr;
+          }
         }
+      }
     }
-    return m_isa_hash_table_ptr;
+  }
+  return m_isa_hash_table_ptr;
 }
 
-void
-AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded()
-{
-    // TODO: implement HashTableSignature...
-    Process *process = GetProcess();
-    
-    if (process)
-    {
-        // Update the process stop ID that indicates the last time we updated the
-        // map, whether it was successful or not.
-        m_isa_to_descriptor_stop_id = process->GetStopID();
-        
-        Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-        
-        ProcessSP process_sp = process->shared_from_this();
-        
-        ModuleSP objc_module_sp(GetObjCModule());
-        
-        if (!objc_module_sp)
-            return;
-        
-        uint32_t isa_count = 0;
-        
-        lldb::addr_t hash_table_ptr = GetISAHashTablePointer ();
-        if (hash_table_ptr != LLDB_INVALID_ADDRESS)
-        {
-            // Read the NXHashTable struct:
-            //
-            // typedef struct {
-            //     const NXHashTablePrototype *prototype;
-            //     unsigned   count;
-            //     unsigned   nbBuckets;
-            //     void       *buckets;
-            //     const void *info;
-            // } NXHashTable;
-
-            Error error;
-            DataBufferHeap buffer(1024, 0);
-            if (process->ReadMemory(hash_table_ptr, buffer.GetBytes(), 20, error) == 20)
-            {
-                const uint32_t addr_size = m_process->GetAddressByteSize();
-                const ByteOrder byte_order = m_process->GetByteOrder();
-                DataExtractor data (buffer.GetBytes(), buffer.GetByteSize(), byte_order, addr_size);
-                lldb::offset_t offset = addr_size; // Skip prototype
-                const uint32_t count = data.GetU32(&offset);
-                const uint32_t num_buckets = data.GetU32(&offset);
-                const addr_t buckets_ptr = data.GetPointer(&offset);
-                if (m_hash_signature.NeedsUpdate (count, num_buckets, buckets_ptr))
-                {
-                    m_hash_signature.UpdateSignature (count, num_buckets, buckets_ptr);
-
-                    const uint32_t data_size = num_buckets * 2 * sizeof(uint32_t);
-                    buffer.SetByteSize(data_size);
-                    
-                    if (process->ReadMemory(buckets_ptr, buffer.GetBytes(), data_size, error) == data_size)
-                    {
-                        data.SetData(buffer.GetBytes(), buffer.GetByteSize(), byte_order);
-                        offset = 0;
-                        for (uint32_t bucket_idx = 0; bucket_idx < num_buckets; ++bucket_idx)
-                        {
-                            const uint32_t bucket_isa_count = data.GetU32 (&offset);
-                            const lldb::addr_t bucket_data = data.GetU32 (&offset);
-                            
-
-                            if (bucket_isa_count == 0)
-                                continue;
-                            
-                            isa_count += bucket_isa_count;
-
-                            ObjCISA isa;
-                            if (bucket_isa_count == 1)
-                            {
-                                // When we only have one entry in the bucket, the bucket data is the "isa"
-                                isa = bucket_data;
-                                if (isa)
-                                {
-                                    if (!ISAIsCached(isa))
-                                    {
-                                        ClassDescriptorSP descriptor_sp (new ClassDescriptorV1(isa, process_sp));
-                                        
-                                        if (log && log->GetVerbose())
-                                            log->Printf("AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64 " from _objc_debug_class_hash to isa->descriptor cache", isa);
-                                        
-                                        AddClass (isa, descriptor_sp);
-                                    }
-                                }
-                            }
-                            else
-                            {
-                                // When we have more than one entry in the bucket, the bucket data is a pointer
-                                // to an array of "isa" values
-                                addr_t isa_addr = bucket_data;
-                                for (uint32_t isa_idx = 0; isa_idx < bucket_isa_count; ++isa_idx, isa_addr += addr_size)
-                                {
-                                    isa = m_process->ReadPointerFromMemory(isa_addr, error);
-
-                                    if (isa && isa != LLDB_INVALID_ADDRESS)
-                                    {
-                                        if (!ISAIsCached(isa))
-                                        {
-                                            ClassDescriptorSP descriptor_sp (new ClassDescriptorV1(isa, process_sp));
-                                            
-                                            if (log && log->GetVerbose())
-                                                log->Printf("AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64 " from _objc_debug_class_hash to isa->descriptor cache", isa);
-                                            
-                                            AddClass (isa, descriptor_sp);
-                                        }
-                                    }
-                                }
-                            }
-                        }
+void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
+  // TODO: implement HashTableSignature...
+  Process *process = GetProcess();
+
+  if (process) {
+    // Update the process stop ID that indicates the last time we updated the
+    // map, whether it was successful or not.
+    m_isa_to_descriptor_stop_id = process->GetStopID();
+
+    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+
+    ProcessSP process_sp = process->shared_from_this();
+
+    ModuleSP objc_module_sp(GetObjCModule());
+
+    if (!objc_module_sp)
+      return;
+
+    uint32_t isa_count = 0;
+
+    lldb::addr_t hash_table_ptr = GetISAHashTablePointer();
+    if (hash_table_ptr != LLDB_INVALID_ADDRESS) {
+      // Read the NXHashTable struct:
+      //
+      // typedef struct {
+      //     const NXHashTablePrototype *prototype;
+      //     unsigned   count;
+      //     unsigned   nbBuckets;
+      //     void       *buckets;
+      //     const void *info;
+      // } NXHashTable;
+
+      Error error;
+      DataBufferHeap buffer(1024, 0);
+      if (process->ReadMemory(hash_table_ptr, buffer.GetBytes(), 20, error) ==
+          20) {
+        const uint32_t addr_size = m_process->GetAddressByteSize();
+        const ByteOrder byte_order = m_process->GetByteOrder();
+        DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(), byte_order,
+                           addr_size);
+        lldb::offset_t offset = addr_size; // Skip prototype
+        const uint32_t count = data.GetU32(&offset);
+        const uint32_t num_buckets = data.GetU32(&offset);
+        const addr_t buckets_ptr = data.GetPointer(&offset);
+        if (m_hash_signature.NeedsUpdate(count, num_buckets, buckets_ptr)) {
+          m_hash_signature.UpdateSignature(count, num_buckets, buckets_ptr);
+
+          const uint32_t data_size = num_buckets * 2 * sizeof(uint32_t);
+          buffer.SetByteSize(data_size);
+
+          if (process->ReadMemory(buckets_ptr, buffer.GetBytes(), data_size,
+                                  error) == data_size) {
+            data.SetData(buffer.GetBytes(), buffer.GetByteSize(), byte_order);
+            offset = 0;
+            for (uint32_t bucket_idx = 0; bucket_idx < num_buckets;
+                 ++bucket_idx) {
+              const uint32_t bucket_isa_count = data.GetU32(&offset);
+              const lldb::addr_t bucket_data = data.GetU32(&offset);
+
+              if (bucket_isa_count == 0)
+                continue;
+
+              isa_count += bucket_isa_count;
+
+              ObjCISA isa;
+              if (bucket_isa_count == 1) {
+                // When we only have one entry in the bucket, the bucket data is
+                // the "isa"
+                isa = bucket_data;
+                if (isa) {
+                  if (!ISAIsCached(isa)) {
+                    ClassDescriptorSP descriptor_sp(
+                        new ClassDescriptorV1(isa, process_sp));
+
+                    if (log && log->GetVerbose())
+                      log->Printf("AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
+                                  " from _objc_debug_class_hash to "
+                                  "isa->descriptor cache",
+                                  isa);
+
+                    AddClass(isa, descriptor_sp);
+                  }
+                }
+              } else {
+                // When we have more than one entry in the bucket, the bucket
+                // data is a pointer
+                // to an array of "isa" values
+                addr_t isa_addr = bucket_data;
+                for (uint32_t isa_idx = 0; isa_idx < bucket_isa_count;
+                     ++isa_idx, isa_addr += addr_size) {
+                  isa = m_process->ReadPointerFromMemory(isa_addr, error);
+
+                  if (isa && isa != LLDB_INVALID_ADDRESS) {
+                    if (!ISAIsCached(isa)) {
+                      ClassDescriptorSP descriptor_sp(
+                          new ClassDescriptorV1(isa, process_sp));
+
+                      if (log && log->GetVerbose())
+                        log->Printf(
+                            "AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
+                            " from _objc_debug_class_hash to isa->descriptor "
+                            "cache",
+                            isa);
+
+                      AddClass(isa, descriptor_sp);
                     }
+                  }
                 }
+              }
             }
-        }        
-    }
-    else
-    {
-        m_isa_to_descriptor_stop_id = UINT32_MAX;
+          }
+        }
+      }
     }
+  } else {
+    m_isa_to_descriptor_stop_id = UINT32_MAX;
+  }
 }
 
-DeclVendor *
-AppleObjCRuntimeV1::GetDeclVendor()
-{
-    if (!m_decl_vendor_ap.get())
-        m_decl_vendor_ap.reset(new AppleObjCDeclVendor(*this));
-    
-    return m_decl_vendor_ap.get();
+DeclVendor *AppleObjCRuntimeV1::GetDeclVendor() {
+  if (!m_decl_vendor_ap.get())
+    m_decl_vendor_ap.reset(new AppleObjCDeclVendor(*this));
+
+  return m_decl_vendor_ap.get();
 }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h Tue Sep  6 15:57:50 2016
@@ -14,194 +14,148 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "AppleObjCRuntime.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_private {
-    
-class AppleObjCRuntimeV1 :
-        public AppleObjCRuntime
-{
+
+class AppleObjCRuntimeV1 : public AppleObjCRuntime {
 public:
-    ~AppleObjCRuntimeV1() override = default;
+  ~AppleObjCRuntimeV1() override = default;
 
-    //------------------------------------------------------------------
-    // Static Functions
-    //------------------------------------------------------------------
-    static void
-    Initialize();
-    
-    static void
-    Terminate();
-    
-    static lldb_private::LanguageRuntime *
-    CreateInstance(Process *process, lldb::LanguageType language);
-    
-    static lldb_private::ConstString
-    GetPluginNameStatic();
-
-    static bool classof(const ObjCLanguageRuntime* runtime)
-    {
-        switch (runtime->GetRuntimeVersion())
-        {
-            case ObjCRuntimeVersions::eAppleObjC_V1:
-                return true;
-            default:
-                return false;
-        }
+  //------------------------------------------------------------------
+  // Static Functions
+  //------------------------------------------------------------------
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb_private::LanguageRuntime *
+  CreateInstance(Process *process, lldb::LanguageType language);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  static bool classof(const ObjCLanguageRuntime *runtime) {
+    switch (runtime->GetRuntimeVersion()) {
+    case ObjCRuntimeVersions::eAppleObjC_V1:
+      return true;
+    default:
+      return false;
     }
-    
-    class ClassDescriptorV1 : public ObjCLanguageRuntime::ClassDescriptor
-    {
-    public:
-        ClassDescriptorV1 (ValueObject &isa_pointer);
-        ClassDescriptorV1 (ObjCISA isa, lldb::ProcessSP process_sp);
-        
-        ~ClassDescriptorV1() override = default;
-
-        ConstString
-        GetClassName() override
-        {
-            return m_name;
-        }
-        
-        ClassDescriptorSP
-        GetSuperclass() override;
-        
-        ClassDescriptorSP
-        GetMetaclass() const override;
-        
-        bool
-        IsValid() override
-        {
-            return m_valid;
-        }
-        
-        // v1 does not support tagged pointers
-        bool
-        GetTaggedPointerInfo(uint64_t* info_bits = nullptr,
-                             uint64_t* value_bits = nullptr,
-                             uint64_t* payload = nullptr) override
-        {
-            return false;
-        }
-        
-        uint64_t
-        GetInstanceSize() override
-        {
-            return m_instance_size;
-        }
-        
-        ObjCISA
-        GetISA() override
-        {
-            return m_isa;
-        }
-        
-        bool
-        Describe(std::function <void (ObjCLanguageRuntime::ObjCISA)> const &superclass_func,
-                 std::function <bool (const char *, const char *)> const &instance_method_func,
-                 std::function <bool (const char *, const char *)> const &class_method_func,
-                 std::function <bool (const char *, const char *,
-                 lldb::addr_t, uint64_t)> const &ivar_func) const override;
-
-    protected:
-        void
-        Initialize (ObjCISA isa, lldb::ProcessSP process_sp);
-        
-    private:
-        ConstString m_name;
-        ObjCISA m_isa;
-        ObjCISA m_parent_isa;
-        bool m_valid;
-        lldb::ProcessWP m_process_wp;
-        uint64_t m_instance_size;
-    };
+  }
 
-    // These are generic runtime functions:
-    bool
-    GetDynamicTypeAndAddress(ValueObject &in_value, 
-                             lldb::DynamicValueType use_dynamic, 
-                             TypeAndOrName &class_type_or_name, 
-                             Address &address,
-                             Value::ValueType &value_type) override;
-
-    UtilityFunction *
-    CreateObjectChecker(const char *) override;
-
-    //------------------------------------------------------------------
-    // PluginInterface protocol
-    //------------------------------------------------------------------
-    ConstString
-    GetPluginName() override;
-    
-    uint32_t
-    GetPluginVersion() override;
-    
-    ObjCRuntimeVersions
-    GetRuntimeVersion() const override
-    {
-        return ObjCRuntimeVersions::eAppleObjC_V1;
+  class ClassDescriptorV1 : public ObjCLanguageRuntime::ClassDescriptor {
+  public:
+    ClassDescriptorV1(ValueObject &isa_pointer);
+    ClassDescriptorV1(ObjCISA isa, lldb::ProcessSP process_sp);
+
+    ~ClassDescriptorV1() override = default;
+
+    ConstString GetClassName() override { return m_name; }
+
+    ClassDescriptorSP GetSuperclass() override;
+
+    ClassDescriptorSP GetMetaclass() const override;
+
+    bool IsValid() override { return m_valid; }
+
+    // v1 does not support tagged pointers
+    bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
+                              uint64_t *value_bits = nullptr,
+                              uint64_t *payload = nullptr) override {
+      return false;
     }
-    
-    void
-    UpdateISAToDescriptorMapIfNeeded() override;
-    
-    DeclVendor *
-    GetDeclVendor() override;
+
+    uint64_t GetInstanceSize() override { return m_instance_size; }
+
+    ObjCISA GetISA() override { return m_isa; }
+
+    bool
+    Describe(std::function<void(ObjCLanguageRuntime::ObjCISA)> const
+                 &superclass_func,
+             std::function<bool(const char *, const char *)> const
+                 &instance_method_func,
+             std::function<bool(const char *, const char *)> const
+                 &class_method_func,
+             std::function<bool(const char *, const char *, lldb::addr_t,
+                                uint64_t)> const &ivar_func) const override;
+
+  protected:
+    void Initialize(ObjCISA isa, lldb::ProcessSP process_sp);
+
+  private:
+    ConstString m_name;
+    ObjCISA m_isa;
+    ObjCISA m_parent_isa;
+    bool m_valid;
+    lldb::ProcessWP m_process_wp;
+    uint64_t m_instance_size;
+  };
+
+  // These are generic runtime functions:
+  bool GetDynamicTypeAndAddress(ValueObject &in_value,
+                                lldb::DynamicValueType use_dynamic,
+                                TypeAndOrName &class_type_or_name,
+                                Address &address,
+                                Value::ValueType &value_type) override;
+
+  UtilityFunction *CreateObjectChecker(const char *) override;
+
+  //------------------------------------------------------------------
+  // PluginInterface protocol
+  //------------------------------------------------------------------
+  ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+
+  ObjCRuntimeVersions GetRuntimeVersion() const override {
+    return ObjCRuntimeVersions::eAppleObjC_V1;
+  }
+
+  void UpdateISAToDescriptorMapIfNeeded() override;
+
+  DeclVendor *GetDeclVendor() override;
 
 protected:
-    lldb::BreakpointResolverSP
-    CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override;
-    
-    class HashTableSignature
-    {
-    public:
-        HashTableSignature () :
-            m_count (0),
-            m_num_buckets (0),
-            m_buckets_ptr (LLDB_INVALID_ADDRESS)
-        {
-        }
-        
-        bool
-        NeedsUpdate (uint32_t count,
-                     uint32_t num_buckets,
-                     lldb::addr_t buckets_ptr)
-        {
-            return m_count       != count       ||
-                   m_num_buckets != num_buckets ||
-                   m_buckets_ptr != buckets_ptr ;
-        }
-        
-        void
-        UpdateSignature (uint32_t count,
-                         uint32_t num_buckets,
-                         lldb::addr_t buckets_ptr)
-        {
-            m_count = count;
-            m_num_buckets = num_buckets;
-            m_buckets_ptr = buckets_ptr;
-        }
-
-    protected:
-        uint32_t m_count;
-        uint32_t m_num_buckets;
-        lldb::addr_t m_buckets_ptr;
-    };
-    
-    lldb::addr_t
-    GetISAHashTablePointer ();
-    
-    HashTableSignature m_hash_signature;
-    lldb::addr_t m_isa_hash_table_ptr;
-    std::unique_ptr<DeclVendor> m_decl_vendor_ap;
+  lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
+                                                     bool catch_bp,
+                                                     bool throw_bp) override;
+
+  class HashTableSignature {
+  public:
+    HashTableSignature()
+        : m_count(0), m_num_buckets(0), m_buckets_ptr(LLDB_INVALID_ADDRESS) {}
+
+    bool NeedsUpdate(uint32_t count, uint32_t num_buckets,
+                     lldb::addr_t buckets_ptr) {
+      return m_count != count || m_num_buckets != num_buckets ||
+             m_buckets_ptr != buckets_ptr;
+    }
+
+    void UpdateSignature(uint32_t count, uint32_t num_buckets,
+                         lldb::addr_t buckets_ptr) {
+      m_count = count;
+      m_num_buckets = num_buckets;
+      m_buckets_ptr = buckets_ptr;
+    }
+
+  protected:
+    uint32_t m_count;
+    uint32_t m_num_buckets;
+    lldb::addr_t m_buckets_ptr;
+  };
+
+  lldb::addr_t GetISAHashTablePointer();
+
+  HashTableSignature m_hash_signature;
+  lldb::addr_t m_isa_hash_table_ptr;
+  std::unique_ptr<DeclVendor> m_decl_vendor_ap;
 
 private:
-    AppleObjCRuntimeV1(Process *process);
+  AppleObjCRuntimeV1(Process *process);
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_AppleObjCRuntimeV1_h_

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp Tue Sep  6 15:57:50 2016
@@ -19,9 +19,9 @@
 #include "clang/AST/DeclObjC.h"
 
 // Project includes
-#include "lldb/lldb-enumerations.h"
 #include "lldb/Core/ClangForward.h"
 #include "lldb/Symbol/CompilerType.h"
+#include "lldb/lldb-enumerations.h"
 
 #include "lldb/Core/ClangForward.h"
 #include "lldb/Core/ConstString.h"
@@ -56,21 +56,22 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
-#include "AppleObjCRuntimeV2.h"
 #include "AppleObjCClassDescriptorV2.h"
-#include "AppleObjCTypeEncodingParser.h"
 #include "AppleObjCDeclVendor.h"
+#include "AppleObjCRuntimeV2.h"
 #include "AppleObjCTrampolineHandler.h"
-
+#include "AppleObjCTypeEncodingParser.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
 // 2 second timeout when running utility functions
-#define UTILITY_FUNCTION_TIMEOUT_USEC 2*1000*1000
+#define UTILITY_FUNCTION_TIMEOUT_USEC 2 * 1000 * 1000
 
-static const char *g_get_dynamic_class_info_name = "__lldb_apple_objc_v2_get_dynamic_class_info";
-// Testing using the new C++11 raw string literals. If this breaks GCC then we will
+static const char *g_get_dynamic_class_info_name =
+    "__lldb_apple_objc_v2_get_dynamic_class_info";
+// Testing using the new C++11 raw string literals. If this breaks GCC then we
+// will
 // need to revert to the code above...
 static const char *g_get_dynamic_class_info_body = R"(
 
@@ -152,8 +153,10 @@ __lldb_apple_objc_v2_get_dynamic_class_i
 
 )";
 
-static const char *g_get_shared_cache_class_info_name = "__lldb_apple_objc_v2_get_shared_cache_class_info";
-// Testing using the new C++11 raw string literals. If this breaks GCC then we will
+static const char *g_get_shared_cache_class_info_name =
+    "__lldb_apple_objc_v2_get_shared_cache_class_info";
+// Testing using the new C++11 raw string literals. If this breaks GCC then we
+// will
 // need to revert to the code above...
 static const char *g_get_shared_cache_class_info_body = R"(
 
@@ -334,2287 +337,2110 @@ __lldb_apple_objc_v2_get_shared_cache_cl
 )";
 
 static uint64_t
-ExtractRuntimeGlobalSymbol (Process* process,
-                            ConstString name,
-                            const ModuleSP &module_sp,
-                            Error& error,
-                            bool read_value = true,
-                            uint8_t byte_size = 0,
-                            uint64_t default_value = LLDB_INVALID_ADDRESS,
-                            SymbolType sym_type = lldb::eSymbolTypeData)
-{
-    if (!process)
-    {
-        error.SetErrorString("no process");
-        return default_value;
-    }
-    if (!module_sp)
-    {
-        error.SetErrorString("no module");
-        return default_value;
-    }
-    if (!byte_size)
-        byte_size = process->GetAddressByteSize();
-    const Symbol *symbol = module_sp->FindFirstSymbolWithNameAndType(name, lldb::eSymbolTypeData);
-    if (symbol && symbol->ValueIsAddress())
-    {
-        lldb::addr_t symbol_load_addr = symbol->GetAddressRef().GetLoadAddress(&process->GetTarget());
-        if (symbol_load_addr != LLDB_INVALID_ADDRESS)
-        {
-            if (read_value)
-                return process->ReadUnsignedIntegerFromMemory(symbol_load_addr, byte_size, default_value, error);
-            else
-                return symbol_load_addr;
-        }
-        else
-        {
-            error.SetErrorString("symbol address invalid");
-            return default_value;
-        }
-    }
-    else
-    {
-        error.SetErrorString("no symbol");
-        return default_value;
-    }
-}
-
-AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process, const ModuleSP &objc_module_sp)
-    : AppleObjCRuntime(process),
-      m_get_class_info_code(),
+ExtractRuntimeGlobalSymbol(Process *process, ConstString name,
+                           const ModuleSP &module_sp, Error &error,
+                           bool read_value = true, uint8_t byte_size = 0,
+                           uint64_t default_value = LLDB_INVALID_ADDRESS,
+                           SymbolType sym_type = lldb::eSymbolTypeData) {
+  if (!process) {
+    error.SetErrorString("no process");
+    return default_value;
+  }
+  if (!module_sp) {
+    error.SetErrorString("no module");
+    return default_value;
+  }
+  if (!byte_size)
+    byte_size = process->GetAddressByteSize();
+  const Symbol *symbol =
+      module_sp->FindFirstSymbolWithNameAndType(name, lldb::eSymbolTypeData);
+  if (symbol && symbol->ValueIsAddress()) {
+    lldb::addr_t symbol_load_addr =
+        symbol->GetAddressRef().GetLoadAddress(&process->GetTarget());
+    if (symbol_load_addr != LLDB_INVALID_ADDRESS) {
+      if (read_value)
+        return process->ReadUnsignedIntegerFromMemory(
+            symbol_load_addr, byte_size, default_value, error);
+      else
+        return symbol_load_addr;
+    } else {
+      error.SetErrorString("symbol address invalid");
+      return default_value;
+    }
+  } else {
+    error.SetErrorString("no symbol");
+    return default_value;
+  }
+}
+
+AppleObjCRuntimeV2::AppleObjCRuntimeV2(Process *process,
+                                       const ModuleSP &objc_module_sp)
+    : AppleObjCRuntime(process), 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_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_ap(),
-      m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS),
-      m_hash_signature(),
-      m_has_object_getClass(false),
-      m_loaded_objc_opt(false),
-      m_non_pointer_isa_cache_ap(NonPointerISACache::CreateInstance(*this, objc_module_sp)),
-      m_tagged_pointer_vendor_ap(TaggedPointerVendorV2::CreateInstance(*this, objc_module_sp)),
-      m_encoding_to_type_sp(),
-      m_noclasses_warning_emitted(false),
-      m_CFBoolean_values()
-{
-    static const ConstString g_gdb_object_getClass("gdb_object_getClass");
-    m_has_object_getClass =
-        (objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_object_getClass, eSymbolTypeCode) != NULL);
-}
-
-bool
-AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value,
-                                              DynamicValueType use_dynamic, 
-                                              TypeAndOrName &class_type_or_name, 
-                                              Address &address,
-                                              Value::ValueType &value_type)
-{
-    // We should never get here with a null process...
-    assert (m_process != NULL);
-
-    // The Runtime is attached to a particular process, you shouldn't pass in a value from another process.
-    // Note, however, the process might be NULL (e.g. if the value was made with SBTarget::EvaluateExpression...)
-    // in which case it is sufficient if the target's match:
-    
-    Process *process = in_value.GetProcessSP().get();
-    if (process)
-        assert (process == m_process);
-    else
-        assert (in_value.GetTargetSP().get() == m_process->CalculateTarget().get());
-    
-    class_type_or_name.Clear();
-    value_type = Value::ValueType::eValueTypeScalar;
-
-    // Make sure we can have a dynamic value before starting...
-    if (CouldHaveDynamicValue (in_value))
-    {
-        // First job, pull out the address at 0 offset from the object  That will be the ISA pointer.
-        ClassDescriptorSP objc_class_sp (GetNonKVOClassDescriptor (in_value));
-        if (objc_class_sp)
-        {
-            const addr_t object_ptr = in_value.GetPointerValue();
-            address.SetRawAddress(object_ptr);
-
-            ConstString class_name (objc_class_sp->GetClassName());
-            class_type_or_name.SetName(class_name);
-            TypeSP type_sp (objc_class_sp->GetType());
-            if (type_sp)
-                class_type_or_name.SetTypeSP (type_sp);
-            else
-            {
-                type_sp = LookupInCompleteClassCache (class_name);
-                if (type_sp)
-                {
-                    objc_class_sp->SetType (type_sp);
-                    class_type_or_name.SetTypeSP (type_sp);
-                }
-                else
-                {
-                    // try to go for a CompilerType at least
-                    DeclVendor* vendor = GetDeclVendor();
-                    if (vendor)
-                    {
-                        std::vector<clang::NamedDecl*> decls;
-                        if (vendor->FindDecls(class_name, false, 1, decls) && decls.size())
-                            class_type_or_name.SetCompilerType(ClangASTContext::GetTypeForDecl(decls[0]));
-                    }
-                }
-            }
+      m_get_shared_cache_class_info_args_mutex(), m_decl_vendor_ap(),
+      m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS), m_hash_signature(),
+      m_has_object_getClass(false), m_loaded_objc_opt(false),
+      m_non_pointer_isa_cache_ap(
+          NonPointerISACache::CreateInstance(*this, objc_module_sp)),
+      m_tagged_pointer_vendor_ap(
+          TaggedPointerVendorV2::CreateInstance(*this, objc_module_sp)),
+      m_encoding_to_type_sp(), m_noclasses_warning_emitted(false),
+      m_CFBoolean_values() {
+  static const ConstString g_gdb_object_getClass("gdb_object_getClass");
+  m_has_object_getClass = (objc_module_sp->FindFirstSymbolWithNameAndType(
+                               g_gdb_object_getClass, eSymbolTypeCode) != NULL);
+}
+
+bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress(
+    ValueObject &in_value, DynamicValueType use_dynamic,
+    TypeAndOrName &class_type_or_name, Address &address,
+    Value::ValueType &value_type) {
+  // We should never get here with a null process...
+  assert(m_process != NULL);
+
+  // The Runtime is attached to a particular process, you shouldn't pass in a
+  // value from another process.
+  // Note, however, the process might be NULL (e.g. if the value was made with
+  // SBTarget::EvaluateExpression...)
+  // in which case it is sufficient if the target's match:
+
+  Process *process = in_value.GetProcessSP().get();
+  if (process)
+    assert(process == m_process);
+  else
+    assert(in_value.GetTargetSP().get() == m_process->CalculateTarget().get());
+
+  class_type_or_name.Clear();
+  value_type = Value::ValueType::eValueTypeScalar;
+
+  // Make sure we can have a dynamic value before starting...
+  if (CouldHaveDynamicValue(in_value)) {
+    // First job, pull out the address at 0 offset from the object  That will be
+    // the ISA pointer.
+    ClassDescriptorSP objc_class_sp(GetNonKVOClassDescriptor(in_value));
+    if (objc_class_sp) {
+      const addr_t object_ptr = in_value.GetPointerValue();
+      address.SetRawAddress(object_ptr);
+
+      ConstString class_name(objc_class_sp->GetClassName());
+      class_type_or_name.SetName(class_name);
+      TypeSP type_sp(objc_class_sp->GetType());
+      if (type_sp)
+        class_type_or_name.SetTypeSP(type_sp);
+      else {
+        type_sp = LookupInCompleteClassCache(class_name);
+        if (type_sp) {
+          objc_class_sp->SetType(type_sp);
+          class_type_or_name.SetTypeSP(type_sp);
+        } else {
+          // try to go for a CompilerType at least
+          DeclVendor *vendor = GetDeclVendor();
+          if (vendor) {
+            std::vector<clang::NamedDecl *> decls;
+            if (vendor->FindDecls(class_name, false, 1, decls) && decls.size())
+              class_type_or_name.SetCompilerType(
+                  ClangASTContext::GetTypeForDecl(decls[0]));
+          }
         }
-    }    
-    return class_type_or_name.IsEmpty() == false;
+      }
+    }
+  }
+  return class_type_or_name.IsEmpty() == false;
 }
 
 //------------------------------------------------------------------
 // Static Functions
 //------------------------------------------------------------------
-LanguageRuntime *
-AppleObjCRuntimeV2::CreateInstance (Process *process, LanguageType language)
-{
-    // FIXME: This should be a MacOS or iOS process, and we need to look for the OBJC section to make
-    // sure we aren't using the V1 runtime.
-    if (language == eLanguageTypeObjC)
-    {
-        ModuleSP objc_module_sp;
-        
-        if (AppleObjCRuntime::GetObjCVersion (process, objc_module_sp) == ObjCRuntimeVersions::eAppleObjC_V2)
-            return new AppleObjCRuntimeV2 (process, objc_module_sp);
-        else
-            return NULL;
-    }
+LanguageRuntime *AppleObjCRuntimeV2::CreateInstance(Process *process,
+                                                    LanguageType language) {
+  // FIXME: This should be a MacOS or iOS process, and we need to look for the
+  // OBJC section to make
+  // sure we aren't using the V1 runtime.
+  if (language == eLanguageTypeObjC) {
+    ModuleSP objc_module_sp;
+
+    if (AppleObjCRuntime::GetObjCVersion(process, objc_module_sp) ==
+        ObjCRuntimeVersions::eAppleObjC_V2)
+      return new AppleObjCRuntimeV2(process, objc_module_sp);
     else
-        return NULL;
+      return NULL;
+  } else
+    return NULL;
 }
 
-class CommandObjectObjC_ClassTable_Dump : public CommandObjectParsed
-{
+class CommandObjectObjC_ClassTable_Dump : public CommandObjectParsed {
 public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-        Options(),
-        m_verbose(false,false)
-        {}
-        
-        ~CommandOptions() override = default;
-
-        Error
-        SetOptionValue(uint32_t option_idx, const char *option_arg,
-                       ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-            switch (short_option)
-            {
-                case 'v':
-                    m_verbose.SetCurrentValue(true);
-                    m_verbose.SetOptionWasSet();
-                    break;
-                    
-                default:
-                    error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_verbose.Clear();
-        }
-        
-        const OptionDefinition*
-        GetDefinitions() override
-        {
-            return g_option_table;
-        }
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options(), m_verbose(false, false) {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+      switch (short_option) {
+      case 'v':
+        m_verbose.SetCurrentValue(true);
+        m_verbose.SetOptionWasSet();
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_verbose.Clear();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    OptionValueBoolean m_verbose;
+    static OptionDefinition g_option_table[];
+  };
+
+  CommandObjectObjC_ClassTable_Dump(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "dump", "Dump information on Objective-C classes "
+                                 "known to the current process.",
+            "language objc class-table dump",
+            eCommandRequiresProcess | eCommandProcessMustBeLaunched |
+                eCommandProcessMustBePaused),
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData index_arg;
+
+    // Define the first (and only) variant of this arg.
+    index_arg.arg_type = eArgTypeRegularExpression;
+    index_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(index_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-        OptionValueBoolean m_verbose;
-        static OptionDefinition g_option_table[];
-    };
-
-    CommandObjectObjC_ClassTable_Dump (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "dump",
-                         "Dump information on Objective-C classes known to the current process.",
-                         "language objc class-table dump",
-                         eCommandRequiresProcess       |
-                         eCommandProcessMustBeLaunched |
-                         eCommandProcessMustBePaused   ),
-    m_options()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData index_arg;
-        
-        // Define the first (and only) variant of this arg.
-        index_arg.arg_type = eArgTypeRegularExpression;
-        index_arg.arg_repetition = eArgRepeatOptional;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (index_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
+  ~CommandObjectObjC_ClassTable_Dump() override = default;
 
-    ~CommandObjectObjC_ClassTable_Dump() override = default;
+  Options *GetOptions() override { return &m_options; }
 
-    Options *
-    GetOptions() override
-    {
-        return &m_options;
-    }
-    
 protected:
-    bool
-    DoExecute(Args& command, CommandReturnObject &result) override
-    {
-        std::unique_ptr<RegularExpression> regex_up;
-        switch(command.GetArgumentCount())
-        {
-            case 0:
-                break;
-            case 1:
-            {
-                regex_up.reset(new RegularExpression());
-                if (!regex_up->Compile(command.GetArgumentAtIndex(0)))
-                {
-                    result.AppendError("invalid argument - please provide a valid regular expression");
-                    result.SetStatus(lldb::eReturnStatusFailed);
-                    return false;
-                }
-                break;
-            }
-            default:
-            {
-                result.AppendError("please provide 0 or 1 arguments");
-                result.SetStatus(lldb::eReturnStatusFailed);
-                return false;
-            }
-        }
-        
-        Process *process = m_exe_ctx.GetProcessPtr();
-        ObjCLanguageRuntime *objc_runtime = process->GetObjCLanguageRuntime();
-        if (objc_runtime)
-        {
-            auto iterators_pair = objc_runtime->GetDescriptorIteratorPair();
-            auto iterator = iterators_pair.first;
-            auto &std_out = result.GetOutputStream();
-            for(; iterator != iterators_pair.second; iterator++)
-            {
-                if (iterator->second)
-                {
-                    const char* class_name = iterator->second->GetClassName().AsCString("<unknown>");
-                    if (regex_up && class_name && !regex_up->Execute(class_name))
-                        continue;
-                    std_out.Printf("isa = 0x%" PRIx64, iterator->first);
-                    std_out.Printf(" name = %s", class_name);
-                    std_out.Printf(" instance size = %" PRIu64, iterator->second->GetInstanceSize());
-                    std_out.Printf(" num ivars = %" PRIuPTR, (uintptr_t)iterator->second->GetNumIVars());
-                    if (auto superclass = iterator->second->GetSuperclass())
-                    {
-                        std_out.Printf(" superclass = %s", superclass->GetClassName().AsCString("<unknown>"));
-                    }
-                    std_out.Printf("\n");
-                    if (m_options.m_verbose)
-                    {
-                        for(size_t i = 0;
-                            i < iterator->second->GetNumIVars();
-                            i++)
-                        {
-                            auto ivar = iterator->second->GetIVarAtIndex(i);
-                            std_out.Printf("  ivar name = %s type = %s size = %" PRIu64 " offset = %" PRId32 "\n",
-                                                            ivar.m_name.AsCString("<unknown>"),
-                                                            ivar.m_type.GetDisplayTypeName().AsCString("<unknown>"),
-                                                            ivar.m_size,
-                                                            ivar.m_offset);
-                        }
-                        iterator->second->Describe(nullptr,
-                                                   [objc_runtime, &std_out] (const char* name, const char* type) -> bool {
-                                                       std_out.Printf("  instance method name = %s type = %s\n",
-                                                                      name,
-                                                                      type);
-                                                       return false;
-                                                   },
-                                                   [objc_runtime, &std_out] (const char* name, const char* type) -> bool {
-                                                       std_out.Printf("  class method name = %s type = %s\n",
-                                                                      name,
-                                                                      type);
-                                                       return false;
-                                                   },
-                                                   nullptr);
-                    }
-                }
-                else
-                {
-                    if (regex_up && !regex_up->Execute(""))
-                        continue;
-                    std_out.Printf("isa = 0x%" PRIx64 " has no associated class.\n", iterator->first);
-                }
-            }
-            result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
-            return true;
-        }
-        else
-        {
-            result.AppendError("current process has no Objective-C runtime loaded");
-            result.SetStatus(lldb::eReturnStatusFailed);
-            return false;
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    std::unique_ptr<RegularExpression> regex_up;
+    switch (command.GetArgumentCount()) {
+    case 0:
+      break;
+    case 1: {
+      regex_up.reset(new RegularExpression());
+      if (!regex_up->Compile(command.GetArgumentAtIndex(0))) {
+        result.AppendError(
+            "invalid argument - please provide a valid regular expression");
+        result.SetStatus(lldb::eReturnStatusFailed);
+        return false;
+      }
+      break;
+    }
+    default: {
+      result.AppendError("please provide 0 or 1 arguments");
+      result.SetStatus(lldb::eReturnStatusFailed);
+      return false;
+    }
+    }
+
+    Process *process = m_exe_ctx.GetProcessPtr();
+    ObjCLanguageRuntime *objc_runtime = process->GetObjCLanguageRuntime();
+    if (objc_runtime) {
+      auto iterators_pair = objc_runtime->GetDescriptorIteratorPair();
+      auto iterator = iterators_pair.first;
+      auto &std_out = result.GetOutputStream();
+      for (; iterator != iterators_pair.second; iterator++) {
+        if (iterator->second) {
+          const char *class_name =
+              iterator->second->GetClassName().AsCString("<unknown>");
+          if (regex_up && class_name && !regex_up->Execute(class_name))
+            continue;
+          std_out.Printf("isa = 0x%" PRIx64, iterator->first);
+          std_out.Printf(" name = %s", class_name);
+          std_out.Printf(" instance size = %" PRIu64,
+                         iterator->second->GetInstanceSize());
+          std_out.Printf(" num ivars = %" PRIuPTR,
+                         (uintptr_t)iterator->second->GetNumIVars());
+          if (auto superclass = iterator->second->GetSuperclass()) {
+            std_out.Printf(" superclass = %s",
+                           superclass->GetClassName().AsCString("<unknown>"));
+          }
+          std_out.Printf("\n");
+          if (m_options.m_verbose) {
+            for (size_t i = 0; i < iterator->second->GetNumIVars(); i++) {
+              auto ivar = iterator->second->GetIVarAtIndex(i);
+              std_out.Printf(
+                  "  ivar name = %s type = %s size = %" PRIu64
+                  " offset = %" PRId32 "\n",
+                  ivar.m_name.AsCString("<unknown>"),
+                  ivar.m_type.GetDisplayTypeName().AsCString("<unknown>"),
+                  ivar.m_size, ivar.m_offset);
+            }
+            iterator->second->Describe(
+                nullptr,
+                [objc_runtime, &std_out](const char *name,
+                                         const char *type) -> bool {
+                  std_out.Printf("  instance method name = %s type = %s\n",
+                                 name, type);
+                  return false;
+                },
+                [objc_runtime, &std_out](const char *name,
+                                         const char *type) -> bool {
+                  std_out.Printf("  class method name = %s type = %s\n", name,
+                                 type);
+                  return false;
+                },
+                nullptr);
+          }
+        } else {
+          if (regex_up && !regex_up->Execute(""))
+            continue;
+          std_out.Printf("isa = 0x%" PRIx64 " has no associated class.\n",
+                         iterator->first);
         }
+      }
+      result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
+      return true;
+    } else {
+      result.AppendError("current process has no Objective-C runtime loaded");
+      result.SetStatus(lldb::eReturnStatusFailed);
+      return false;
     }
-    
-    CommandOptions m_options;
+  }
+
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectObjC_ClassTable_Dump::CommandOptions::g_option_table[] =
-{
-    { LLDB_OPT_SET_ALL, false, "verbose"        , 'v', OptionParser::eNoArgument        , nullptr, nullptr, 0, eArgTypeNone,        "Print ivar and method information in detail"},
-    { 0               , false, nullptr           ,   0, 0                  , nullptr, nullptr, 0, eArgTypeNone,        nullptr }
-};
+    CommandObjectObjC_ClassTable_Dump::CommandOptions::g_option_table[] = {
+        {LLDB_OPT_SET_ALL, false, "verbose", 'v', OptionParser::eNoArgument,
+         nullptr, nullptr, 0, eArgTypeNone,
+         "Print ivar and method information in detail"},
+        {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}};
 
-class CommandObjectMultiwordObjC_TaggedPointer_Info : public CommandObjectParsed
-{
+class CommandObjectMultiwordObjC_TaggedPointer_Info
+    : public CommandObjectParsed {
 public:
-    CommandObjectMultiwordObjC_TaggedPointer_Info (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "info",
-                         "Dump information on a tagged pointer.",
-                         "language objc tagged-pointer info",
-                         eCommandRequiresProcess       |
-                         eCommandProcessMustBeLaunched |
-                         eCommandProcessMustBePaused   )
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData index_arg;
-        
-        // Define the first (and only) variant of this arg.
-        index_arg.arg_type = eArgTypeAddress;
-        index_arg.arg_repetition = eArgRepeatPlus;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (index_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
+  CommandObjectMultiwordObjC_TaggedPointer_Info(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "info", "Dump information on a tagged pointer.",
+            "language objc tagged-pointer info",
+            eCommandRequiresProcess | eCommandProcessMustBeLaunched |
+                eCommandProcessMustBePaused) {
+    CommandArgumentEntry arg;
+    CommandArgumentData index_arg;
+
+    // Define the first (and only) variant of this arg.
+    index_arg.arg_type = eArgTypeAddress;
+    index_arg.arg_repetition = eArgRepeatPlus;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(index_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    ~CommandObjectMultiwordObjC_TaggedPointer_Info() override = default;
+  ~CommandObjectMultiwordObjC_TaggedPointer_Info() override = default;
 
 protected:
-    bool
-    DoExecute(Args& command, CommandReturnObject &result) override
-    {
-        if (command.GetArgumentCount() == 0)
-        {
-            result.AppendError("this command requires arguments");
-            result.SetStatus(lldb::eReturnStatusFailed);
-            return false;
-        }
-        
-        Process *process = m_exe_ctx.GetProcessPtr();
-        ExecutionContext exe_ctx(process);
-        ObjCLanguageRuntime *objc_runtime = process->GetObjCLanguageRuntime();
-        if (objc_runtime)
-        {
-            ObjCLanguageRuntime::TaggedPointerVendor *tagged_ptr_vendor = objc_runtime->GetTaggedPointerVendor();
-            if (tagged_ptr_vendor)
-            {
-                for (size_t i = 0;
-                     i < command.GetArgumentCount();
-                     i++)
-                {
-                    const char *arg_str = command.GetArgumentAtIndex(i);
-                    if (!arg_str)
-                        continue;
-                    Error error;
-                    lldb::addr_t arg_addr = Args::StringToAddress(&exe_ctx, arg_str, LLDB_INVALID_ADDRESS, &error);
-                    if (arg_addr == 0 || arg_addr == LLDB_INVALID_ADDRESS || error.Fail())
-                        continue;
-                    auto descriptor_sp = tagged_ptr_vendor->GetClassDescriptor(arg_addr);
-                    if (!descriptor_sp)
-                        continue;
-                    uint64_t info_bits = 0;
-                    uint64_t value_bits = 0;
-                    uint64_t payload = 0;
-                    if (descriptor_sp->GetTaggedPointerInfo(&info_bits, &value_bits, &payload))
-                    {
-                        result.GetOutputStream().Printf("0x%" PRIx64 " is tagged.\n\tpayload = 0x%" PRIx64 "\n\tvalue = 0x%" PRIx64 "\n\tinfo bits = 0x%" PRIx64 "\n\tclass = %s\n",
-                                                        (uint64_t)arg_addr,
-                                                        payload,
-                                                        value_bits,
-                                                        info_bits,
-                                                        descriptor_sp->GetClassName().AsCString("<unknown>"));
-                    }
-                    else
-                    {
-                        result.GetOutputStream().Printf("0x%" PRIx64 " is not tagged.\n", (uint64_t)arg_addr);
-                    }
-                }
-            }
-            else
-            {
-                result.AppendError("current process has no tagged pointer support");
-                result.SetStatus(lldb::eReturnStatusFailed);
-                return false;
-            }
-            result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
-            return true;
-        }
-        else
-        {
-            result.AppendError("current process has no Objective-C runtime loaded");
-            result.SetStatus(lldb::eReturnStatusFailed);
-            return false;
-        }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    if (command.GetArgumentCount() == 0) {
+      result.AppendError("this command requires arguments");
+      result.SetStatus(lldb::eReturnStatusFailed);
+      return false;
+    }
+
+    Process *process = m_exe_ctx.GetProcessPtr();
+    ExecutionContext exe_ctx(process);
+    ObjCLanguageRuntime *objc_runtime = process->GetObjCLanguageRuntime();
+    if (objc_runtime) {
+      ObjCLanguageRuntime::TaggedPointerVendor *tagged_ptr_vendor =
+          objc_runtime->GetTaggedPointerVendor();
+      if (tagged_ptr_vendor) {
+        for (size_t i = 0; i < command.GetArgumentCount(); i++) {
+          const char *arg_str = command.GetArgumentAtIndex(i);
+          if (!arg_str)
+            continue;
+          Error error;
+          lldb::addr_t arg_addr = Args::StringToAddress(
+              &exe_ctx, arg_str, LLDB_INVALID_ADDRESS, &error);
+          if (arg_addr == 0 || arg_addr == LLDB_INVALID_ADDRESS || error.Fail())
+            continue;
+          auto descriptor_sp = tagged_ptr_vendor->GetClassDescriptor(arg_addr);
+          if (!descriptor_sp)
+            continue;
+          uint64_t info_bits = 0;
+          uint64_t value_bits = 0;
+          uint64_t payload = 0;
+          if (descriptor_sp->GetTaggedPointerInfo(&info_bits, &value_bits,
+                                                  &payload)) {
+            result.GetOutputStream().Printf(
+                "0x%" PRIx64 " is tagged.\n\tpayload = 0x%" PRIx64
+                "\n\tvalue = 0x%" PRIx64 "\n\tinfo bits = 0x%" PRIx64
+                "\n\tclass = %s\n",
+                (uint64_t)arg_addr, payload, value_bits, info_bits,
+                descriptor_sp->GetClassName().AsCString("<unknown>"));
+          } else {
+            result.GetOutputStream().Printf("0x%" PRIx64 " is not tagged.\n",
+                                            (uint64_t)arg_addr);
+          }
+        }
+      } else {
+        result.AppendError("current process has no tagged pointer support");
+        result.SetStatus(lldb::eReturnStatusFailed);
+        return false;
+      }
+      result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
+      return true;
+    } else {
+      result.AppendError("current process has no Objective-C runtime loaded");
+      result.SetStatus(lldb::eReturnStatusFailed);
+      return false;
     }
+  }
 };
 
-class CommandObjectMultiwordObjC_ClassTable : public CommandObjectMultiword
-{
+class CommandObjectMultiwordObjC_ClassTable : public CommandObjectMultiword {
 public:
-    CommandObjectMultiwordObjC_ClassTable(CommandInterpreter &interpreter)
-        : CommandObjectMultiword(interpreter, "class-table", "Commands for operating on the Objective-C class table.",
-                                 "class-table <subcommand> [<subcommand-options>]")
-    {
-        LoadSubCommand ("dump",   CommandObjectSP (new CommandObjectObjC_ClassTable_Dump (interpreter)));
-    }
+  CommandObjectMultiwordObjC_ClassTable(CommandInterpreter &interpreter)
+      : CommandObjectMultiword(
+            interpreter, "class-table",
+            "Commands for operating on the Objective-C class table.",
+            "class-table <subcommand> [<subcommand-options>]") {
+    LoadSubCommand(
+        "dump",
+        CommandObjectSP(new CommandObjectObjC_ClassTable_Dump(interpreter)));
+  }
 
-    ~CommandObjectMultiwordObjC_ClassTable() override = default;
+  ~CommandObjectMultiwordObjC_ClassTable() override = default;
 };
 
-class CommandObjectMultiwordObjC_TaggedPointer : public CommandObjectMultiword
-{
+class CommandObjectMultiwordObjC_TaggedPointer : public CommandObjectMultiword {
 public:
-    CommandObjectMultiwordObjC_TaggedPointer(CommandInterpreter &interpreter)
-        : CommandObjectMultiword(interpreter, "tagged-pointer",
-                                 "Commands for operating on Objective-C tagged pointers.",
-                                 "class-table <subcommand> [<subcommand-options>]")
-    {
-        LoadSubCommand ("info",   CommandObjectSP (new CommandObjectMultiwordObjC_TaggedPointer_Info (interpreter)));
-    }
+  CommandObjectMultiwordObjC_TaggedPointer(CommandInterpreter &interpreter)
+      : CommandObjectMultiword(
+            interpreter, "tagged-pointer",
+            "Commands for operating on Objective-C tagged pointers.",
+            "class-table <subcommand> [<subcommand-options>]") {
+    LoadSubCommand(
+        "info",
+        CommandObjectSP(
+            new CommandObjectMultiwordObjC_TaggedPointer_Info(interpreter)));
+  }
 
-    ~CommandObjectMultiwordObjC_TaggedPointer() override = default;
+  ~CommandObjectMultiwordObjC_TaggedPointer() override = default;
 };
 
-class CommandObjectMultiwordObjC : public CommandObjectMultiword
-{
+class CommandObjectMultiwordObjC : public CommandObjectMultiword {
 public:
-    CommandObjectMultiwordObjC(CommandInterpreter &interpreter)
-        : CommandObjectMultiword(interpreter, "objc", "Commands for operating on the Objective-C language runtime.",
-                                 "objc <subcommand> [<subcommand-options>]")
-    {
-        LoadSubCommand ("class-table",   CommandObjectSP (new CommandObjectMultiwordObjC_ClassTable (interpreter)));
-        LoadSubCommand ("tagged-pointer",   CommandObjectSP (new CommandObjectMultiwordObjC_TaggedPointer (interpreter)));
-    }
+  CommandObjectMultiwordObjC(CommandInterpreter &interpreter)
+      : CommandObjectMultiword(
+            interpreter, "objc",
+            "Commands for operating on the Objective-C language runtime.",
+            "objc <subcommand> [<subcommand-options>]") {
+    LoadSubCommand("class-table",
+                   CommandObjectSP(
+                       new CommandObjectMultiwordObjC_ClassTable(interpreter)));
+    LoadSubCommand("tagged-pointer",
+                   CommandObjectSP(new CommandObjectMultiwordObjC_TaggedPointer(
+                       interpreter)));
+  }
 
-    ~CommandObjectMultiwordObjC() override = default;
+  ~CommandObjectMultiwordObjC() override = default;
 };
 
-void
-AppleObjCRuntimeV2::Initialize()
-{
-    PluginManager::RegisterPlugin (GetPluginNameStatic(),
-                                   "Apple Objective C Language Runtime - Version 2",
-                                   CreateInstance,
-                                   [] (CommandInterpreter& interpreter) -> lldb::CommandObjectSP {
-                                       return CommandObjectSP(new CommandObjectMultiwordObjC(interpreter));
-                                   });
-}
-
-void
-AppleObjCRuntimeV2::Terminate()
-{
-    PluginManager::UnregisterPlugin (CreateInstance);
-}
-
-lldb_private::ConstString
-AppleObjCRuntimeV2::GetPluginNameStatic()
-{
-    static ConstString g_name("apple-objc-v2");
-    return g_name;
+void AppleObjCRuntimeV2::Initialize() {
+  PluginManager::RegisterPlugin(
+      GetPluginNameStatic(), "Apple Objective C Language Runtime - Version 2",
+      CreateInstance,
+      [](CommandInterpreter &interpreter) -> lldb::CommandObjectSP {
+        return CommandObjectSP(new CommandObjectMultiwordObjC(interpreter));
+      });
+}
+
+void AppleObjCRuntimeV2::Terminate() {
+  PluginManager::UnregisterPlugin(CreateInstance);
+}
+
+lldb_private::ConstString AppleObjCRuntimeV2::GetPluginNameStatic() {
+  static ConstString g_name("apple-objc-v2");
+  return g_name;
 }
 
 //------------------------------------------------------------------
 // PluginInterface protocol
 //------------------------------------------------------------------
-lldb_private::ConstString
-AppleObjCRuntimeV2::GetPluginName()
-{
-    return GetPluginNameStatic();
+lldb_private::ConstString AppleObjCRuntimeV2::GetPluginName() {
+  return GetPluginNameStatic();
 }
 
-uint32_t
-AppleObjCRuntimeV2::GetPluginVersion()
-{
-    return 1;
-}
+uint32_t AppleObjCRuntimeV2::GetPluginVersion() { return 1; }
 
 BreakpointResolverSP
-AppleObjCRuntimeV2::CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp)
-{
-    BreakpointResolverSP resolver_sp;
-    
-    if (throw_bp)
-        resolver_sp.reset (new BreakpointResolverName (bkpt,
-                                                       "objc_exception_throw",
-                                                       eFunctionNameTypeBase,
-                                                       eLanguageTypeUnknown,
-                                                       Breakpoint::Exact,
-                                                       0,
-                                                       eLazyBoolNo));
-    // FIXME: We don't do catch breakpoints for ObjC yet.
-    // Should there be some way for the runtime to specify what it can do in this regard?
-    return resolver_sp;
-}
+AppleObjCRuntimeV2::CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp,
+                                            bool throw_bp) {
+  BreakpointResolverSP resolver_sp;
+
+  if (throw_bp)
+    resolver_sp.reset(new BreakpointResolverName(
+        bkpt, "objc_exception_throw", eFunctionNameTypeBase,
+        eLanguageTypeUnknown, Breakpoint::Exact, 0, eLazyBoolNo));
+  // FIXME: We don't do catch breakpoints for ObjC yet.
+  // Should there be some way for the runtime to specify what it can do in this
+  // regard?
+  return resolver_sp;
+}
+
+UtilityFunction *AppleObjCRuntimeV2::CreateObjectChecker(const char *name) {
+  char check_function_code[2048];
+
+  int len = 0;
+  if (m_has_object_getClass) {
+    len = ::snprintf(check_function_code, sizeof(check_function_code),
+                     "extern \"C\" void *gdb_object_getClass(void *);          "
+                     "                                \n"
+                     "extern \"C\"  int printf(const char *format, ...);       "
+                     "                                \n"
+                     "extern \"C\" void                                        "
+                     "                                \n"
+                     "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector)    "
+                     "                                \n"
+                     "{                                                        "
+                     "                                \n"
+                     "   if ($__lldb_arg_obj == (void *)0)                     "
+                     "                                \n"
+                     "       return; // nil is ok                              "
+                     "                                \n"
+                     "   if (!gdb_object_getClass($__lldb_arg_obj))            "
+                     "                                \n"
+                     "       *((volatile int *)0) = 'ocgc';                    "
+                     "                                \n"
+                     "   else if ($__lldb_arg_selector != (void *)0)           "
+                     "                                \n"
+                     "   {                                                     "
+                     "                                \n"
+                     "        signed char responds = (signed char) [(id) "
+                     "$__lldb_arg_obj                       \n"
+                     "                                                "
+                     "respondsToSelector:                      \n"
+                     "                                       (struct "
+                     "objc_selector *) $__lldb_arg_selector];   \n"
+                     "       if (responds == (signed char) 0)                  "
+                     "                                \n"
+                     "           *((volatile int *)0) = 'ocgc';                "
+                     "                                \n"
+                     "   }                                                     "
+                     "                                \n"
+                     "}                                                        "
+                     "                                \n",
+                     name);
+  } else {
+    len = ::snprintf(check_function_code, sizeof(check_function_code),
+                     "extern \"C\" void *gdb_class_getClass(void *);           "
+                     "                                \n"
+                     "extern \"C\"  int printf(const char *format, ...);       "
+                     "                                \n"
+                     "extern \"C\"  void                                       "
+                     "                                \n"
+                     "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector)    "
+                     "                                \n"
+                     "{                                                        "
+                     "                                \n"
+                     "   if ($__lldb_arg_obj == (void *)0)                     "
+                     "                                \n"
+                     "       return; // nil is ok                              "
+                     "                                \n"
+                     "    void **$isa_ptr = (void **)$__lldb_arg_obj;          "
+                     "                                \n"
+                     "    if (*$isa_ptr == (void *)0 || "
+                     "!gdb_class_getClass(*$isa_ptr))                        \n"
+                     "       *((volatile int *)0) = 'ocgc';                    "
+                     "                                \n"
+                     "   else if ($__lldb_arg_selector != (void *)0)           "
+                     "                                \n"
+                     "   {                                                     "
+                     "                                \n"
+                     "        signed char responds = (signed char) [(id) "
+                     "$__lldb_arg_obj                       \n"
+                     "                                                "
+                     "respondsToSelector:                      \n"
+                     "                                        (struct "
+                     "objc_selector *) $__lldb_arg_selector];  \n"
+                     "       if (responds == (signed char) 0)                  "
+                     "                                \n"
+                     "           *((volatile int *)0) = 'ocgc';                "
+                     "                                \n"
+                     "   }                                                     "
+                     "                                \n"
+                     "}                                                        "
+                     "                                \n",
+                     name);
+  }
+
+  assert(len < (int)sizeof(check_function_code));
+
+  Error error;
+  return GetTargetRef().GetUtilityFunctionForLanguage(
+      check_function_code, eLanguageTypeObjC, name, error);
+}
+
+size_t AppleObjCRuntimeV2::GetByteOffsetForIvar(CompilerType &parent_ast_type,
+                                                const char *ivar_name) {
+  uint32_t ivar_offset = LLDB_INVALID_IVAR_OFFSET;
+
+  const char *class_name = parent_ast_type.GetConstTypeName().AsCString();
+  if (class_name && class_name[0] && ivar_name && ivar_name[0]) {
+    //----------------------------------------------------------------------
+    // Make the objective C V2 mangled name for the ivar offset from the
+    // class name and ivar name
+    //----------------------------------------------------------------------
+    std::string buffer("OBJC_IVAR_$_");
+    buffer.append(class_name);
+    buffer.push_back('.');
+    buffer.append(ivar_name);
+    ConstString ivar_const_str(buffer.c_str());
+
+    //----------------------------------------------------------------------
+    // Try to get the ivar offset address from the symbol table first using
+    // the name we created above
+    //----------------------------------------------------------------------
+    SymbolContextList sc_list;
+    Target &target = m_process->GetTarget();
+    target.GetImages().FindSymbolsWithNameAndType(ivar_const_str,
+                                                  eSymbolTypeObjCIVar, sc_list);
 
-UtilityFunction *
-AppleObjCRuntimeV2::CreateObjectChecker(const char *name)
-{
-    char check_function_code[2048];
-    
-    int len = 0;
-    if (m_has_object_getClass)
-    {
-        len = ::snprintf (check_function_code, 
-                          sizeof(check_function_code),
-                          "extern \"C\" void *gdb_object_getClass(void *);                                          \n"
-                          "extern \"C\"  int printf(const char *format, ...);                                       \n"
-                          "extern \"C\" void                                                                        \n"
-                          "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector)                                    \n"
-                          "{                                                                                        \n"
-                          "   if ($__lldb_arg_obj == (void *)0)                                                     \n"
-                          "       return; // nil is ok                                                              \n" 
-                          "   if (!gdb_object_getClass($__lldb_arg_obj))                                            \n"
-                          "       *((volatile int *)0) = 'ocgc';                                                    \n"
-                          "   else if ($__lldb_arg_selector != (void *)0)                                           \n"
-                          "   {                                                                                     \n"
-                          "        signed char responds = (signed char) [(id) $__lldb_arg_obj                       \n"
-                          "                                                respondsToSelector:                      \n"
-                          "                                       (struct objc_selector *) $__lldb_arg_selector];   \n"
-                          "       if (responds == (signed char) 0)                                                  \n"
-                          "           *((volatile int *)0) = 'ocgc';                                                \n"
-                          "   }                                                                                     \n"
-                          "}                                                                                        \n",
-                          name);
-    }
-    else
-    {
-        len = ::snprintf (check_function_code, 
-                          sizeof(check_function_code), 
-                          "extern \"C\" void *gdb_class_getClass(void *);                                           \n"
-                          "extern \"C\"  int printf(const char *format, ...);                                       \n"
-                          "extern \"C\"  void                                                                       \n"
-                          "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector)                                    \n"
-                          "{                                                                                        \n"
-                          "   if ($__lldb_arg_obj == (void *)0)                                                     \n"
-                          "       return; // nil is ok                                                              \n" 
-                          "    void **$isa_ptr = (void **)$__lldb_arg_obj;                                          \n"
-                          "    if (*$isa_ptr == (void *)0 || !gdb_class_getClass(*$isa_ptr))                        \n"
-                          "       *((volatile int *)0) = 'ocgc';                                                    \n"
-                          "   else if ($__lldb_arg_selector != (void *)0)                                           \n"
-                          "   {                                                                                     \n"
-                          "        signed char responds = (signed char) [(id) $__lldb_arg_obj                       \n"
-                          "                                                respondsToSelector:                      \n"
-                          "                                        (struct objc_selector *) $__lldb_arg_selector];  \n"
-                          "       if (responds == (signed char) 0)                                                  \n"
-                          "           *((volatile int *)0) = 'ocgc';                                                \n"
-                          "   }                                                                                     \n"
-                          "}                                                                                        \n", 
-                          name);
-    }
-    
-    assert (len < (int)sizeof(check_function_code));
+    addr_t ivar_offset_address = LLDB_INVALID_ADDRESS;
 
     Error error;
-    return GetTargetRef().GetUtilityFunctionForLanguage(check_function_code, eLanguageTypeObjC, name, error);
+    SymbolContext ivar_offset_symbol;
+    if (sc_list.GetSize() == 1 &&
+        sc_list.GetContextAtIndex(0, ivar_offset_symbol)) {
+      if (ivar_offset_symbol.symbol)
+        ivar_offset_address =
+            ivar_offset_symbol.symbol->GetLoadAddress(&target);
+    }
+
+    //----------------------------------------------------------------------
+    // If we didn't get the ivar offset address from the symbol table, fall
+    // back to getting it from the runtime
+    //----------------------------------------------------------------------
+    if (ivar_offset_address == LLDB_INVALID_ADDRESS)
+      ivar_offset_address = LookupRuntimeSymbol(ivar_const_str);
+
+    if (ivar_offset_address != LLDB_INVALID_ADDRESS)
+      ivar_offset = m_process->ReadUnsignedIntegerFromMemory(
+          ivar_offset_address, 4, LLDB_INVALID_IVAR_OFFSET, error);
+  }
+  return ivar_offset;
+}
+
+// tagged pointers are special not-a-real-pointer values that contain both type
+// and value information
+// this routine attempts to check with as little computational effort as
+// possible whether something
+// could possibly be a tagged pointer - false positives are possible but false
+// negatives shouldn't
+bool AppleObjCRuntimeV2::IsTaggedPointer(addr_t ptr) {
+  if (!m_tagged_pointer_vendor_ap)
+    return false;
+  return m_tagged_pointer_vendor_ap->IsPossibleTaggedPointer(ptr);
 }
 
-size_t
-AppleObjCRuntimeV2::GetByteOffsetForIvar (CompilerType &parent_ast_type, const char *ivar_name)
-{
-    uint32_t ivar_offset = LLDB_INVALID_IVAR_OFFSET;
+class RemoteNXMapTable {
+public:
+  RemoteNXMapTable()
+      : m_count(0), m_num_buckets_minus_one(0),
+        m_buckets_ptr(LLDB_INVALID_ADDRESS), m_process(NULL),
+        m_end_iterator(*this, -1), m_load_addr(LLDB_INVALID_ADDRESS),
+        m_map_pair_size(0), m_invalid_key(0) {}
+
+  void Dump() {
+    printf("RemoteNXMapTable.m_load_addr = 0x%" PRIx64 "\n", m_load_addr);
+    printf("RemoteNXMapTable.m_count = %u\n", m_count);
+    printf("RemoteNXMapTable.m_num_buckets_minus_one = %u\n",
+           m_num_buckets_minus_one);
+    printf("RemoteNXMapTable.m_buckets_ptr = 0x%" PRIX64 "\n", m_buckets_ptr);
+  }
+
+  bool ParseHeader(Process *process, lldb::addr_t load_addr) {
+    m_process = process;
+    m_load_addr = load_addr;
+    m_map_pair_size = m_process->GetAddressByteSize() * 2;
+    m_invalid_key =
+        m_process->GetAddressByteSize() == 8 ? UINT64_MAX : UINT32_MAX;
+    Error err;
 
-    const char *class_name = parent_ast_type.GetConstTypeName().AsCString();
-    if (class_name && class_name[0] && ivar_name && ivar_name[0])
-    {
-        //----------------------------------------------------------------------
-        // Make the objective C V2 mangled name for the ivar offset from the
-        // class name and ivar name
-        //----------------------------------------------------------------------
-        std::string buffer("OBJC_IVAR_$_");
-        buffer.append (class_name);
-        buffer.push_back ('.');
-        buffer.append (ivar_name);
-        ConstString ivar_const_str (buffer.c_str());
-        
-        //----------------------------------------------------------------------
-        // Try to get the ivar offset address from the symbol table first using
-        // the name we created above
-        //----------------------------------------------------------------------
-        SymbolContextList sc_list;
-        Target &target = m_process->GetTarget();
-        target.GetImages().FindSymbolsWithNameAndType(ivar_const_str, eSymbolTypeObjCIVar, sc_list);
+    // This currently holds true for all platforms we support, but we might
+    // need to change this to use get the actually byte size of "unsigned"
+    // from the target AST...
+    const uint32_t unsigned_byte_size = sizeof(uint32_t);
+    // Skip the prototype as we don't need it (const struct +NXMapTablePrototype
+    // *prototype)
+
+    bool success = true;
+    if (load_addr == LLDB_INVALID_ADDRESS)
+      success = false;
+    else {
+      lldb::addr_t cursor = load_addr + m_process->GetAddressByteSize();
+
+      // unsigned count;
+      m_count = m_process->ReadUnsignedIntegerFromMemory(
+          cursor, unsigned_byte_size, 0, err);
+      if (m_count) {
+        cursor += unsigned_byte_size;
+
+        // unsigned nbBucketsMinusOne;
+        m_num_buckets_minus_one = m_process->ReadUnsignedIntegerFromMemory(
+            cursor, unsigned_byte_size, 0, err);
+        cursor += unsigned_byte_size;
+
+        // void *buckets;
+        m_buckets_ptr = m_process->ReadPointerFromMemory(cursor, err);
+
+        success = m_count > 0 && m_buckets_ptr != LLDB_INVALID_ADDRESS;
+      }
+    }
+
+    if (!success) {
+      m_count = 0;
+      m_num_buckets_minus_one = 0;
+      m_buckets_ptr = LLDB_INVALID_ADDRESS;
+    }
+    return success;
+  }
+
+  // const_iterator mimics NXMapState and its code comes from NXInitMapState and
+  // NXNextMapState.
+  typedef std::pair<ConstString, ObjCLanguageRuntime::ObjCISA> element;
+
+  friend class const_iterator;
+  class const_iterator {
+  public:
+    const_iterator(RemoteNXMapTable &parent, int index)
+        : m_parent(parent), m_index(index) {
+      AdvanceToValidIndex();
+    }
+
+    const_iterator(const const_iterator &rhs)
+        : m_parent(rhs.m_parent), m_index(rhs.m_index) {
+      // AdvanceToValidIndex() has been called by rhs already.
+    }
+
+    const_iterator &operator=(const const_iterator &rhs) {
+      // AdvanceToValidIndex() has been called by rhs already.
+      assert(&m_parent == &rhs.m_parent);
+      m_index = rhs.m_index;
+      return *this;
+    }
 
-        addr_t ivar_offset_address = LLDB_INVALID_ADDRESS;
+    bool operator==(const const_iterator &rhs) const {
+      if (&m_parent != &rhs.m_parent)
+        return false;
+      if (m_index != rhs.m_index)
+        return false;
 
-        Error error;
-        SymbolContext ivar_offset_symbol;
-        if (sc_list.GetSize() == 1 && sc_list.GetContextAtIndex(0, ivar_offset_symbol))
-        {
-            if (ivar_offset_symbol.symbol)
-                ivar_offset_address = ivar_offset_symbol.symbol->GetLoadAddress (&target);
-        }
+      return true;
+    }
 
-        //----------------------------------------------------------------------
-        // If we didn't get the ivar offset address from the symbol table, fall
-        // back to getting it from the runtime
-        //----------------------------------------------------------------------
-        if (ivar_offset_address == LLDB_INVALID_ADDRESS)
-            ivar_offset_address = LookupRuntimeSymbol(ivar_const_str);
-
-        if (ivar_offset_address != LLDB_INVALID_ADDRESS)
-            ivar_offset = m_process->ReadUnsignedIntegerFromMemory (ivar_offset_address,
-                                                                    4,
-                                                                    LLDB_INVALID_IVAR_OFFSET,
-                                                                    error);
-    }
-    return ivar_offset;
-}
-
-// tagged pointers are special not-a-real-pointer values that contain both type and value information
-// this routine attempts to check with as little computational effort as possible whether something
-// could possibly be a tagged pointer - false positives are possible but false negatives shouldn't
-bool
-AppleObjCRuntimeV2::IsTaggedPointer(addr_t ptr)
-{
-    if (!m_tagged_pointer_vendor_ap)
-        return false;
-    return m_tagged_pointer_vendor_ap->IsPossibleTaggedPointer(ptr);
-}
+    bool operator!=(const const_iterator &rhs) const {
+      return !(operator==(rhs));
+    }
 
-class RemoteNXMapTable
-{
-public:
-    RemoteNXMapTable () :
-        m_count (0),
-        m_num_buckets_minus_one (0),
-        m_buckets_ptr (LLDB_INVALID_ADDRESS),
-        m_process (NULL),
-        m_end_iterator (*this, -1),
-        m_load_addr (LLDB_INVALID_ADDRESS),
-        m_map_pair_size (0),
-        m_invalid_key (0)
-    {
+    const_iterator &operator++() {
+      AdvanceToValidIndex();
+      return *this;
     }
-    
-    void
-    Dump ()
-    {
-        printf ("RemoteNXMapTable.m_load_addr = 0x%" PRIx64 "\n", m_load_addr);
-        printf ("RemoteNXMapTable.m_count = %u\n", m_count);
-        printf ("RemoteNXMapTable.m_num_buckets_minus_one = %u\n", m_num_buckets_minus_one);
-        printf ("RemoteNXMapTable.m_buckets_ptr = 0x%" PRIX64 "\n", m_buckets_ptr);
-    }
-    
-    bool
-    ParseHeader (Process* process, lldb::addr_t load_addr)
-    {
-        m_process = process;
-        m_load_addr = load_addr;
-        m_map_pair_size = m_process->GetAddressByteSize() * 2;
-        m_invalid_key = m_process->GetAddressByteSize() == 8 ? UINT64_MAX : UINT32_MAX;
-        Error err;
-        
-        // This currently holds true for all platforms we support, but we might
-        // need to change this to use get the actually byte size of "unsigned"
-        // from the target AST...
-        const uint32_t unsigned_byte_size = sizeof(uint32_t);
-        // Skip the prototype as we don't need it (const struct +NXMapTablePrototype *prototype)
-        
-        bool success = true;
-        if (load_addr == LLDB_INVALID_ADDRESS)
-            success = false;
-        else
-        {
-            lldb::addr_t cursor = load_addr + m_process->GetAddressByteSize();
-                    
-            // unsigned count;
-            m_count = m_process->ReadUnsignedIntegerFromMemory(cursor, unsigned_byte_size, 0, err);
-            if (m_count)
-            {
-                cursor += unsigned_byte_size;
-            
-                // unsigned nbBucketsMinusOne;
-                m_num_buckets_minus_one = m_process->ReadUnsignedIntegerFromMemory(cursor, unsigned_byte_size, 0, err);
-                cursor += unsigned_byte_size;
-            
-                // void *buckets;
-                m_buckets_ptr = m_process->ReadPointerFromMemory(cursor, err);
-                
-                success = m_count > 0 && m_buckets_ptr != LLDB_INVALID_ADDRESS;
-            }
-        }
-        
-        if (!success)
-        {
-            m_count = 0;
-            m_num_buckets_minus_one = 0;
-            m_buckets_ptr = LLDB_INVALID_ADDRESS;
-        }
-        return success;
+
+    const element operator*() const {
+      if (m_index == -1) {
+        // TODO find a way to make this an error, but not an assert
+        return element();
+      }
+
+      lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr;
+      size_t map_pair_size = m_parent.m_map_pair_size;
+      lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
+
+      Error err;
+
+      lldb::addr_t key =
+          m_parent.m_process->ReadPointerFromMemory(pair_ptr, err);
+      if (!err.Success())
+        return element();
+      lldb::addr_t value = m_parent.m_process->ReadPointerFromMemory(
+          pair_ptr + m_parent.m_process->GetAddressByteSize(), err);
+      if (!err.Success())
+        return element();
+
+      std::string key_string;
+
+      m_parent.m_process->ReadCStringFromMemory(key, key_string, err);
+      if (!err.Success())
+        return element();
+
+      return element(ConstString(key_string.c_str()),
+                     (ObjCLanguageRuntime::ObjCISA)value);
     }
-    
-    // const_iterator mimics NXMapState and its code comes from NXInitMapState and NXNextMapState.
-    typedef std::pair<ConstString, ObjCLanguageRuntime::ObjCISA> element;
 
-    friend class const_iterator;
-    class const_iterator
-    {
-    public:
-        const_iterator (RemoteNXMapTable &parent, int index) : m_parent(parent), m_index(index)
-        {
-            AdvanceToValidIndex();
-        }
-        
-        const_iterator (const const_iterator &rhs) : m_parent(rhs.m_parent), m_index(rhs.m_index)
-        {
-            // AdvanceToValidIndex() has been called by rhs already.
-        }
-        
-        const_iterator &operator=(const const_iterator &rhs)
-        {
-            // AdvanceToValidIndex() has been called by rhs already.
-            assert (&m_parent == &rhs.m_parent);
-            m_index = rhs.m_index;
-            return *this;
-        }
-        
-        bool operator==(const const_iterator &rhs) const
-        {
-            if (&m_parent != &rhs.m_parent)
-                return false;
-            if (m_index != rhs.m_index)
-                return false;
-            
-            return true;
-        }
-        
-        bool operator!=(const const_iterator &rhs) const
-        {
-            return !(operator==(rhs));
-        }
-        
-        const_iterator &operator++()
-        {
-            AdvanceToValidIndex();
-            return *this;
-        }
-        
-        const element operator*() const
-        {
-            if (m_index == -1)
-            {
-                // TODO find a way to make this an error, but not an assert
-                return element();
-            }
-         
-            lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr;
-            size_t map_pair_size = m_parent.m_map_pair_size;
-            lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
-            
-            Error err;
-            
-            lldb::addr_t key = m_parent.m_process->ReadPointerFromMemory(pair_ptr, err);
-            if (!err.Success())
-                return element();
-            lldb::addr_t value = m_parent.m_process->ReadPointerFromMemory(pair_ptr + m_parent.m_process->GetAddressByteSize(), err);
-            if (!err.Success())
-                return element();
-            
-            std::string key_string;
-            
-            m_parent.m_process->ReadCStringFromMemory(key, key_string, err);
-            if (!err.Success())
-                return element();
-            
-            return element(ConstString(key_string.c_str()), (ObjCLanguageRuntime::ObjCISA)value);
-        }
+  private:
+    void AdvanceToValidIndex() {
+      if (m_index == -1)
+        return;
 
-    private:
-        void AdvanceToValidIndex ()
-        {
-            if (m_index == -1)
-                return;
-            
-            const lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr;
-            const size_t map_pair_size = m_parent.m_map_pair_size;
-            const lldb::addr_t invalid_key = m_parent.m_invalid_key;
-            Error err;
+      const lldb::addr_t pairs_ptr = m_parent.m_buckets_ptr;
+      const size_t map_pair_size = m_parent.m_map_pair_size;
+      const lldb::addr_t invalid_key = m_parent.m_invalid_key;
+      Error err;
 
-            while (m_index--)
-            {
-                lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
-                lldb::addr_t key = m_parent.m_process->ReadPointerFromMemory(pair_ptr, err);
-                
-                if (!err.Success())
-                {
-                    m_index = -1;
-                    return;
-                }
-                
-                if (key != invalid_key)
-                    return;
-            }
+      while (m_index--) {
+        lldb::addr_t pair_ptr = pairs_ptr + (m_index * map_pair_size);
+        lldb::addr_t key =
+            m_parent.m_process->ReadPointerFromMemory(pair_ptr, err);
+
+        if (!err.Success()) {
+          m_index = -1;
+          return;
         }
-        RemoteNXMapTable   &m_parent;
-        int                 m_index;
-    };
-    
-    const_iterator begin ()
-    {
-        return const_iterator(*this, m_num_buckets_minus_one + 1);
-    }
-    
-    const_iterator end ()
-    {
-        return m_end_iterator;
-    }
-    
-    uint32_t
-    GetCount () const
-    {
-        return m_count;
-    }
-    
-    uint32_t
-    GetBucketCount () const
-    {
-        return m_num_buckets_minus_one;
-    }
-    
-    lldb::addr_t
-    GetBucketDataPointer () const
-    {
-        return m_buckets_ptr;
-    }
-    
-    lldb::addr_t
-    GetTableLoadAddress() const
-    {
-        return m_load_addr;
+
+        if (key != invalid_key)
+          return;
+      }
     }
+    RemoteNXMapTable &m_parent;
+    int m_index;
+  };
+
+  const_iterator begin() {
+    return const_iterator(*this, m_num_buckets_minus_one + 1);
+  }
+
+  const_iterator end() { return m_end_iterator; }
+
+  uint32_t GetCount() const { return m_count; }
+
+  uint32_t GetBucketCount() const { return m_num_buckets_minus_one; }
+
+  lldb::addr_t GetBucketDataPointer() const { return m_buckets_ptr; }
+
+  lldb::addr_t GetTableLoadAddress() const { return m_load_addr; }
 
 private:
-    // contents of _NXMapTable struct
-    uint32_t m_count;
-    uint32_t m_num_buckets_minus_one;
-    lldb::addr_t m_buckets_ptr;
-    lldb_private::Process *m_process;
-    const_iterator m_end_iterator;
-    lldb::addr_t m_load_addr;
-    size_t m_map_pair_size;
-    lldb::addr_t m_invalid_key;
+  // contents of _NXMapTable struct
+  uint32_t m_count;
+  uint32_t m_num_buckets_minus_one;
+  lldb::addr_t m_buckets_ptr;
+  lldb_private::Process *m_process;
+  const_iterator m_end_iterator;
+  lldb::addr_t m_load_addr;
+  size_t m_map_pair_size;
+  lldb::addr_t m_invalid_key;
 };
 
-AppleObjCRuntimeV2::HashTableSignature::HashTableSignature() :
-    m_count (0),
-    m_num_buckets (0),
-    m_buckets_ptr (0)
-{
+AppleObjCRuntimeV2::HashTableSignature::HashTableSignature()
+    : m_count(0), m_num_buckets(0), m_buckets_ptr(0) {}
+
+void AppleObjCRuntimeV2::HashTableSignature::UpdateSignature(
+    const RemoteNXMapTable &hash_table) {
+  m_count = hash_table.GetCount();
+  m_num_buckets = hash_table.GetBucketCount();
+  m_buckets_ptr = hash_table.GetBucketDataPointer();
+}
+
+bool AppleObjCRuntimeV2::HashTableSignature::NeedsUpdate(
+    Process *process, AppleObjCRuntimeV2 *runtime,
+    RemoteNXMapTable &hash_table) {
+  if (!hash_table.ParseHeader(process, runtime->GetISAHashTablePointer())) {
+    return false; // Failed to parse the header, no need to update anything
+  }
+
+  // Check with out current signature and return true if the count,
+  // number of buckets or the hash table address changes.
+  if (m_count == hash_table.GetCount() &&
+      m_num_buckets == hash_table.GetBucketCount() &&
+      m_buckets_ptr == hash_table.GetBucketDataPointer()) {
+    // Hash table hasn't changed
+    return false;
+  }
+  // Hash table data has changed, we need to update
+  return true;
 }
 
-void
-AppleObjCRuntimeV2::HashTableSignature::UpdateSignature (const RemoteNXMapTable &hash_table)
-{
-    m_count = hash_table.GetCount();
-    m_num_buckets = hash_table.GetBucketCount();
-    m_buckets_ptr = hash_table.GetBucketDataPointer();
+ObjCLanguageRuntime::ClassDescriptorSP
+AppleObjCRuntimeV2::GetClassDescriptorFromISA(ObjCISA isa) {
+  ObjCLanguageRuntime::ClassDescriptorSP class_descriptor_sp;
+  if (m_non_pointer_isa_cache_ap.get())
+    class_descriptor_sp = m_non_pointer_isa_cache_ap->GetClassDescriptor(isa);
+  if (!class_descriptor_sp)
+    class_descriptor_sp = ObjCLanguageRuntime::GetClassDescriptorFromISA(isa);
+  return class_descriptor_sp;
 }
 
-bool
-AppleObjCRuntimeV2::HashTableSignature::NeedsUpdate (Process *process, AppleObjCRuntimeV2 *runtime, RemoteNXMapTable &hash_table)
-{
-    if (!hash_table.ParseHeader(process, runtime->GetISAHashTablePointer ()))
-    {
-        return false; // Failed to parse the header, no need to update anything
-    }
+ObjCLanguageRuntime::ClassDescriptorSP
+AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {
+  ClassDescriptorSP objc_class_sp;
+  if (valobj.IsBaseClass()) {
+    ValueObject *parent = valobj.GetParent();
+    // if I am my own parent, bail out of here fast..
+    if (parent && parent != &valobj) {
+      ClassDescriptorSP parent_descriptor_sp = GetClassDescriptor(*parent);
+      if (parent_descriptor_sp)
+        return parent_descriptor_sp->GetSuperclass();
+    }
+    return nullptr;
+  }
+  // if we get an invalid VO (which might still happen when playing around
+  // with pointers returned by the expression parser, don't consider this
+  // a valid ObjC object)
+  if (valobj.GetCompilerType().IsValid()) {
+    addr_t isa_pointer = valobj.GetPointerValue();
+
+    // tagged pointer
+    if (IsTaggedPointer(isa_pointer)) {
+      return m_tagged_pointer_vendor_ap->GetClassDescriptor(isa_pointer);
+    } else {
+      ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
 
-    // Check with out current signature and return true if the count,
-    // number of buckets or the hash table address changes.
-    if (m_count == hash_table.GetCount() &&
-        m_num_buckets == hash_table.GetBucketCount() &&
-        m_buckets_ptr == hash_table.GetBucketDataPointer())
-    {
-        // Hash table hasn't changed
-        return false;
+      Process *process = exe_ctx.GetProcessPtr();
+      if (process) {
+        Error error;
+        ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error);
+        if (isa != LLDB_INVALID_ADDRESS) {
+          objc_class_sp = GetClassDescriptorFromISA(isa);
+          if (isa && !objc_class_sp) {
+            Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+            if (log)
+              log->Printf("0x%" PRIx64
+                          ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
+                          "not in class descriptor cache 0x%" PRIx64,
+                          isa_pointer, isa);
+          }
+        }
+      }
     }
-    // Hash table data has changed, we need to update
-    return true;
+  }
+  return objc_class_sp;
 }
 
-ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::GetClassDescriptorFromISA (ObjCISA isa)
-{
-    ObjCLanguageRuntime::ClassDescriptorSP class_descriptor_sp;
-    if (m_non_pointer_isa_cache_ap.get())
-        class_descriptor_sp = m_non_pointer_isa_cache_ap->GetClassDescriptor(isa);
-    if (!class_descriptor_sp)
-        class_descriptor_sp = ObjCLanguageRuntime::GetClassDescriptorFromISA(isa);
-    return class_descriptor_sp;
-}
+lldb::addr_t AppleObjCRuntimeV2::GetISAHashTablePointer() {
+  if (m_isa_hash_table_ptr == LLDB_INVALID_ADDRESS) {
+    Process *process = GetProcess();
 
-ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::GetClassDescriptor (ValueObject& valobj)
-{
-    ClassDescriptorSP objc_class_sp;
-    if (valobj.IsBaseClass())
-    {
-        ValueObject *parent = valobj.GetParent();
-        // if I am my own parent, bail out of here fast..
-        if (parent && parent != &valobj)
-        {
-            ClassDescriptorSP parent_descriptor_sp = GetClassDescriptor(*parent);
-            if (parent_descriptor_sp)
-                return parent_descriptor_sp->GetSuperclass();
-        }
-        return nullptr;
-    }
-    // if we get an invalid VO (which might still happen when playing around
-    // with pointers returned by the expression parser, don't consider this
-    // a valid ObjC object)
-    if (valobj.GetCompilerType().IsValid())
-    {
-        addr_t isa_pointer = valobj.GetPointerValue();
-        
-        // tagged pointer
-        if (IsTaggedPointer(isa_pointer))
-        {
-            return m_tagged_pointer_vendor_ap->GetClassDescriptor(isa_pointer);
-        }
-        else
-        {
-            ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
-            
-            Process *process = exe_ctx.GetProcessPtr();
-            if (process)
-            {
-                Error error;
-                ObjCISA isa = process->ReadPointerFromMemory(isa_pointer, error);
-                if (isa != LLDB_INVALID_ADDRESS)
-                {
-                    objc_class_sp = GetClassDescriptorFromISA (isa);
-                    if (isa && !objc_class_sp)
-                    {
-                        Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
-                        if (log)
-                            log->Printf("0x%" PRIx64 ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was not in class descriptor cache 0x%" PRIx64,
-                                        isa_pointer,
-                                        isa);
-                    }
-                }
-            }
-        }
-    }
-    return objc_class_sp;
-}
+    ModuleSP objc_module_sp(GetObjCModule());
 
-lldb::addr_t
-AppleObjCRuntimeV2::GetISAHashTablePointer ()
-{
-    if (m_isa_hash_table_ptr == LLDB_INVALID_ADDRESS)
-    {
-        Process *process = GetProcess();
+    if (!objc_module_sp)
+      return LLDB_INVALID_ADDRESS;
 
-        ModuleSP objc_module_sp(GetObjCModule());
-        
-        if (!objc_module_sp)
-            return LLDB_INVALID_ADDRESS;
-
-        static ConstString g_gdb_objc_realized_classes("gdb_objc_realized_classes");
-        
-        const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(g_gdb_objc_realized_classes, lldb::eSymbolTypeAny);
-        if (symbol)
-        {
-            lldb::addr_t gdb_objc_realized_classes_ptr = symbol->GetLoadAddress(&process->GetTarget());
-            
-            if (gdb_objc_realized_classes_ptr != LLDB_INVALID_ADDRESS)
-            {
-                Error error;
-                m_isa_hash_table_ptr = process->ReadPointerFromMemory(gdb_objc_realized_classes_ptr, error);
-            }
-        }
+    static ConstString g_gdb_objc_realized_classes("gdb_objc_realized_classes");
+
+    const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(
+        g_gdb_objc_realized_classes, lldb::eSymbolTypeAny);
+    if (symbol) {
+      lldb::addr_t gdb_objc_realized_classes_ptr =
+          symbol->GetLoadAddress(&process->GetTarget());
+
+      if (gdb_objc_realized_classes_ptr != LLDB_INVALID_ADDRESS) {
+        Error error;
+        m_isa_hash_table_ptr = process->ReadPointerFromMemory(
+            gdb_objc_realized_classes_ptr, error);
+      }
     }
-    return m_isa_hash_table_ptr;
+  }
+  return m_isa_hash_table_ptr;
 }
 
 AppleObjCRuntimeV2::DescriptorMapUpdateResult
-AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(RemoteNXMapTable &hash_table)
-{
-    Process *process = GetProcess();
-    
-    if (process == NULL)
-        return DescriptorMapUpdateResult::Fail();
-    
-    uint32_t num_class_infos = 0;
-    
-    Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
-    
-    ExecutionContext exe_ctx;
-    
-    ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread();
-    
-    if (!thread_sp)
-        return DescriptorMapUpdateResult::Fail();
-    
-    thread_sp->CalculateExecutionContext(exe_ctx);
-    ClangASTContext *ast = process->GetTarget().GetScratchClangASTContext();
-    
-    if (!ast)
-        return DescriptorMapUpdateResult::Fail();
+AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
+    RemoteNXMapTable &hash_table) {
+  Process *process = GetProcess();
 
-    Address function_address;
+  if (process == NULL)
+    return DescriptorMapUpdateResult::Fail();
 
-    DiagnosticManager diagnostics;
+  uint32_t num_class_infos = 0;
 
-    const uint32_t addr_size = process->GetAddressByteSize();
+  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
 
-    Error err;
-    
-    // Read the total number of classes from the hash table
-    const uint32_t num_classes = hash_table.GetCount();
-    if (num_classes == 0)
-    {
-        if (log)
-            log->Printf ("No dynamic classes found in gdb_objc_realized_classes.");
-        return DescriptorMapUpdateResult::Success(0);
-    }
-    
-    // Make some types for our arguments
-    CompilerType clang_uint32_t_type = ast->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32);
-    CompilerType clang_void_pointer_type = ast->GetBasicType(eBasicTypeVoid).GetPointerType();
-    
-    ValueList arguments;
-    FunctionCaller *get_class_info_function = nullptr;
+  ExecutionContext exe_ctx;
 
-    if (!m_get_class_info_code.get())
-    {
-        Error error;
-        m_get_class_info_code.reset (GetTargetRef().GetUtilityFunctionForLanguage (g_get_dynamic_class_info_body,
-                                                                                   eLanguageTypeObjC,
-                                                                                   g_get_dynamic_class_info_name,
-                                                                                   error));
-        if (error.Fail())
-        {
-            if (log)
-                log->Printf ("Failed to get Utility Function for implementation lookup: %s", error.AsCString());
-            m_get_class_info_code.reset();
-        }
-        else
-        {
-            diagnostics.Clear();
+  ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread();
 
-            if (!m_get_class_info_code->Install(diagnostics, exe_ctx))
-            {
-                if (log)
-                {
-                    log->Printf("Failed to install implementation lookup");
-                    diagnostics.Dump(log);
-                }
-                m_get_class_info_code.reset();
-            }
-        }
-        if (!m_get_class_info_code.get())
-            return DescriptorMapUpdateResult::Fail();
-        
-        // Next make the runner function for our implementation utility function.
-        Value value;
-        value.SetValueType (Value::eValueTypeScalar);
-        value.SetCompilerType (clang_void_pointer_type);
-        arguments.PushValue (value);
-        arguments.PushValue (value);
-        
-        value.SetValueType (Value::eValueTypeScalar);
-        value.SetCompilerType (clang_uint32_t_type);
-        arguments.PushValue (value);
-        arguments.PushValue (value);
-        
-        get_class_info_function = m_get_class_info_code->MakeFunctionCaller(clang_uint32_t_type,
-                                                                            arguments,
-                                                                            thread_sp,
-                                                                            error);
-        
-        if (error.Fail())
-        {
-            if (log)
-                log->Printf("Failed to make function caller for implementation lookup: %s.", error.AsCString());
-            return DescriptorMapUpdateResult::Fail();
-        }
-    }
-    else
-    {
-        get_class_info_function = m_get_class_info_code->GetFunctionCaller();
-        if (!get_class_info_function)
-        {
-            if (log)
-            {
-                log->Printf("Failed to get implementation lookup function caller.");
-                diagnostics.Dump(log);
-            }
+  if (!thread_sp)
+    return DescriptorMapUpdateResult::Fail();
 
-            return DescriptorMapUpdateResult::Fail();
-        }
-        arguments = get_class_info_function->GetArgumentValues();
-    }
+  thread_sp->CalculateExecutionContext(exe_ctx);
+  ClangASTContext *ast = process->GetTarget().GetScratchClangASTContext();
 
-    diagnostics.Clear();
+  if (!ast)
+    return DescriptorMapUpdateResult::Fail();
 
-    const uint32_t class_info_byte_size = addr_size + 4;
-    const uint32_t class_infos_byte_size = num_classes * class_info_byte_size;
-    lldb::addr_t class_infos_addr = process->AllocateMemory(class_infos_byte_size,
-                                                            ePermissionsReadable | ePermissionsWritable,
-                                                            err);
-    
-    if (class_infos_addr == LLDB_INVALID_ADDRESS)
-    {
-        if (log)
-            log->Printf("unable to allocate %" PRIu32 " bytes in process for shared cache read", class_infos_byte_size);
-        return DescriptorMapUpdateResult::Fail();
-    }
+  Address function_address;
 
-    std::lock_guard<std::mutex> guard(m_get_class_info_args_mutex);
+  DiagnosticManager diagnostics;
 
-    // Fill in our function argument values
-    arguments.GetValueAtIndex(0)->GetScalar() = hash_table.GetTableLoadAddress();
-    arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
-    arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
-    arguments.GetValueAtIndex(3)->GetScalar() = (GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES) == nullptr ? 0 : 1);
+  const uint32_t addr_size = process->GetAddressByteSize();
 
-    
-    bool success = false;
+  Error err;
 
-    diagnostics.Clear();
+  // Read the total number of classes from the hash table
+  const uint32_t num_classes = hash_table.GetCount();
+  if (num_classes == 0) {
+    if (log)
+      log->Printf("No dynamic classes found in gdb_objc_realized_classes.");
+    return DescriptorMapUpdateResult::Success(0);
+  }
+
+  // Make some types for our arguments
+  CompilerType clang_uint32_t_type =
+      ast->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32);
+  CompilerType clang_void_pointer_type =
+      ast->GetBasicType(eBasicTypeVoid).GetPointerType();
 
-    // Write our function arguments into the process so we can run our function
-    if (get_class_info_function->WriteFunctionArguments(exe_ctx, m_get_class_info_args, arguments, diagnostics))
-    {
-        EvaluateExpressionOptions options;
-        options.SetUnwindOnError(true);
-        options.SetTryAllThreads(false);
-        options.SetStopOthers(true);
-        options.SetIgnoreBreakpoints(true);
-        options.SetTimeoutUsec(UTILITY_FUNCTION_TIMEOUT_USEC);
-        
-        Value return_value;
-        return_value.SetValueType (Value::eValueTypeScalar);
-        //return_value.SetContext (Value::eContextTypeClangType, clang_uint32_t_type);
-        return_value.SetCompilerType(clang_uint32_t_type);
-        return_value.GetScalar() = 0;
-
-        diagnostics.Clear();
-
-        // Run the function
-        ExpressionResults results = get_class_info_function->ExecuteFunction(exe_ctx, &m_get_class_info_args, options,
-                                                                             diagnostics, return_value);
+  ValueList arguments;
+  FunctionCaller *get_class_info_function = nullptr;
 
-        if (results == eExpressionCompleted)
-        {
-            // The result is the number of ClassInfo structures that were filled in
-            num_class_infos = return_value.GetScalar().ULong();
-            if (log)
-                log->Printf("Discovered %u ObjC classes\n",num_class_infos);
-            if (num_class_infos > 0)
-            {
-                // Read the ClassInfo structures
-                DataBufferHeap buffer (num_class_infos * class_info_byte_size, 0);
-                if (process->ReadMemory(class_infos_addr, buffer.GetBytes(), buffer.GetByteSize(), err) == buffer.GetByteSize())
-                {
-                    DataExtractor class_infos_data (buffer.GetBytes(),
-                                                    buffer.GetByteSize(),
-                                                    process->GetByteOrder(),
-                                                    addr_size);
-                    ParseClassInfoArray (class_infos_data, num_class_infos);
-                }
-            }
-            success = true;
-        }
-        else
-        {
-            if (log)
-            {
-                log->Printf("Error evaluating our find class name function.");
-                diagnostics.Dump(log);
-            }
-        }
-    }
-    else
-    {
-        if (log)
-        {
-            log->Printf("Error writing function arguments.");
-            diagnostics.Dump(log);
+  if (!m_get_class_info_code.get()) {
+    Error error;
+    m_get_class_info_code.reset(GetTargetRef().GetUtilityFunctionForLanguage(
+        g_get_dynamic_class_info_body, eLanguageTypeObjC,
+        g_get_dynamic_class_info_name, error));
+    if (error.Fail()) {
+      if (log)
+        log->Printf(
+            "Failed to get Utility Function for implementation lookup: %s",
+            error.AsCString());
+      m_get_class_info_code.reset();
+    } else {
+      diagnostics.Clear();
+
+      if (!m_get_class_info_code->Install(diagnostics, exe_ctx)) {
+        if (log) {
+          log->Printf("Failed to install implementation lookup");
+          diagnostics.Dump(log);
         }
+        m_get_class_info_code.reset();
+      }
     }
+    if (!m_get_class_info_code.get())
+      return DescriptorMapUpdateResult::Fail();
 
-    // Deallocate the memory we allocated for the ClassInfo array
-    process->DeallocateMemory(class_infos_addr);
-    
-    return DescriptorMapUpdateResult(success, num_class_infos);
-}
+    // Next make the runner function for our implementation utility function.
+    Value value;
+    value.SetValueType(Value::eValueTypeScalar);
+    value.SetCompilerType(clang_void_pointer_type);
+    arguments.PushValue(value);
+    arguments.PushValue(value);
+
+    value.SetValueType(Value::eValueTypeScalar);
+    value.SetCompilerType(clang_uint32_t_type);
+    arguments.PushValue(value);
+    arguments.PushValue(value);
+
+    get_class_info_function = m_get_class_info_code->MakeFunctionCaller(
+        clang_uint32_t_type, arguments, thread_sp, error);
+
+    if (error.Fail()) {
+      if (log)
+        log->Printf(
+            "Failed to make function caller for implementation lookup: %s.",
+            error.AsCString());
+      return DescriptorMapUpdateResult::Fail();
+    }
+  } else {
+    get_class_info_function = m_get_class_info_code->GetFunctionCaller();
+    if (!get_class_info_function) {
+      if (log) {
+        log->Printf("Failed to get implementation lookup function caller.");
+        diagnostics.Dump(log);
+      }
+
+      return DescriptorMapUpdateResult::Fail();
+    }
+    arguments = get_class_info_function->GetArgumentValues();
+  }
+
+  diagnostics.Clear();
+
+  const uint32_t class_info_byte_size = addr_size + 4;
+  const uint32_t class_infos_byte_size = num_classes * class_info_byte_size;
+  lldb::addr_t class_infos_addr = process->AllocateMemory(
+      class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
 
-uint32_t
-AppleObjCRuntimeV2::ParseClassInfoArray (const DataExtractor &data, uint32_t num_class_infos)
-{
-    // Parses an array of "num_class_infos" packed ClassInfo structures:
-    //
-    //    struct ClassInfo
-    //    {
-    //        Class isa;
-    //        uint32_t hash;
-    //    } __attribute__((__packed__));
-
-    Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
-    
-    uint32_t num_parsed = 0;
-
-    // Iterate through all ClassInfo structures
-    lldb::offset_t offset = 0;
-    for (uint32_t i=0; i<num_class_infos; ++i)
-    {
-        ObjCISA isa = data.GetPointer(&offset);
-        
-        if (isa == 0)
-        {
-            if (log)
-                log->Printf("AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
-            continue;
-        }
-        // Check if we already know about this ISA, if we do, the info will
-        // never change, so we can just skip it.
-        if (ISAIsCached(isa))
-        {
-            if (log)
-                log->Printf("AppleObjCRuntimeV2 found cached isa=0x%" PRIx64 ", ignoring this class info", isa);
-            offset += 4;
-        }
-        else
-        {
-            // Read the 32 bit hash for the class name
-            const uint32_t name_hash = data.GetU32(&offset);
-            ClassDescriptorSP descriptor_sp (new ClassDescriptorV2(*this, isa, NULL));
-            AddClass (isa, descriptor_sp, name_hash);
-            num_parsed++;
-            if (log)
-                log->Printf("AppleObjCRuntimeV2 added isa=0x%" PRIx64 ", hash=0x%8.8x, name=%s", isa, name_hash,descriptor_sp->GetClassName().AsCString("<unknown>"));
-        }
-    }
+  if (class_infos_addr == LLDB_INVALID_ADDRESS) {
     if (log)
-        log->Printf("AppleObjCRuntimeV2 parsed %" PRIu32 " class infos", num_parsed);
-    return num_parsed;
+      log->Printf("unable to allocate %" PRIu32
+                  " bytes in process for shared cache read",
+                  class_infos_byte_size);
+    return DescriptorMapUpdateResult::Fail();
+  }
+
+  std::lock_guard<std::mutex> guard(m_get_class_info_args_mutex);
+
+  // Fill in our function argument values
+  arguments.GetValueAtIndex(0)->GetScalar() = hash_table.GetTableLoadAddress();
+  arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
+  arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
+  arguments.GetValueAtIndex(3)->GetScalar() =
+      (GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES) == nullptr ? 0 : 1);
+
+  bool success = false;
+
+  diagnostics.Clear();
+
+  // Write our function arguments into the process so we can run our function
+  if (get_class_info_function->WriteFunctionArguments(
+          exe_ctx, m_get_class_info_args, arguments, diagnostics)) {
+    EvaluateExpressionOptions options;
+    options.SetUnwindOnError(true);
+    options.SetTryAllThreads(false);
+    options.SetStopOthers(true);
+    options.SetIgnoreBreakpoints(true);
+    options.SetTimeoutUsec(UTILITY_FUNCTION_TIMEOUT_USEC);
+
+    Value return_value;
+    return_value.SetValueType(Value::eValueTypeScalar);
+    // return_value.SetContext (Value::eContextTypeClangType,
+    // clang_uint32_t_type);
+    return_value.SetCompilerType(clang_uint32_t_type);
+    return_value.GetScalar() = 0;
+
+    diagnostics.Clear();
+
+    // Run the function
+    ExpressionResults results = get_class_info_function->ExecuteFunction(
+        exe_ctx, &m_get_class_info_args, options, diagnostics, return_value);
+
+    if (results == eExpressionCompleted) {
+      // The result is the number of ClassInfo structures that were filled in
+      num_class_infos = return_value.GetScalar().ULong();
+      if (log)
+        log->Printf("Discovered %u ObjC classes\n", num_class_infos);
+      if (num_class_infos > 0) {
+        // Read the ClassInfo structures
+        DataBufferHeap buffer(num_class_infos * class_info_byte_size, 0);
+        if (process->ReadMemory(class_infos_addr, buffer.GetBytes(),
+                                buffer.GetByteSize(),
+                                err) == buffer.GetByteSize()) {
+          DataExtractor class_infos_data(buffer.GetBytes(),
+                                         buffer.GetByteSize(),
+                                         process->GetByteOrder(), addr_size);
+          ParseClassInfoArray(class_infos_data, num_class_infos);
+        }
+      }
+      success = true;
+    } else {
+      if (log) {
+        log->Printf("Error evaluating our find class name function.");
+        diagnostics.Dump(log);
+      }
+    }
+  } else {
+    if (log) {
+      log->Printf("Error writing function arguments.");
+      diagnostics.Dump(log);
+    }
+  }
+
+  // Deallocate the memory we allocated for the ClassInfo array
+  process->DeallocateMemory(class_infos_addr);
+
+  return DescriptorMapUpdateResult(success, num_class_infos);
+}
+
+uint32_t AppleObjCRuntimeV2::ParseClassInfoArray(const DataExtractor &data,
+                                                 uint32_t num_class_infos) {
+  // Parses an array of "num_class_infos" packed ClassInfo structures:
+  //
+  //    struct ClassInfo
+  //    {
+  //        Class isa;
+  //        uint32_t hash;
+  //    } __attribute__((__packed__));
+
+  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
+
+  uint32_t num_parsed = 0;
+
+  // Iterate through all ClassInfo structures
+  lldb::offset_t offset = 0;
+  for (uint32_t i = 0; i < num_class_infos; ++i) {
+    ObjCISA isa = data.GetPointer(&offset);
+
+    if (isa == 0) {
+      if (log)
+        log->Printf(
+            "AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
+      continue;
+    }
+    // Check if we already know about this ISA, if we do, the info will
+    // never change, so we can just skip it.
+    if (ISAIsCached(isa)) {
+      if (log)
+        log->Printf("AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
+                    ", ignoring this class info",
+                    isa);
+      offset += 4;
+    } else {
+      // Read the 32 bit hash for the class name
+      const uint32_t name_hash = data.GetU32(&offset);
+      ClassDescriptorSP descriptor_sp(new ClassDescriptorV2(*this, isa, NULL));
+      AddClass(isa, descriptor_sp, name_hash);
+      num_parsed++;
+      if (log)
+        log->Printf("AppleObjCRuntimeV2 added isa=0x%" PRIx64
+                    ", hash=0x%8.8x, name=%s",
+                    isa, name_hash,
+                    descriptor_sp->GetClassName().AsCString("<unknown>"));
+    }
+  }
+  if (log)
+    log->Printf("AppleObjCRuntimeV2 parsed %" PRIu32 " class infos",
+                num_parsed);
+  return num_parsed;
 }
 
 AppleObjCRuntimeV2::DescriptorMapUpdateResult
-AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache()
-{
-    Process *process = GetProcess();
-    
-    if (process == NULL)
-        return DescriptorMapUpdateResult::Fail();
-    
-    Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
-    
-    ExecutionContext exe_ctx;
-    
-    ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread();
-    
-    if (!thread_sp)
-        return DescriptorMapUpdateResult::Fail();
-    
-    thread_sp->CalculateExecutionContext(exe_ctx);
-    ClangASTContext *ast = process->GetTarget().GetScratchClangASTContext();
-    
-    if (!ast)
-        return DescriptorMapUpdateResult::Fail();
+AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
+  Process *process = GetProcess();
 
-    Address function_address;
+  if (process == NULL)
+    return DescriptorMapUpdateResult::Fail();
 
-    DiagnosticManager diagnostics;
+  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
 
-    const uint32_t addr_size = process->GetAddressByteSize();
+  ExecutionContext exe_ctx;
 
-    Error err;
-    
-    uint32_t num_class_infos = 0;
-    
-    const lldb::addr_t objc_opt_ptr = GetSharedCacheReadOnlyAddress();
-    
-    if (objc_opt_ptr == LLDB_INVALID_ADDRESS)
-        return DescriptorMapUpdateResult::Fail();
-    
-    const uint32_t num_classes = 128*1024;
-    
-    // Make some types for our arguments
-    CompilerType clang_uint32_t_type = ast->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32);
-    CompilerType clang_void_pointer_type = ast->GetBasicType(eBasicTypeVoid).GetPointerType();
-    
-    ValueList arguments;
-    FunctionCaller *get_shared_cache_class_info_function = nullptr;
-    
-    if (!m_get_shared_cache_class_info_code.get())
-    {
-        Error error;
-        m_get_shared_cache_class_info_code.reset (GetTargetRef().GetUtilityFunctionForLanguage (g_get_shared_cache_class_info_body,
-                                                                                                eLanguageTypeObjC,
-                                                                                                g_get_shared_cache_class_info_name,
-                                                                                                error));
-        if (error.Fail())
-        {
-            if (log)
-                log->Printf ("Failed to get Utility function for implementation lookup: %s.", error.AsCString());
-            m_get_shared_cache_class_info_code.reset();
-        }
-        else
-        {
-            diagnostics.Clear();
+  ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread();
 
-            if (!m_get_shared_cache_class_info_code->Install(diagnostics, exe_ctx))
-            {
-                if (log)
-                {
-                    log->Printf("Failed to install implementation lookup.");
-                    diagnostics.Dump(log);
-                }
-                m_get_shared_cache_class_info_code.reset();
-            }
-        }
+  if (!thread_sp)
+    return DescriptorMapUpdateResult::Fail();
 
-        if (!m_get_shared_cache_class_info_code.get())
-            return DescriptorMapUpdateResult::Fail();
-    
-        // Next make the function caller for our implementation utility function.
-        Value value;
-        value.SetValueType (Value::eValueTypeScalar);
-        //value.SetContext (Value::eContextTypeClangType, clang_void_pointer_type);
-        value.SetCompilerType (clang_void_pointer_type);
-        arguments.PushValue (value);
-        arguments.PushValue (value);
-        
-        value.SetValueType (Value::eValueTypeScalar);
-        //value.SetContext (Value::eContextTypeClangType, clang_uint32_t_type);
-        value.SetCompilerType (clang_uint32_t_type);
-        arguments.PushValue (value);
-        arguments.PushValue (value);
-        
-        get_shared_cache_class_info_function = m_get_shared_cache_class_info_code->MakeFunctionCaller(clang_uint32_t_type,
-                                                                                                      arguments,
-                                                                                                      thread_sp,
-                                                                                                      error);
-        
-        if (get_shared_cache_class_info_function == nullptr)
-            return DescriptorMapUpdateResult::Fail();
-    
-    }
-    else
-    {
-        get_shared_cache_class_info_function = m_get_shared_cache_class_info_code->GetFunctionCaller();
-        if (get_shared_cache_class_info_function == nullptr)
-            return DescriptorMapUpdateResult::Fail();
-        arguments = get_shared_cache_class_info_function->GetArgumentValues();
-    }
+  thread_sp->CalculateExecutionContext(exe_ctx);
+  ClangASTContext *ast = process->GetTarget().GetScratchClangASTContext();
 
-    diagnostics.Clear();
+  if (!ast)
+    return DescriptorMapUpdateResult::Fail();
 
-    const uint32_t class_info_byte_size = addr_size + 4;
-    const uint32_t class_infos_byte_size = num_classes * class_info_byte_size;
-    lldb::addr_t class_infos_addr = process->AllocateMemory (class_infos_byte_size,
-                                                             ePermissionsReadable | ePermissionsWritable,
-                                                             err);
-    
-    if (class_infos_addr == LLDB_INVALID_ADDRESS)
-    {
-        if (log)
-            log->Printf("unable to allocate %" PRIu32 " bytes in process for shared cache read", class_infos_byte_size);
-        return DescriptorMapUpdateResult::Fail();
+  Address function_address;
+
+  DiagnosticManager diagnostics;
+
+  const uint32_t addr_size = process->GetAddressByteSize();
+
+  Error err;
+
+  uint32_t num_class_infos = 0;
+
+  const lldb::addr_t objc_opt_ptr = GetSharedCacheReadOnlyAddress();
+
+  if (objc_opt_ptr == LLDB_INVALID_ADDRESS)
+    return DescriptorMapUpdateResult::Fail();
+
+  const uint32_t num_classes = 128 * 1024;
+
+  // Make some types for our arguments
+  CompilerType clang_uint32_t_type =
+      ast->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32);
+  CompilerType clang_void_pointer_type =
+      ast->GetBasicType(eBasicTypeVoid).GetPointerType();
+
+  ValueList arguments;
+  FunctionCaller *get_shared_cache_class_info_function = nullptr;
+
+  if (!m_get_shared_cache_class_info_code.get()) {
+    Error error;
+    m_get_shared_cache_class_info_code.reset(
+        GetTargetRef().GetUtilityFunctionForLanguage(
+            g_get_shared_cache_class_info_body, eLanguageTypeObjC,
+            g_get_shared_cache_class_info_name, error));
+    if (error.Fail()) {
+      if (log)
+        log->Printf(
+            "Failed to get Utility function for implementation lookup: %s.",
+            error.AsCString());
+      m_get_shared_cache_class_info_code.reset();
+    } else {
+      diagnostics.Clear();
+
+      if (!m_get_shared_cache_class_info_code->Install(diagnostics, exe_ctx)) {
+        if (log) {
+          log->Printf("Failed to install implementation lookup.");
+          diagnostics.Dump(log);
+        }
+        m_get_shared_cache_class_info_code.reset();
+      }
     }
 
-    std::lock_guard<std::mutex> guard(m_get_shared_cache_class_info_args_mutex);
+    if (!m_get_shared_cache_class_info_code.get())
+      return DescriptorMapUpdateResult::Fail();
 
-    // Fill in our function argument values
-    arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr;
-    arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
-    arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
-    arguments.GetValueAtIndex(3)->GetScalar() = (GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES) == nullptr ? 0 : 1);
-    
+    // Next make the function caller for our implementation utility function.
+    Value value;
+    value.SetValueType(Value::eValueTypeScalar);
+    // value.SetContext (Value::eContextTypeClangType, clang_void_pointer_type);
+    value.SetCompilerType(clang_void_pointer_type);
+    arguments.PushValue(value);
+    arguments.PushValue(value);
+
+    value.SetValueType(Value::eValueTypeScalar);
+    // value.SetContext (Value::eContextTypeClangType, clang_uint32_t_type);
+    value.SetCompilerType(clang_uint32_t_type);
+    arguments.PushValue(value);
+    arguments.PushValue(value);
+
+    get_shared_cache_class_info_function =
+        m_get_shared_cache_class_info_code->MakeFunctionCaller(
+            clang_uint32_t_type, arguments, thread_sp, error);
+
+    if (get_shared_cache_class_info_function == nullptr)
+      return DescriptorMapUpdateResult::Fail();
+
+  } else {
+    get_shared_cache_class_info_function =
+        m_get_shared_cache_class_info_code->GetFunctionCaller();
+    if (get_shared_cache_class_info_function == nullptr)
+      return DescriptorMapUpdateResult::Fail();
+    arguments = get_shared_cache_class_info_function->GetArgumentValues();
+  }
+
+  diagnostics.Clear();
+
+  const uint32_t class_info_byte_size = addr_size + 4;
+  const uint32_t class_infos_byte_size = num_classes * class_info_byte_size;
+  lldb::addr_t class_infos_addr = process->AllocateMemory(
+      class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
 
-    bool success = false;
+  if (class_infos_addr == LLDB_INVALID_ADDRESS) {
+    if (log)
+      log->Printf("unable to allocate %" PRIu32
+                  " bytes in process for shared cache read",
+                  class_infos_byte_size);
+    return DescriptorMapUpdateResult::Fail();
+  }
+
+  std::lock_guard<std::mutex> guard(m_get_shared_cache_class_info_args_mutex);
+
+  // Fill in our function argument values
+  arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr;
+  arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
+  arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
+  arguments.GetValueAtIndex(3)->GetScalar() =
+      (GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES) == nullptr ? 0 : 1);
+
+  bool success = false;
+
+  diagnostics.Clear();
+
+  // Write our function arguments into the process so we can run our function
+  if (get_shared_cache_class_info_function->WriteFunctionArguments(
+          exe_ctx, m_get_shared_cache_class_info_args, arguments,
+          diagnostics)) {
+    EvaluateExpressionOptions options;
+    options.SetUnwindOnError(true);
+    options.SetTryAllThreads(false);
+    options.SetStopOthers(true);
+    options.SetIgnoreBreakpoints(true);
+    options.SetTimeoutUsec(UTILITY_FUNCTION_TIMEOUT_USEC);
+
+    Value return_value;
+    return_value.SetValueType(Value::eValueTypeScalar);
+    // return_value.SetContext (Value::eContextTypeClangType,
+    // clang_uint32_t_type);
+    return_value.SetCompilerType(clang_uint32_t_type);
+    return_value.GetScalar() = 0;
 
     diagnostics.Clear();
 
-    // Write our function arguments into the process so we can run our function
-    if (get_shared_cache_class_info_function->WriteFunctionArguments(exe_ctx, m_get_shared_cache_class_info_args,
-                                                                     arguments, diagnostics))
-    {
-        EvaluateExpressionOptions options;
-        options.SetUnwindOnError(true);
-        options.SetTryAllThreads(false);
-        options.SetStopOthers(true);
-        options.SetIgnoreBreakpoints(true);
-        options.SetTimeoutUsec(UTILITY_FUNCTION_TIMEOUT_USEC);
-        
-        Value return_value;
-        return_value.SetValueType (Value::eValueTypeScalar);
-        //return_value.SetContext (Value::eContextTypeClangType, clang_uint32_t_type);
-        return_value.SetCompilerType(clang_uint32_t_type);
-        return_value.GetScalar() = 0;
-
-        diagnostics.Clear();
-
-        // Run the function
-        ExpressionResults results = get_shared_cache_class_info_function->ExecuteFunction(
-            exe_ctx, &m_get_shared_cache_class_info_args, options, diagnostics, return_value);
-
-        if (results == eExpressionCompleted)
-        {
-            // The result is the number of ClassInfo structures that were filled in
-            num_class_infos = return_value.GetScalar().ULong();
-            if (log)
-                log->Printf("Discovered %u ObjC classes in shared cache\n",num_class_infos);
+    // Run the function
+    ExpressionResults results =
+        get_shared_cache_class_info_function->ExecuteFunction(
+            exe_ctx, &m_get_shared_cache_class_info_args, options, diagnostics,
+            return_value);
+
+    if (results == eExpressionCompleted) {
+      // The result is the number of ClassInfo structures that were filled in
+      num_class_infos = return_value.GetScalar().ULong();
+      if (log)
+        log->Printf("Discovered %u ObjC classes in shared cache\n",
+                    num_class_infos);
 #ifdef LLDB_CONFIGURATION_DEBUG
-            assert (num_class_infos <= num_classes);
+      assert(num_class_infos <= num_classes);
 #endif
-            if (num_class_infos > 0)
-            {
-                if (num_class_infos > num_classes)
-                {
-                    num_class_infos = num_classes;
-                    
-                    success = false;
-                }
-                else
-                {
-                    success = true;
-                }
-                
-                // Read the ClassInfo structures
-                DataBufferHeap buffer (num_class_infos * class_info_byte_size, 0);
-                if (process->ReadMemory(class_infos_addr,
-                                        buffer.GetBytes(),
-                                        buffer.GetByteSize(),
-                                        err) == buffer.GetByteSize())
-                {
-                    DataExtractor class_infos_data (buffer.GetBytes(),
-                                                    buffer.GetByteSize(),
-                                                    process->GetByteOrder(),
-                                                    addr_size);
+      if (num_class_infos > 0) {
+        if (num_class_infos > num_classes) {
+          num_class_infos = num_classes;
 
-                    ParseClassInfoArray (class_infos_data, num_class_infos);
-                }
-            }
-            else
-            {
-                success = true;
-            }
+          success = false;
+        } else {
+          success = true;
         }
-        else
-        {
-            if (log)
-            {
-                log->Printf("Error evaluating our find class name function.");
-                diagnostics.Dump(log);
-            }
+
+        // Read the ClassInfo structures
+        DataBufferHeap buffer(num_class_infos * class_info_byte_size, 0);
+        if (process->ReadMemory(class_infos_addr, buffer.GetBytes(),
+                                buffer.GetByteSize(),
+                                err) == buffer.GetByteSize()) {
+          DataExtractor class_infos_data(buffer.GetBytes(),
+                                         buffer.GetByteSize(),
+                                         process->GetByteOrder(), addr_size);
+
+          ParseClassInfoArray(class_infos_data, num_class_infos);
         }
+      } else {
+        success = true;
+      }
+    } else {
+      if (log) {
+        log->Printf("Error evaluating our find class name function.");
+        diagnostics.Dump(log);
+      }
     }
-    else
-    {
-        if (log)
-        {
-            log->Printf("Error writing function arguments.");
-            diagnostics.Dump(log);
-        }
+  } else {
+    if (log) {
+      log->Printf("Error writing function arguments.");
+      diagnostics.Dump(log);
     }
+  }
 
-    // Deallocate the memory we allocated for the ClassInfo array
-    process->DeallocateMemory(class_infos_addr);
-    
-    return DescriptorMapUpdateResult(success, num_class_infos);
+  // Deallocate the memory we allocated for the ClassInfo array
+  process->DeallocateMemory(class_infos_addr);
+
+  return DescriptorMapUpdateResult(success, num_class_infos);
 }
 
-bool
-AppleObjCRuntimeV2::UpdateISAToDescriptorMapFromMemory (RemoteNXMapTable &hash_table)
-{
-    Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
-    
-    Process *process = GetProcess();
+bool AppleObjCRuntimeV2::UpdateISAToDescriptorMapFromMemory(
+    RemoteNXMapTable &hash_table) {
+  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
 
-    if (process == NULL)
-        return false;
-    
-    uint32_t num_map_table_isas = 0;
-    
-    ModuleSP objc_module_sp(GetObjCModule());
-    
-    if (objc_module_sp)
-    {
-        for (RemoteNXMapTable::element elt : hash_table)
-        {
-            ++num_map_table_isas;
-            
-            if (ISAIsCached(elt.second))
-                continue;
-            
-            ClassDescriptorSP descriptor_sp = ClassDescriptorSP(new ClassDescriptorV2(*this, elt.second, elt.first.AsCString()));
-            
-            if (log && log->GetVerbose())
-                log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%" PRIx64 " (%s) from dynamic table to isa->descriptor cache", elt.second, elt.first.AsCString());
-            
-            AddClass (elt.second, descriptor_sp, elt.first.AsCString());
-        }
-    }
-    
-    return num_map_table_isas > 0;
-}
+  Process *process = GetProcess();
 
-lldb::addr_t
-AppleObjCRuntimeV2::GetSharedCacheReadOnlyAddress()
-{
-    Process *process = GetProcess();
-    
-    if (process)
-    {
-        ModuleSP objc_module_sp(GetObjCModule());
-        
-        if (objc_module_sp)
-        {
-            ObjectFile *objc_object = objc_module_sp->GetObjectFile();
-            
-            if (objc_object)
-            {
-                SectionList *section_list = objc_module_sp->GetSectionList();
-                
-                if (section_list)
-                {
-                    SectionSP text_segment_sp (section_list->FindSectionByName(ConstString("__TEXT")));
-                    
-                    if (text_segment_sp)
-                    {
-                        SectionSP objc_opt_section_sp (text_segment_sp->GetChildren().FindSectionByName(ConstString("__objc_opt_ro")));
-                        
-                        if (objc_opt_section_sp)
-                        {
-                            return objc_opt_section_sp->GetLoadBaseAddress(&process->GetTarget());
-                        }
-                    }
-                }
-            }
-        }
-    }
-    return LLDB_INVALID_ADDRESS;
-}
+  if (process == NULL)
+    return false;
 
-void
-AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded()
-{
-    Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
+  uint32_t num_map_table_isas = 0;
 
-    Timer scoped_timer (LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
-    
-    // Else we need to check with our process to see when the map was updated.
-    Process *process = GetProcess();
+  ModuleSP objc_module_sp(GetObjCModule());
 
-    if (process)
-    {
-        RemoteNXMapTable hash_table;
-        
-        // Update the process stop ID that indicates the last time we updated the
-        // map, whether it was successful or not.
-        m_isa_to_descriptor_stop_id = process->GetStopID();
-        
-        if (!m_hash_signature.NeedsUpdate(process, this, hash_table))
-            return;
-        
-        m_hash_signature.UpdateSignature (hash_table);
-
-        // Grab the dynamically loaded objc classes from the hash table in memory
-        DescriptorMapUpdateResult dynamic_update_result = UpdateISAToDescriptorMapDynamic(hash_table);
-
-        // Now get the objc classes that are baked into the Objective C runtime
-        // in the shared cache, but only once per process as this data never
-        // changes
-        if (!m_loaded_objc_opt)
-        {
-            // it is legitimately possible for the shared cache to be empty - in that case, the dynamic hash table
-            // will contain all the class information we need; the situation we're trying to detect is one where
-            // we aren't seeing class information from the runtime - in order to detect that vs. just the shared cache
-            // being empty or sparsely populated, we set an arbitrary (very low) threshold for the number of classes
-            // that we want to see in a "good" scenario - anything below that is suspicious (Foundation alone has thousands
-            // of classes)
-            const uint32_t num_classes_to_warn_at = 500;
-            
-            DescriptorMapUpdateResult shared_cache_update_result = UpdateISAToDescriptorMapSharedCache();
-            
-            if (log)
-                log->Printf("attempted to read objc class data - results: [dynamic_update]: ran: %s, count: %" PRIu32 " [shared_cache_update]: ran: %s, count: %" PRIu32,
-                            dynamic_update_result.m_update_ran ? "yes" : "no",
-                            dynamic_update_result.m_num_found,
-                            shared_cache_update_result.m_update_ran ? "yes" : "no",
-                            shared_cache_update_result.m_num_found);
-            
-            // warn if:
-            // - we could not run either expression
-            // - we found fewer than num_classes_to_warn_at classes total
-            if ((false == shared_cache_update_result.m_update_ran) || (false == dynamic_update_result.m_update_ran))
-                WarnIfNoClassesCached(SharedCacheWarningReason::eExpressionExecutionFailure);
-            else if (dynamic_update_result.m_num_found + shared_cache_update_result.m_num_found < num_classes_to_warn_at)
-                WarnIfNoClassesCached(SharedCacheWarningReason::eNotEnoughClassesRead);
-            else
-                m_loaded_objc_opt = true;
-        }
-    }
-    else
-    {
-        m_isa_to_descriptor_stop_id = UINT32_MAX;
-    }
-}
+  if (objc_module_sp) {
+    for (RemoteNXMapTable::element elt : hash_table) {
+      ++num_map_table_isas;
 
-static bool
-DoesProcessHaveSharedCache (Process& process)
-{
-    PlatformSP platform_sp = process.GetTarget().GetPlatform();
-    if (!platform_sp)
-        return true; // this should not happen
-    
-    ConstString platform_plugin_name = platform_sp->GetPluginName();
-    if (platform_plugin_name)
-    {
-        llvm::StringRef platform_plugin_name_sr = platform_plugin_name.GetStringRef();
-        if (platform_plugin_name_sr.endswith("-simulator"))
-            return false;
+      if (ISAIsCached(elt.second))
+        continue;
+
+      ClassDescriptorSP descriptor_sp = ClassDescriptorSP(
+          new ClassDescriptorV2(*this, elt.second, elt.first.AsCString()));
+
+      if (log && log->GetVerbose())
+        log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%" PRIx64
+                    " (%s) from dynamic table to isa->descriptor cache",
+                    elt.second, elt.first.AsCString());
+
+      AddClass(elt.second, descriptor_sp, elt.first.AsCString());
     }
-    
-    return true;
+  }
+
+  return num_map_table_isas > 0;
 }
 
-void
-AppleObjCRuntimeV2::WarnIfNoClassesCached (SharedCacheWarningReason reason)
-{
-    if (m_noclasses_warning_emitted)
-        return;
+lldb::addr_t AppleObjCRuntimeV2::GetSharedCacheReadOnlyAddress() {
+  Process *process = GetProcess();
 
-    if (GetProcess() && !DoesProcessHaveSharedCache(*GetProcess()))
-    {
-        // Simulators do not have the objc_opt_ro class table so don't actually complain to the user
-        m_noclasses_warning_emitted = true;
-        return;
-    }
+  if (process) {
+    ModuleSP objc_module_sp(GetObjCModule());
 
-    Debugger &debugger(GetProcess()->GetTarget().GetDebugger());
-    if (auto stream = debugger.GetAsyncOutputStream())
-    {
-        switch (reason)
-        {
-            case SharedCacheWarningReason::eNotEnoughClassesRead:
-                stream->PutCString("warning: could not find Objective-C class data in the process. This may reduce the quality of type information available.\n");
-                m_noclasses_warning_emitted = true;
-                break;
-            case SharedCacheWarningReason::eExpressionExecutionFailure:
-                stream->PutCString("warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.\n");
-                m_noclasses_warning_emitted = true;
-                break;
-            default:
-                break;
-        }
+    if (objc_module_sp) {
+      ObjectFile *objc_object = objc_module_sp->GetObjectFile();
+
+      if (objc_object) {
+        SectionList *section_list = objc_module_sp->GetSectionList();
+
+        if (section_list) {
+          SectionSP text_segment_sp(
+              section_list->FindSectionByName(ConstString("__TEXT")));
+
+          if (text_segment_sp) {
+            SectionSP objc_opt_section_sp(
+                text_segment_sp->GetChildren().FindSectionByName(
+                    ConstString("__objc_opt_ro")));
+
+            if (objc_opt_section_sp) {
+              return objc_opt_section_sp->GetLoadBaseAddress(
+                  &process->GetTarget());
+            }
+          }
+        }
+      }
+    }
+  }
+  return LLDB_INVALID_ADDRESS;
+}
+
+void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() {
+  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
+
+  Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
+
+  // Else we need to check with our process to see when the map was updated.
+  Process *process = GetProcess();
+
+  if (process) {
+    RemoteNXMapTable hash_table;
+
+    // Update the process stop ID that indicates the last time we updated the
+    // map, whether it was successful or not.
+    m_isa_to_descriptor_stop_id = process->GetStopID();
+
+    if (!m_hash_signature.NeedsUpdate(process, this, hash_table))
+      return;
+
+    m_hash_signature.UpdateSignature(hash_table);
+
+    // Grab the dynamically loaded objc classes from the hash table in memory
+    DescriptorMapUpdateResult dynamic_update_result =
+        UpdateISAToDescriptorMapDynamic(hash_table);
+
+    // Now get the objc classes that are baked into the Objective C runtime
+    // in the shared cache, but only once per process as this data never
+    // changes
+    if (!m_loaded_objc_opt) {
+      // it is legitimately possible for the shared cache to be empty - in that
+      // case, the dynamic hash table
+      // will contain all the class information we need; the situation we're
+      // trying to detect is one where
+      // we aren't seeing class information from the runtime - in order to
+      // detect that vs. just the shared cache
+      // being empty or sparsely populated, we set an arbitrary (very low)
+      // threshold for the number of classes
+      // that we want to see in a "good" scenario - anything below that is
+      // suspicious (Foundation alone has thousands
+      // of classes)
+      const uint32_t num_classes_to_warn_at = 500;
+
+      DescriptorMapUpdateResult shared_cache_update_result =
+          UpdateISAToDescriptorMapSharedCache();
+
+      if (log)
+        log->Printf("attempted to read objc class data - results: "
+                    "[dynamic_update]: ran: %s, count: %" PRIu32
+                    " [shared_cache_update]: ran: %s, count: %" PRIu32,
+                    dynamic_update_result.m_update_ran ? "yes" : "no",
+                    dynamic_update_result.m_num_found,
+                    shared_cache_update_result.m_update_ran ? "yes" : "no",
+                    shared_cache_update_result.m_num_found);
+
+      // warn if:
+      // - we could not run either expression
+      // - we found fewer than num_classes_to_warn_at classes total
+      if ((false == shared_cache_update_result.m_update_ran) ||
+          (false == dynamic_update_result.m_update_ran))
+        WarnIfNoClassesCached(
+            SharedCacheWarningReason::eExpressionExecutionFailure);
+      else if (dynamic_update_result.m_num_found +
+                   shared_cache_update_result.m_num_found <
+               num_classes_to_warn_at)
+        WarnIfNoClassesCached(SharedCacheWarningReason::eNotEnoughClassesRead);
+      else
+        m_loaded_objc_opt = true;
+    }
+  } else {
+    m_isa_to_descriptor_stop_id = UINT32_MAX;
+  }
+}
+
+static bool DoesProcessHaveSharedCache(Process &process) {
+  PlatformSP platform_sp = process.GetTarget().GetPlatform();
+  if (!platform_sp)
+    return true; // this should not happen
+
+  ConstString platform_plugin_name = platform_sp->GetPluginName();
+  if (platform_plugin_name) {
+    llvm::StringRef platform_plugin_name_sr =
+        platform_plugin_name.GetStringRef();
+    if (platform_plugin_name_sr.endswith("-simulator"))
+      return false;
+  }
+
+  return true;
+}
+
+void AppleObjCRuntimeV2::WarnIfNoClassesCached(
+    SharedCacheWarningReason reason) {
+  if (m_noclasses_warning_emitted)
+    return;
+
+  if (GetProcess() && !DoesProcessHaveSharedCache(*GetProcess())) {
+    // Simulators do not have the objc_opt_ro class table so don't actually
+    // complain to the user
+    m_noclasses_warning_emitted = true;
+    return;
+  }
+
+  Debugger &debugger(GetProcess()->GetTarget().GetDebugger());
+  if (auto stream = debugger.GetAsyncOutputStream()) {
+    switch (reason) {
+    case SharedCacheWarningReason::eNotEnoughClassesRead:
+      stream->PutCString("warning: could not find Objective-C class data in "
+                         "the process. This may reduce the quality of type "
+                         "information available.\n");
+      m_noclasses_warning_emitted = true;
+      break;
+    case SharedCacheWarningReason::eExpressionExecutionFailure:
+      stream->PutCString("warning: could not execute support code to read "
+                         "Objective-C class data in the process. This may "
+                         "reduce the quality of type information available.\n");
+      m_noclasses_warning_emitted = true;
+      break;
+    default:
+      break;
     }
+  }
 }
 
 // TODO: should we have a transparent_kvo parameter here to say if we
 // want to replace the KVO swizzled class with the actual user-level type?
 ConstString
-AppleObjCRuntimeV2::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa)
-{
-    if (isa == g_objc_Tagged_ISA)
-    {
-        static const ConstString g_objc_tagged_isa_name ("_lldb_Tagged_ObjC_ISA");
-        return g_objc_tagged_isa_name;
-    }
-    if (isa == g_objc_Tagged_ISA_NSAtom)
-    {
-        static const ConstString g_objc_tagged_isa_nsatom_name ("NSAtom");
-        return g_objc_tagged_isa_nsatom_name;
-    }
-    if (isa == g_objc_Tagged_ISA_NSNumber)
-    {
-        static const ConstString g_objc_tagged_isa_nsnumber_name ("NSNumber");
-        return g_objc_tagged_isa_nsnumber_name;
-    }
-    if (isa == g_objc_Tagged_ISA_NSDateTS)
-    {
-        static const ConstString g_objc_tagged_isa_nsdatets_name ("NSDateTS");
-        return g_objc_tagged_isa_nsdatets_name;
-    }
-    if (isa == g_objc_Tagged_ISA_NSManagedObject)
-    {
-        static const ConstString g_objc_tagged_isa_nsmanagedobject_name ("NSManagedObject");
-        return g_objc_tagged_isa_nsmanagedobject_name;
-    }
-    if (isa == g_objc_Tagged_ISA_NSDate)
-    {
-        static const ConstString g_objc_tagged_isa_nsdate_name ("NSDate");
-        return g_objc_tagged_isa_nsdate_name;
-    }
-    return ObjCLanguageRuntime::GetActualTypeName(isa);
-}
-
-DeclVendor *
-AppleObjCRuntimeV2::GetDeclVendor()
-{
-    if (!m_decl_vendor_ap.get())
-        m_decl_vendor_ap.reset(new AppleObjCDeclVendor(*this));
-    
-    return m_decl_vendor_ap.get();
-}
-
-lldb::addr_t
-AppleObjCRuntimeV2::LookupRuntimeSymbol (const ConstString &name)
-{
-    lldb::addr_t ret = LLDB_INVALID_ADDRESS;
-
-    const char *name_cstr = name.AsCString();    
-    
-    if (name_cstr)
-    {
-        llvm::StringRef name_strref(name_cstr);
-        
-        static const llvm::StringRef ivar_prefix("OBJC_IVAR_$_");
-        static const llvm::StringRef class_prefix("OBJC_CLASS_$_");
-        
-        if (name_strref.startswith(ivar_prefix))
-        {
-            llvm::StringRef ivar_skipped_prefix = name_strref.substr(ivar_prefix.size());
-            std::pair<llvm::StringRef, llvm::StringRef> class_and_ivar = ivar_skipped_prefix.split('.');
-            
-            if (class_and_ivar.first.size() && class_and_ivar.second.size())
-            {
-                const ConstString class_name_cs(class_and_ivar.first);
-                ClassDescriptorSP descriptor = ObjCLanguageRuntime::GetClassDescriptorFromClassName(class_name_cs);
-                                
-                if (descriptor)
-                {
-                    const ConstString ivar_name_cs(class_and_ivar.second);
-                    const char *ivar_name_cstr = ivar_name_cs.AsCString();
-                    
-                    auto ivar_func = [&ret, ivar_name_cstr](const char *name, const char *type, lldb::addr_t offset_addr, uint64_t size) -> lldb::addr_t
-                    {
-                        if (!strcmp(name, ivar_name_cstr))
-                        {
-                            ret = offset_addr;
-                            return true;
-                        }
-                        return false;
-                    };
-
-                    descriptor->Describe(std::function<void (ObjCISA)>(nullptr),
-                                         std::function<bool (const char *, const char *)>(nullptr),
-                                         std::function<bool (const char *, const char *)>(nullptr),
-                                         ivar_func);
-                }
+AppleObjCRuntimeV2::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa) {
+  if (isa == g_objc_Tagged_ISA) {
+    static const ConstString g_objc_tagged_isa_name("_lldb_Tagged_ObjC_ISA");
+    return g_objc_tagged_isa_name;
+  }
+  if (isa == g_objc_Tagged_ISA_NSAtom) {
+    static const ConstString g_objc_tagged_isa_nsatom_name("NSAtom");
+    return g_objc_tagged_isa_nsatom_name;
+  }
+  if (isa == g_objc_Tagged_ISA_NSNumber) {
+    static const ConstString g_objc_tagged_isa_nsnumber_name("NSNumber");
+    return g_objc_tagged_isa_nsnumber_name;
+  }
+  if (isa == g_objc_Tagged_ISA_NSDateTS) {
+    static const ConstString g_objc_tagged_isa_nsdatets_name("NSDateTS");
+    return g_objc_tagged_isa_nsdatets_name;
+  }
+  if (isa == g_objc_Tagged_ISA_NSManagedObject) {
+    static const ConstString g_objc_tagged_isa_nsmanagedobject_name(
+        "NSManagedObject");
+    return g_objc_tagged_isa_nsmanagedobject_name;
+  }
+  if (isa == g_objc_Tagged_ISA_NSDate) {
+    static const ConstString g_objc_tagged_isa_nsdate_name("NSDate");
+    return g_objc_tagged_isa_nsdate_name;
+  }
+  return ObjCLanguageRuntime::GetActualTypeName(isa);
+}
+
+DeclVendor *AppleObjCRuntimeV2::GetDeclVendor() {
+  if (!m_decl_vendor_ap.get())
+    m_decl_vendor_ap.reset(new AppleObjCDeclVendor(*this));
+
+  return m_decl_vendor_ap.get();
+}
+
+lldb::addr_t AppleObjCRuntimeV2::LookupRuntimeSymbol(const ConstString &name) {
+  lldb::addr_t ret = LLDB_INVALID_ADDRESS;
+
+  const char *name_cstr = name.AsCString();
+
+  if (name_cstr) {
+    llvm::StringRef name_strref(name_cstr);
+
+    static const llvm::StringRef ivar_prefix("OBJC_IVAR_$_");
+    static const llvm::StringRef class_prefix("OBJC_CLASS_$_");
+
+    if (name_strref.startswith(ivar_prefix)) {
+      llvm::StringRef ivar_skipped_prefix =
+          name_strref.substr(ivar_prefix.size());
+      std::pair<llvm::StringRef, llvm::StringRef> class_and_ivar =
+          ivar_skipped_prefix.split('.');
+
+      if (class_and_ivar.first.size() && class_and_ivar.second.size()) {
+        const ConstString class_name_cs(class_and_ivar.first);
+        ClassDescriptorSP descriptor =
+            ObjCLanguageRuntime::GetClassDescriptorFromClassName(class_name_cs);
+
+        if (descriptor) {
+          const ConstString ivar_name_cs(class_and_ivar.second);
+          const char *ivar_name_cstr = ivar_name_cs.AsCString();
+
+          auto ivar_func = [&ret, ivar_name_cstr](
+              const char *name, const char *type, lldb::addr_t offset_addr,
+              uint64_t size) -> lldb::addr_t {
+            if (!strcmp(name, ivar_name_cstr)) {
+              ret = offset_addr;
+              return true;
             }
-        }
-        else if (name_strref.startswith(class_prefix))
-        {
-            llvm::StringRef class_skipped_prefix = name_strref.substr(class_prefix.size());
-            const ConstString class_name_cs(class_skipped_prefix);
-            ClassDescriptorSP descriptor = GetClassDescriptorFromClassName(class_name_cs);
-            
-            if (descriptor)
-                ret = descriptor->GetISA();
-        }
-    }
-    
-    return ret;
-}
+            return false;
+          };
 
-AppleObjCRuntimeV2::NonPointerISACache*
-AppleObjCRuntimeV2::NonPointerISACache::CreateInstance (AppleObjCRuntimeV2& runtime, const lldb::ModuleSP& objc_module_sp)
-{
-    Process* process(runtime.GetProcess());
-    
-    Error error;
-    
-    auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol(process,
-                                                                ConstString("objc_debug_isa_magic_mask"),
-                                                                objc_module_sp,
-                                                                error);
+          descriptor->Describe(
+              std::function<void(ObjCISA)>(nullptr),
+              std::function<bool(const char *, const char *)>(nullptr),
+              std::function<bool(const char *, const char *)>(nullptr),
+              ivar_func);
+        }
+      }
+    } else if (name_strref.startswith(class_prefix)) {
+      llvm::StringRef class_skipped_prefix =
+          name_strref.substr(class_prefix.size());
+      const ConstString class_name_cs(class_skipped_prefix);
+      ClassDescriptorSP descriptor =
+          GetClassDescriptorFromClassName(class_name_cs);
+
+      if (descriptor)
+        ret = descriptor->GetISA();
+    }
+  }
+
+  return ret;
+}
+
+AppleObjCRuntimeV2::NonPointerISACache *
+AppleObjCRuntimeV2::NonPointerISACache::CreateInstance(
+    AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp) {
+  Process *process(runtime.GetProcess());
+
+  Error error;
+
+  auto objc_debug_isa_magic_mask = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_isa_magic_mask"), objc_module_sp, error);
+  if (error.Fail())
+    return NULL;
+
+  auto objc_debug_isa_magic_value = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_isa_magic_value"), objc_module_sp,
+      error);
+  if (error.Fail())
+    return NULL;
+
+  auto objc_debug_isa_class_mask = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_isa_class_mask"), objc_module_sp, error);
+  if (error.Fail())
+    return NULL;
+
+  // we might want to have some rules to outlaw these other values (e.g if the
+  // mask is zero but the value is non-zero, ...)
+
+  return new NonPointerISACache(runtime, objc_debug_isa_class_mask,
+                                objc_debug_isa_magic_mask,
+                                objc_debug_isa_magic_value);
+}
+
+AppleObjCRuntimeV2::TaggedPointerVendorV2 *
+AppleObjCRuntimeV2::TaggedPointerVendorV2::CreateInstance(
+    AppleObjCRuntimeV2 &runtime, const lldb::ModuleSP &objc_module_sp) {
+  Process *process(runtime.GetProcess());
+
+  Error error;
+
+  auto objc_debug_taggedpointer_mask = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_taggedpointer_mask"), objc_module_sp,
+      error);
+  if (error.Fail())
+    return new TaggedPointerVendorLegacy(runtime);
+
+  auto objc_debug_taggedpointer_slot_shift = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_taggedpointer_slot_shift"),
+      objc_module_sp, error, true, 4);
+  if (error.Fail())
+    return new TaggedPointerVendorLegacy(runtime);
+
+  auto objc_debug_taggedpointer_slot_mask = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_taggedpointer_slot_mask"),
+      objc_module_sp, error, true, 4);
+  if (error.Fail())
+    return new TaggedPointerVendorLegacy(runtime);
+
+  auto objc_debug_taggedpointer_payload_lshift = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_taggedpointer_payload_lshift"),
+      objc_module_sp, error, true, 4);
+  if (error.Fail())
+    return new TaggedPointerVendorLegacy(runtime);
+
+  auto objc_debug_taggedpointer_payload_rshift = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_taggedpointer_payload_rshift"),
+      objc_module_sp, error, true, 4);
+  if (error.Fail())
+    return new TaggedPointerVendorLegacy(runtime);
+
+  auto objc_debug_taggedpointer_classes = ExtractRuntimeGlobalSymbol(
+      process, ConstString("objc_debug_taggedpointer_classes"), objc_module_sp,
+      error, false);
+  if (error.Fail())
+    return new TaggedPointerVendorLegacy(runtime);
+
+  // try to detect the "extended tagged pointer" variables - if any are missing,
+  // use the non-extended vendor
+  do {
+    auto objc_debug_taggedpointer_ext_mask = ExtractRuntimeGlobalSymbol(
+        process, ConstString("objc_debug_taggedpointer_ext_mask"),
+        objc_module_sp, error);
     if (error.Fail())
-        return NULL;
+      break;
 
-    auto objc_debug_isa_magic_value = ExtractRuntimeGlobalSymbol(process,
-                                                                 ConstString("objc_debug_isa_magic_value"),
-                                                                 objc_module_sp,
-                                                                 error);
+    auto objc_debug_taggedpointer_ext_slot_shift = ExtractRuntimeGlobalSymbol(
+        process, ConstString("objc_debug_taggedpointer_ext_slot_shift"),
+        objc_module_sp, error, true, 4);
     if (error.Fail())
-        return NULL;
+      break;
 
-    auto objc_debug_isa_class_mask = ExtractRuntimeGlobalSymbol(process,
-                                                                ConstString("objc_debug_isa_class_mask"),
-                                                                objc_module_sp,
-                                                                error);
+    auto objc_debug_taggedpointer_ext_slot_mask = ExtractRuntimeGlobalSymbol(
+        process, ConstString("objc_debug_taggedpointer_ext_slot_mask"),
+        objc_module_sp, error, true, 4);
     if (error.Fail())
-        return NULL;
-
-    // we might want to have some rules to outlaw these other values (e.g if the mask is zero but the value is non-zero, ...)
-    
-    return new NonPointerISACache(runtime,
-                                  objc_debug_isa_class_mask,
-                                  objc_debug_isa_magic_mask,
-                                  objc_debug_isa_magic_value);
-}
+      break;
 
-AppleObjCRuntimeV2::TaggedPointerVendorV2*
-AppleObjCRuntimeV2::TaggedPointerVendorV2::CreateInstance (AppleObjCRuntimeV2& runtime, const lldb::ModuleSP& objc_module_sp)
-{
-    Process* process(runtime.GetProcess());
-    
-    Error error;
-    
-    auto objc_debug_taggedpointer_mask = ExtractRuntimeGlobalSymbol(process,
-                                                                    ConstString("objc_debug_taggedpointer_mask"),
-                                                                    objc_module_sp,
-                                                                    error);
-    if (error.Fail())
-        return new TaggedPointerVendorLegacy(runtime);
-    
-    auto objc_debug_taggedpointer_slot_shift = ExtractRuntimeGlobalSymbol(process,
-                                                                          ConstString("objc_debug_taggedpointer_slot_shift"),
-                                                                          objc_module_sp,
-                                                                          error,
-                                                                          true,
-                                                                          4);
+    auto objc_debug_taggedpointer_ext_classes = ExtractRuntimeGlobalSymbol(
+        process, ConstString("objc_debug_taggedpointer_ext_classes"),
+        objc_module_sp, error, false);
     if (error.Fail())
-        return new TaggedPointerVendorLegacy(runtime);
-    
-    auto objc_debug_taggedpointer_slot_mask = ExtractRuntimeGlobalSymbol(process,
-                                                                          ConstString("objc_debug_taggedpointer_slot_mask"),
-                                                                          objc_module_sp,
-                                                                          error,
-                                                                          true,
-                                                                          4);
-    if (error.Fail())
-        return new TaggedPointerVendorLegacy(runtime);
+      break;
 
-    auto objc_debug_taggedpointer_payload_lshift = ExtractRuntimeGlobalSymbol(process,
-                                                                              ConstString("objc_debug_taggedpointer_payload_lshift"),
-                                                                              objc_module_sp,
-                                                                              error,
-                                                                              true,
-                                                                              4);
-    if (error.Fail())
-        return new TaggedPointerVendorLegacy(runtime);
-    
-    auto objc_debug_taggedpointer_payload_rshift = ExtractRuntimeGlobalSymbol(process,
-                                                                              ConstString("objc_debug_taggedpointer_payload_rshift"),
-                                                                              objc_module_sp,
-                                                                              error,
-                                                                              true,
-                                                                              4);
+    auto objc_debug_taggedpointer_ext_payload_lshift =
+        ExtractRuntimeGlobalSymbol(
+            process, ConstString("objc_debug_taggedpointer_ext_payload_lshift"),
+            objc_module_sp, error, true, 4);
     if (error.Fail())
-        return new TaggedPointerVendorLegacy(runtime);
-    
-    auto objc_debug_taggedpointer_classes = ExtractRuntimeGlobalSymbol(process,
-                                                                       ConstString("objc_debug_taggedpointer_classes"),
-                                                                       objc_module_sp,
-                                                                       error,
-                                                                       false);
+      break;
+
+    auto objc_debug_taggedpointer_ext_payload_rshift =
+        ExtractRuntimeGlobalSymbol(
+            process, ConstString("objc_debug_taggedpointer_ext_payload_rshift"),
+            objc_module_sp, error, true, 4);
     if (error.Fail())
-        return new TaggedPointerVendorLegacy(runtime);
+      break;
 
-    // try to detect the "extended tagged pointer" variables - if any are missing, use the non-extended vendor
-    do
-    {
-        auto objc_debug_taggedpointer_ext_mask = ExtractRuntimeGlobalSymbol(process,
-                                                                            ConstString("objc_debug_taggedpointer_ext_mask"),
-                                                                            objc_module_sp,
-                                                                            error);
-        if (error.Fail())
-            break;
-        
-        auto objc_debug_taggedpointer_ext_slot_shift = ExtractRuntimeGlobalSymbol(process,
-                                                                                  ConstString("objc_debug_taggedpointer_ext_slot_shift"),
-                                                                                  objc_module_sp,
-                                                                                  error,
-                                                                                  true,
-                                                                                  4);
-        if (error.Fail())
-            break;
-        
-        auto objc_debug_taggedpointer_ext_slot_mask = ExtractRuntimeGlobalSymbol(process,
-                                                                                 ConstString("objc_debug_taggedpointer_ext_slot_mask"),
-                                                                                 objc_module_sp,
-                                                                                 error,
-                                                                                 true,
-                                                                                 4);
-        if (error.Fail())
-            break;
-        
-        auto objc_debug_taggedpointer_ext_classes = ExtractRuntimeGlobalSymbol(process,
-                                                                               ConstString("objc_debug_taggedpointer_ext_classes"),
-                                                                               objc_module_sp,
-                                                                               error,
-                                                                               false);
-        if (error.Fail())
-            break;
-        
-        auto objc_debug_taggedpointer_ext_payload_lshift = ExtractRuntimeGlobalSymbol(process,
-                                                                                      ConstString("objc_debug_taggedpointer_ext_payload_lshift"),
-                                                                                      objc_module_sp,
-                                                                                      error,
-                                                                                      true,
-                                                                                      4);
-        if (error.Fail())
-            break;
-        
-        auto objc_debug_taggedpointer_ext_payload_rshift = ExtractRuntimeGlobalSymbol(process,
-                                                                                      ConstString("objc_debug_taggedpointer_ext_payload_rshift"),
-                                                                                      objc_module_sp,
-                                                                                      error,
-                                                                                      true,
-                                                                                      4);
-        if (error.Fail())
-            break;
-        
-        return new TaggedPointerVendorExtended(runtime,
-                                               objc_debug_taggedpointer_mask,
-                                               objc_debug_taggedpointer_ext_mask,
-                                               objc_debug_taggedpointer_slot_shift,
-                                               objc_debug_taggedpointer_ext_slot_shift,
-                                               objc_debug_taggedpointer_slot_mask,
-                                               objc_debug_taggedpointer_ext_slot_mask,
-                                               objc_debug_taggedpointer_payload_lshift,
-                                               objc_debug_taggedpointer_payload_rshift,
-                                               objc_debug_taggedpointer_ext_payload_lshift,
-                                               objc_debug_taggedpointer_ext_payload_rshift,
-                                               objc_debug_taggedpointer_classes,
-                                               objc_debug_taggedpointer_ext_classes);
-    } while(false);
-    
-    // we might want to have some rules to outlaw these values (e.g if the table's address is zero)
-    
-    return new TaggedPointerVendorRuntimeAssisted(runtime,
-                                                  objc_debug_taggedpointer_mask,
-                                                  objc_debug_taggedpointer_slot_shift,
-                                                  objc_debug_taggedpointer_slot_mask,
-                                                  objc_debug_taggedpointer_payload_lshift,
-                                                  objc_debug_taggedpointer_payload_rshift,
-                                                  objc_debug_taggedpointer_classes);
+    return new TaggedPointerVendorExtended(
+        runtime, objc_debug_taggedpointer_mask,
+        objc_debug_taggedpointer_ext_mask, objc_debug_taggedpointer_slot_shift,
+        objc_debug_taggedpointer_ext_slot_shift,
+        objc_debug_taggedpointer_slot_mask,
+        objc_debug_taggedpointer_ext_slot_mask,
+        objc_debug_taggedpointer_payload_lshift,
+        objc_debug_taggedpointer_payload_rshift,
+        objc_debug_taggedpointer_ext_payload_lshift,
+        objc_debug_taggedpointer_ext_payload_rshift,
+        objc_debug_taggedpointer_classes, objc_debug_taggedpointer_ext_classes);
+  } while (false);
+
+  // we might want to have some rules to outlaw these values (e.g if the table's
+  // address is zero)
+
+  return new TaggedPointerVendorRuntimeAssisted(
+      runtime, objc_debug_taggedpointer_mask,
+      objc_debug_taggedpointer_slot_shift, objc_debug_taggedpointer_slot_mask,
+      objc_debug_taggedpointer_payload_lshift,
+      objc_debug_taggedpointer_payload_rshift,
+      objc_debug_taggedpointer_classes);
+}
+
+bool AppleObjCRuntimeV2::TaggedPointerVendorLegacy::IsPossibleTaggedPointer(
+    lldb::addr_t ptr) {
+  return (ptr & 1);
 }
 
-bool
-AppleObjCRuntimeV2::TaggedPointerVendorLegacy::IsPossibleTaggedPointer (lldb::addr_t ptr)
-{
-    return (ptr & 1);
+ObjCLanguageRuntime::ClassDescriptorSP
+AppleObjCRuntimeV2::TaggedPointerVendorLegacy::GetClassDescriptor(
+    lldb::addr_t ptr) {
+  if (!IsPossibleTaggedPointer(ptr))
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+
+  uint32_t foundation_version = m_runtime.GetFoundationVersion();
+
+  if (foundation_version == LLDB_INVALID_MODULE_VERSION)
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+
+  uint64_t class_bits = (ptr & 0xE) >> 1;
+  ConstString name;
+
+  // TODO: make a table
+  if (foundation_version >= 900) {
+    switch (class_bits) {
+    case 0:
+      name = ConstString("NSAtom");
+      break;
+    case 3:
+      name = ConstString("NSNumber");
+      break;
+    case 4:
+      name = ConstString("NSDateTS");
+      break;
+    case 5:
+      name = ConstString("NSManagedObject");
+      break;
+    case 6:
+      name = ConstString("NSDate");
+      break;
+    default:
+      return ObjCLanguageRuntime::ClassDescriptorSP();
+    }
+  } else {
+    switch (class_bits) {
+    case 1:
+      name = ConstString("NSNumber");
+      break;
+    case 5:
+      name = ConstString("NSManagedObject");
+      break;
+    case 6:
+      name = ConstString("NSDate");
+      break;
+    case 7:
+      name = ConstString("NSDateTS");
+      break;
+    default:
+      return ObjCLanguageRuntime::ClassDescriptorSP();
+    }
+  }
+  return ClassDescriptorSP(new ClassDescriptorV2Tagged(name, ptr));
+}
+
+AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::
+    TaggedPointerVendorRuntimeAssisted(
+        AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_taggedpointer_mask,
+        uint32_t objc_debug_taggedpointer_slot_shift,
+        uint32_t objc_debug_taggedpointer_slot_mask,
+        uint32_t objc_debug_taggedpointer_payload_lshift,
+        uint32_t objc_debug_taggedpointer_payload_rshift,
+        lldb::addr_t objc_debug_taggedpointer_classes)
+    : TaggedPointerVendorV2(runtime), m_cache(),
+      m_objc_debug_taggedpointer_mask(objc_debug_taggedpointer_mask),
+      m_objc_debug_taggedpointer_slot_shift(
+          objc_debug_taggedpointer_slot_shift),
+      m_objc_debug_taggedpointer_slot_mask(objc_debug_taggedpointer_slot_mask),
+      m_objc_debug_taggedpointer_payload_lshift(
+          objc_debug_taggedpointer_payload_lshift),
+      m_objc_debug_taggedpointer_payload_rshift(
+          objc_debug_taggedpointer_payload_rshift),
+      m_objc_debug_taggedpointer_classes(objc_debug_taggedpointer_classes) {}
+
+bool AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::
+    IsPossibleTaggedPointer(lldb::addr_t ptr) {
+  return (ptr & m_objc_debug_taggedpointer_mask) != 0;
 }
 
 ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::TaggedPointerVendorLegacy::GetClassDescriptor (lldb::addr_t ptr)
-{
-    if (!IsPossibleTaggedPointer(ptr))
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-
-    uint32_t foundation_version = m_runtime.GetFoundationVersion();
-    
-    if (foundation_version == LLDB_INVALID_MODULE_VERSION)
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    
-    uint64_t class_bits = (ptr & 0xE) >> 1;
-    ConstString name;
-    
-    // TODO: make a table
-    if (foundation_version >= 900)
-    {
-        switch (class_bits)
-        {
-            case 0:
-                name = ConstString("NSAtom");
-                break;
-            case 3:
-                name = ConstString("NSNumber");
-                break;
-            case 4:
-                name = ConstString("NSDateTS");
-                break;
-            case 5:
-                name = ConstString("NSManagedObject");
-                break;
-            case 6:
-                name = ConstString("NSDate");
-                break;
-            default:
-                return ObjCLanguageRuntime::ClassDescriptorSP();
-        }
-    }
-    else
-    {
-        switch (class_bits)
-        {
-            case 1:
-                name = ConstString("NSNumber");
-                break;
-            case 5:
-                name = ConstString("NSManagedObject");
-                break;
-            case 6:
-                name = ConstString("NSDate");
-                break;
-            case 7:
-                name = ConstString("NSDateTS");
-                break;
-            default:
-                return ObjCLanguageRuntime::ClassDescriptorSP();
-        }
-    }
-    return ClassDescriptorSP(new ClassDescriptorV2Tagged(name,ptr));
-}
+AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::GetClassDescriptor(
+    lldb::addr_t ptr) {
+  ClassDescriptorSP actual_class_descriptor_sp;
+  uint64_t data_payload;
+
+  if (!IsPossibleTaggedPointer(ptr))
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+
+  uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_slot_shift) &
+                   m_objc_debug_taggedpointer_slot_mask;
+
+  CacheIterator iterator = m_cache.find(slot), end = m_cache.end();
+  if (iterator != end) {
+    actual_class_descriptor_sp = iterator->second;
+  } else {
+    Process *process(m_runtime.GetProcess());
+    uintptr_t slot_ptr = slot * process->GetAddressByteSize() +
+                         m_objc_debug_taggedpointer_classes;
+    Error error;
+    uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error);
+    if (error.Fail() || slot_data == 0 ||
+        slot_data == uintptr_t(LLDB_INVALID_ADDRESS))
+      return nullptr;
+    actual_class_descriptor_sp =
+        m_runtime.GetClassDescriptorFromISA((ObjCISA)slot_data);
+    if (!actual_class_descriptor_sp)
+      return ObjCLanguageRuntime::ClassDescriptorSP();
+    m_cache[slot] = actual_class_descriptor_sp;
+  }
+
+  data_payload =
+      (((uint64_t)ptr << m_objc_debug_taggedpointer_payload_lshift) >>
+       m_objc_debug_taggedpointer_payload_rshift);
+
+  return ClassDescriptorSP(
+      new ClassDescriptorV2Tagged(actual_class_descriptor_sp, data_payload));
+}
+
+AppleObjCRuntimeV2::TaggedPointerVendorExtended::TaggedPointerVendorExtended(
+    AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_taggedpointer_mask,
+    uint64_t objc_debug_taggedpointer_ext_mask,
+    uint32_t objc_debug_taggedpointer_slot_shift,
+    uint32_t objc_debug_taggedpointer_ext_slot_shift,
+    uint32_t objc_debug_taggedpointer_slot_mask,
+    uint32_t objc_debug_taggedpointer_ext_slot_mask,
+    uint32_t objc_debug_taggedpointer_payload_lshift,
+    uint32_t objc_debug_taggedpointer_payload_rshift,
+    uint32_t objc_debug_taggedpointer_ext_payload_lshift,
+    uint32_t objc_debug_taggedpointer_ext_payload_rshift,
+    lldb::addr_t objc_debug_taggedpointer_classes,
+    lldb::addr_t objc_debug_taggedpointer_ext_classes)
+    : TaggedPointerVendorRuntimeAssisted(
+          runtime, objc_debug_taggedpointer_mask,
+          objc_debug_taggedpointer_slot_shift,
+          objc_debug_taggedpointer_slot_mask,
+          objc_debug_taggedpointer_payload_lshift,
+          objc_debug_taggedpointer_payload_rshift,
+          objc_debug_taggedpointer_classes),
+      m_ext_cache(),
+      m_objc_debug_taggedpointer_ext_mask(objc_debug_taggedpointer_ext_mask),
+      m_objc_debug_taggedpointer_ext_slot_shift(
+          objc_debug_taggedpointer_ext_slot_shift),
+      m_objc_debug_taggedpointer_ext_slot_mask(
+          objc_debug_taggedpointer_ext_slot_mask),
+      m_objc_debug_taggedpointer_ext_payload_lshift(
+          objc_debug_taggedpointer_ext_payload_lshift),
+      m_objc_debug_taggedpointer_ext_payload_rshift(
+          objc_debug_taggedpointer_ext_payload_rshift),
+      m_objc_debug_taggedpointer_ext_classes(
+          objc_debug_taggedpointer_ext_classes) {}
+
+bool AppleObjCRuntimeV2::TaggedPointerVendorExtended::
+    IsPossibleExtendedTaggedPointer(lldb::addr_t ptr) {
+  if (!IsPossibleTaggedPointer(ptr))
+    return false;
 
-AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::TaggedPointerVendorRuntimeAssisted (AppleObjCRuntimeV2& runtime,
-                                                                                            uint64_t objc_debug_taggedpointer_mask,
-                                                                                            uint32_t objc_debug_taggedpointer_slot_shift,
-                                                                                            uint32_t objc_debug_taggedpointer_slot_mask,
-                                                                                            uint32_t objc_debug_taggedpointer_payload_lshift,
-                                                                                            uint32_t objc_debug_taggedpointer_payload_rshift,
-                                                                                            lldb::addr_t objc_debug_taggedpointer_classes) :
-TaggedPointerVendorV2(runtime),
-m_cache(),
-m_objc_debug_taggedpointer_mask(objc_debug_taggedpointer_mask),
-m_objc_debug_taggedpointer_slot_shift(objc_debug_taggedpointer_slot_shift),
-m_objc_debug_taggedpointer_slot_mask(objc_debug_taggedpointer_slot_mask),
-m_objc_debug_taggedpointer_payload_lshift(objc_debug_taggedpointer_payload_lshift),
-m_objc_debug_taggedpointer_payload_rshift(objc_debug_taggedpointer_payload_rshift),
-m_objc_debug_taggedpointer_classes(objc_debug_taggedpointer_classes)
-{
-}
+  if (m_objc_debug_taggedpointer_ext_mask == 0)
+    return false;
 
-bool
-AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::IsPossibleTaggedPointer (lldb::addr_t ptr)
-{
-    return (ptr & m_objc_debug_taggedpointer_mask) != 0;
+  return ((ptr & m_objc_debug_taggedpointer_ext_mask) ==
+          m_objc_debug_taggedpointer_ext_mask);
 }
 
 ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::TaggedPointerVendorRuntimeAssisted::GetClassDescriptor (lldb::addr_t ptr)
-{
-    ClassDescriptorSP actual_class_descriptor_sp;
-    uint64_t data_payload;
+AppleObjCRuntimeV2::TaggedPointerVendorExtended::GetClassDescriptor(
+    lldb::addr_t ptr) {
+  ClassDescriptorSP actual_class_descriptor_sp;
+  uint64_t data_payload;
+
+  if (!IsPossibleTaggedPointer(ptr))
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+
+  if (!IsPossibleExtendedTaggedPointer(ptr))
+    return this->TaggedPointerVendorRuntimeAssisted::GetClassDescriptor(ptr);
+
+  uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_ext_slot_shift) &
+                   m_objc_debug_taggedpointer_ext_slot_mask;
+
+  CacheIterator iterator = m_ext_cache.find(slot), end = m_ext_cache.end();
+  if (iterator != end) {
+    actual_class_descriptor_sp = iterator->second;
+  } else {
+    Process *process(m_runtime.GetProcess());
+    uintptr_t slot_ptr = slot * process->GetAddressByteSize() +
+                         m_objc_debug_taggedpointer_ext_classes;
+    Error error;
+    uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error);
+    if (error.Fail() || slot_data == 0 ||
+        slot_data == uintptr_t(LLDB_INVALID_ADDRESS))
+      return nullptr;
+    actual_class_descriptor_sp =
+        m_runtime.GetClassDescriptorFromISA((ObjCISA)slot_data);
+    if (!actual_class_descriptor_sp)
+      return ObjCLanguageRuntime::ClassDescriptorSP();
+    m_ext_cache[slot] = actual_class_descriptor_sp;
+  }
+
+  data_payload =
+      (((uint64_t)ptr << m_objc_debug_taggedpointer_ext_payload_lshift) >>
+       m_objc_debug_taggedpointer_ext_payload_rshift);
+
+  return ClassDescriptorSP(
+      new ClassDescriptorV2Tagged(actual_class_descriptor_sp, data_payload));
+}
+
+AppleObjCRuntimeV2::NonPointerISACache::NonPointerISACache(
+    AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_isa_class_mask,
+    uint64_t objc_debug_isa_magic_mask, uint64_t objc_debug_isa_magic_value)
+    : m_runtime(runtime), m_cache(),
+      m_objc_debug_isa_class_mask(objc_debug_isa_class_mask),
+      m_objc_debug_isa_magic_mask(objc_debug_isa_magic_mask),
+      m_objc_debug_isa_magic_value(objc_debug_isa_magic_value) {}
 
-    if (!IsPossibleTaggedPointer(ptr))
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    
-    uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_slot_shift) & m_objc_debug_taggedpointer_slot_mask;
-    
-    CacheIterator iterator = m_cache.find(slot),
-    end = m_cache.end();
-    if (iterator != end)
-    {
-        actual_class_descriptor_sp = iterator->second;
-    }
-    else
-    {
-        Process* process(m_runtime.GetProcess());
-        uintptr_t slot_ptr = slot*process->GetAddressByteSize()+m_objc_debug_taggedpointer_classes;
-        Error error;
-        uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error);
-        if (error.Fail() || slot_data == 0 || slot_data == uintptr_t(LLDB_INVALID_ADDRESS))
-            return nullptr;
-        actual_class_descriptor_sp = m_runtime.GetClassDescriptorFromISA((ObjCISA)slot_data);
-        if (!actual_class_descriptor_sp)
-            return ObjCLanguageRuntime::ClassDescriptorSP();
-        m_cache[slot] = actual_class_descriptor_sp;
-    }
-    
-    data_payload = (((uint64_t)ptr << m_objc_debug_taggedpointer_payload_lshift) >> m_objc_debug_taggedpointer_payload_rshift);
-    
-    return ClassDescriptorSP(new ClassDescriptorV2Tagged(actual_class_descriptor_sp,data_payload));
-}
-
-AppleObjCRuntimeV2::TaggedPointerVendorExtended::TaggedPointerVendorExtended (AppleObjCRuntimeV2& runtime,
-                                                                              uint64_t objc_debug_taggedpointer_mask,
-                                                                              uint64_t objc_debug_taggedpointer_ext_mask,
-                                                                              uint32_t objc_debug_taggedpointer_slot_shift,
-                                                                              uint32_t objc_debug_taggedpointer_ext_slot_shift,
-                                                                              uint32_t objc_debug_taggedpointer_slot_mask,
-                                                                              uint32_t objc_debug_taggedpointer_ext_slot_mask,
-                                                                              uint32_t objc_debug_taggedpointer_payload_lshift,
-                                                                              uint32_t objc_debug_taggedpointer_payload_rshift,
-                                                                              uint32_t objc_debug_taggedpointer_ext_payload_lshift,
-                                                                              uint32_t objc_debug_taggedpointer_ext_payload_rshift,
-                                                                              lldb::addr_t objc_debug_taggedpointer_classes,
-                                                                              lldb::addr_t objc_debug_taggedpointer_ext_classes) :
-TaggedPointerVendorRuntimeAssisted(runtime,
-                                   objc_debug_taggedpointer_mask,
-                                   objc_debug_taggedpointer_slot_shift,
-                                   objc_debug_taggedpointer_slot_mask,
-                                   objc_debug_taggedpointer_payload_lshift,
-                                   objc_debug_taggedpointer_payload_rshift,
-                                   objc_debug_taggedpointer_classes),
-m_ext_cache(),
-m_objc_debug_taggedpointer_ext_mask(objc_debug_taggedpointer_ext_mask),
-m_objc_debug_taggedpointer_ext_slot_shift(objc_debug_taggedpointer_ext_slot_shift),
-m_objc_debug_taggedpointer_ext_slot_mask(objc_debug_taggedpointer_ext_slot_mask),
-m_objc_debug_taggedpointer_ext_payload_lshift(objc_debug_taggedpointer_ext_payload_lshift),
-m_objc_debug_taggedpointer_ext_payload_rshift(objc_debug_taggedpointer_ext_payload_rshift),
-m_objc_debug_taggedpointer_ext_classes(objc_debug_taggedpointer_ext_classes)
-{
+ObjCLanguageRuntime::ClassDescriptorSP
+AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor(ObjCISA isa) {
+  ObjCISA real_isa = 0;
+  if (EvaluateNonPointerISA(isa, real_isa) == false)
+    return ObjCLanguageRuntime::ClassDescriptorSP();
+  auto cache_iter = m_cache.find(real_isa);
+  if (cache_iter != m_cache.end())
+    return cache_iter->second;
+  auto descriptor_sp =
+      m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(real_isa);
+  if (descriptor_sp) // cache only positive matches since the table might grow
+    m_cache[real_isa] = descriptor_sp;
+  return descriptor_sp;
+}
+
+bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
+    ObjCISA isa, ObjCISA &ret_isa) {
+  if ((isa & ~m_objc_debug_isa_class_mask) == 0)
+    return false;
+  if ((isa & m_objc_debug_isa_magic_mask) == m_objc_debug_isa_magic_value) {
+    ret_isa = isa & m_objc_debug_isa_class_mask;
+    return (ret_isa != 0); // this is a pointer so 0 is not a valid value
+  }
+  return false;
 }
 
-bool
-AppleObjCRuntimeV2::TaggedPointerVendorExtended::IsPossibleExtendedTaggedPointer (lldb::addr_t ptr)
-{
-    if (!IsPossibleTaggedPointer(ptr))
-        return false;
-    
-    if (m_objc_debug_taggedpointer_ext_mask == 0)
-        return false;
-    
-    return ((ptr & m_objc_debug_taggedpointer_ext_mask) == m_objc_debug_taggedpointer_ext_mask);
+ObjCLanguageRuntime::EncodingToTypeSP AppleObjCRuntimeV2::GetEncodingToType() {
+  if (!m_encoding_to_type_sp)
+    m_encoding_to_type_sp.reset(new AppleObjCTypeEncodingParser(*this));
+  return m_encoding_to_type_sp;
 }
 
-ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::TaggedPointerVendorExtended::GetClassDescriptor (lldb::addr_t ptr)
-{
-    ClassDescriptorSP actual_class_descriptor_sp;
-    uint64_t data_payload;
-    
-    if (!IsPossibleTaggedPointer(ptr))
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    
-    if (!IsPossibleExtendedTaggedPointer(ptr))
-        return this->TaggedPointerVendorRuntimeAssisted::GetClassDescriptor(ptr);
-    
-    uintptr_t slot = (ptr >> m_objc_debug_taggedpointer_ext_slot_shift) & m_objc_debug_taggedpointer_ext_slot_mask;
-    
-    CacheIterator iterator = m_ext_cache.find(slot),
-    end = m_ext_cache.end();
-    if (iterator != end)
-    {
-        actual_class_descriptor_sp = iterator->second;
-    }
-    else
-    {
-        Process* process(m_runtime.GetProcess());
-        uintptr_t slot_ptr = slot*process->GetAddressByteSize()+m_objc_debug_taggedpointer_ext_classes;
-        Error error;
-        uintptr_t slot_data = process->ReadPointerFromMemory(slot_ptr, error);
-        if (error.Fail() || slot_data == 0 || slot_data == uintptr_t(LLDB_INVALID_ADDRESS))
-            return nullptr;
-        actual_class_descriptor_sp = m_runtime.GetClassDescriptorFromISA((ObjCISA)slot_data);
-        if (!actual_class_descriptor_sp)
-            return ObjCLanguageRuntime::ClassDescriptorSP();
-        m_ext_cache[slot] = actual_class_descriptor_sp;
-    }
-    
-    data_payload = (((uint64_t)ptr << m_objc_debug_taggedpointer_ext_payload_lshift) >> m_objc_debug_taggedpointer_ext_payload_rshift);
-    
-    return ClassDescriptorSP(new ClassDescriptorV2Tagged(actual_class_descriptor_sp,data_payload));
-}
-
-AppleObjCRuntimeV2::NonPointerISACache::NonPointerISACache (AppleObjCRuntimeV2& runtime,
-                                                            uint64_t objc_debug_isa_class_mask,
-                                                            uint64_t objc_debug_isa_magic_mask,
-                                                            uint64_t objc_debug_isa_magic_value) :
-m_runtime(runtime),
-m_cache(),
-m_objc_debug_isa_class_mask(objc_debug_isa_class_mask),
-m_objc_debug_isa_magic_mask(objc_debug_isa_magic_mask),
-m_objc_debug_isa_magic_value(objc_debug_isa_magic_value)
-{
-}
+lldb_private::AppleObjCRuntime::ObjCISA
+AppleObjCRuntimeV2::GetPointerISA(ObjCISA isa) {
+  ObjCISA ret = isa;
 
-ObjCLanguageRuntime::ClassDescriptorSP
-AppleObjCRuntimeV2::NonPointerISACache::GetClassDescriptor (ObjCISA isa)
-{
-    ObjCISA real_isa = 0;
-    if (EvaluateNonPointerISA(isa, real_isa) == false)
-        return ObjCLanguageRuntime::ClassDescriptorSP();
-    auto cache_iter = m_cache.find(real_isa);
-    if (cache_iter != m_cache.end())
-        return cache_iter->second;
-    auto descriptor_sp = m_runtime.ObjCLanguageRuntime::GetClassDescriptorFromISA(real_isa);
-    if (descriptor_sp) // cache only positive matches since the table might grow
-        m_cache[real_isa] = descriptor_sp;
-    return descriptor_sp;
+  if (m_non_pointer_isa_cache_ap)
+    m_non_pointer_isa_cache_ap->EvaluateNonPointerISA(isa, ret);
+
+  return ret;
 }
 
-bool
-AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA (ObjCISA isa, ObjCISA& ret_isa)
-{
-    if ( (isa & ~m_objc_debug_isa_class_mask) == 0)
-        return false;
-    if ( (isa & m_objc_debug_isa_magic_mask) == m_objc_debug_isa_magic_value)
-    {
-        ret_isa = isa & m_objc_debug_isa_class_mask;
-        return (ret_isa != 0); // this is a pointer so 0 is not a valid value
+bool AppleObjCRuntimeV2::GetCFBooleanValuesIfNeeded() {
+  if (m_CFBoolean_values)
+    return true;
+
+  static ConstString g_kCFBooleanFalse("kCFBooleanFalse");
+  static ConstString g_kCFBooleanTrue("kCFBooleanTrue");
+
+  std::function<lldb::addr_t(ConstString)> get_symbol =
+      [this](ConstString sym) -> lldb::addr_t {
+    SymbolContextList sc_list;
+    if (GetProcess()->GetTarget().GetImages().FindSymbolsWithNameAndType(
+            g_kCFBooleanFalse, lldb::eSymbolTypeData, sc_list) == 1) {
+      SymbolContext sc;
+      sc_list.GetContextAtIndex(0, sc);
+      if (sc.symbol)
+        return sc.symbol->GetLoadAddress(&GetProcess()->GetTarget());
     }
-    return false;
-}
 
-ObjCLanguageRuntime::EncodingToTypeSP
-AppleObjCRuntimeV2::GetEncodingToType ()
-{
-    if (!m_encoding_to_type_sp)
-        m_encoding_to_type_sp.reset(new AppleObjCTypeEncodingParser(*this));
-    return m_encoding_to_type_sp;
-}
+    return LLDB_INVALID_ADDRESS;
+  };
 
-lldb_private::AppleObjCRuntime::ObjCISA
-AppleObjCRuntimeV2::GetPointerISA (ObjCISA isa)
-{
-    ObjCISA ret = isa;
-    
-    if (m_non_pointer_isa_cache_ap)
-        m_non_pointer_isa_cache_ap->EvaluateNonPointerISA(isa, ret);
-    
-    return ret;
-}
+  lldb::addr_t false_addr = get_symbol(g_kCFBooleanFalse);
+  lldb::addr_t true_addr = get_symbol(g_kCFBooleanTrue);
 
-bool
-AppleObjCRuntimeV2::GetCFBooleanValuesIfNeeded ()
-{
-    if (m_CFBoolean_values)
-        return true;
-    
-    static ConstString g_kCFBooleanFalse("kCFBooleanFalse");
-    static ConstString g_kCFBooleanTrue("kCFBooleanTrue");
-    
-    std::function<lldb::addr_t(ConstString)> get_symbol = [this] (ConstString sym) -> lldb::addr_t {
-        SymbolContextList sc_list;
-        if (GetProcess()->GetTarget().GetImages().FindSymbolsWithNameAndType(g_kCFBooleanFalse, lldb::eSymbolTypeData, sc_list) == 1)
-        {
-            SymbolContext sc;
-            sc_list.GetContextAtIndex(0, sc);
-            if (sc.symbol)
-                return sc.symbol->GetLoadAddress(&GetProcess()->GetTarget());
-        }
-        
-        return LLDB_INVALID_ADDRESS;
-    };
-    
-    lldb::addr_t false_addr = get_symbol(g_kCFBooleanFalse);
-    lldb::addr_t true_addr = get_symbol(g_kCFBooleanTrue);
-    
-    return (m_CFBoolean_values = {false_addr,true_addr}).operator bool();
+  return (m_CFBoolean_values = {false_addr, true_addr}).operator bool();
 }
 
-void
-AppleObjCRuntimeV2::GetValuesForGlobalCFBooleans(lldb::addr_t& cf_true,
-                                                 lldb::addr_t& cf_false)
-{
-    if (GetCFBooleanValuesIfNeeded())
-    {
-        cf_true = m_CFBoolean_values->second;
-        cf_false = m_CFBoolean_values->first;
-    }
-    else
-        this->AppleObjCRuntime::GetValuesForGlobalCFBooleans(cf_true, cf_false);
+void AppleObjCRuntimeV2::GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
+                                                      lldb::addr_t &cf_false) {
+  if (GetCFBooleanValuesIfNeeded()) {
+    cf_true = m_CFBoolean_values->second;
+    cf_false = m_CFBoolean_values->first;
+  } else
+    this->AppleObjCRuntime::GetValuesForGlobalCFBooleans(cf_true, cf_false);
 }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Tue Sep  6 15:57:50 2016
@@ -18,374 +18,314 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "AppleObjCRuntime.h"
+#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/lldb-private.h"
 
 class RemoteNXMapTable;
 
 namespace lldb_private {
 
-class AppleObjCRuntimeV2 :
-        public AppleObjCRuntime
-{
+class AppleObjCRuntimeV2 : public AppleObjCRuntime {
 public:
-    ~AppleObjCRuntimeV2() override = default;
+  ~AppleObjCRuntimeV2() override = default;
 
-    //------------------------------------------------------------------
-    // Static Functions
-    //------------------------------------------------------------------
-    static void
-    Initialize();
-    
-    static void
-    Terminate();
-    
-    static lldb_private::LanguageRuntime *
-    CreateInstance (Process *process, lldb::LanguageType language);
-    
-    static lldb_private::ConstString
-    GetPluginNameStatic();
-
-    static bool classof(const ObjCLanguageRuntime* runtime)
-    {
-        switch (runtime->GetRuntimeVersion())
-        {
-            case ObjCRuntimeVersions::eAppleObjC_V2:
-                return true;
-            default:
-                return false;
-        }
+  //------------------------------------------------------------------
+  // Static Functions
+  //------------------------------------------------------------------
+  static void Initialize();
+
+  static void Terminate();
+
+  static lldb_private::LanguageRuntime *
+  CreateInstance(Process *process, lldb::LanguageType language);
+
+  static lldb_private::ConstString GetPluginNameStatic();
+
+  static bool classof(const ObjCLanguageRuntime *runtime) {
+    switch (runtime->GetRuntimeVersion()) {
+    case ObjCRuntimeVersions::eAppleObjC_V2:
+      return true;
+    default:
+      return false;
     }
+  }
 
-    // These are generic runtime functions:
-    bool
-    GetDynamicTypeAndAddress(ValueObject &in_value,
-                             lldb::DynamicValueType use_dynamic,
-                             TypeAndOrName &class_type_or_name,
-                             Address &address,
-                             Value::ValueType &value_type) override;
-    
-    UtilityFunction *
-    CreateObjectChecker(const char *) override;
-
-    //------------------------------------------------------------------
-    // PluginInterface protocol
-    //------------------------------------------------------------------
-    ConstString
-    GetPluginName() override;
-    
-    uint32_t
-    GetPluginVersion() override;
-    
-    ObjCRuntimeVersions
-    GetRuntimeVersion() const override
-    {
-        return ObjCRuntimeVersions::eAppleObjC_V2;
-    }
+  // These are generic runtime functions:
+  bool GetDynamicTypeAndAddress(ValueObject &in_value,
+                                lldb::DynamicValueType use_dynamic,
+                                TypeAndOrName &class_type_or_name,
+                                Address &address,
+                                Value::ValueType &value_type) override;
 
-    size_t
-    GetByteOffsetForIvar(CompilerType &parent_qual_type, const char *ivar_name) override;
+  UtilityFunction *CreateObjectChecker(const char *) override;
 
-    void
-    UpdateISAToDescriptorMapIfNeeded() override;
-    
-    ConstString
-    GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa) override;
-    
-    ClassDescriptorSP
-    GetClassDescriptor(ValueObject& in_value) override;
-    
-    ClassDescriptorSP
-    GetClassDescriptorFromISA(ObjCISA isa) override;
-    
-    DeclVendor *
-    GetDeclVendor() override;
-    
-    lldb::addr_t
-    LookupRuntimeSymbol(const ConstString &name) override;
-    
-    EncodingToTypeSP
-    GetEncodingToType() override;
-    
-    TaggedPointerVendor*
-    GetTaggedPointerVendor() override
-    {
-        return m_tagged_pointer_vendor_ap.get();
-    }
-    
-    void
-    GetValuesForGlobalCFBooleans(lldb::addr_t& cf_true,
-                                 lldb::addr_t& cf_false) override;
-    
-    // none of these are valid ISAs - we use them to infer the type
-    // of tagged pointers - if we have something meaningful to say
-    // we report an actual type - otherwise, we just say tagged
-    // there is no connection between the values here and the tagged pointers map
-    static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA = 1;
-    static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSAtom = 2;
-    static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSNumber = 3;
-    static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSDateTS = 4;
-    static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSManagedObject = 5;
-    static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSDate = 6;
+  //------------------------------------------------------------------
+  // PluginInterface protocol
+  //------------------------------------------------------------------
+  ConstString GetPluginName() override;
+
+  uint32_t GetPluginVersion() override;
+
+  ObjCRuntimeVersions GetRuntimeVersion() const override {
+    return ObjCRuntimeVersions::eAppleObjC_V2;
+  }
+
+  size_t GetByteOffsetForIvar(CompilerType &parent_qual_type,
+                              const char *ivar_name) override;
+
+  void UpdateISAToDescriptorMapIfNeeded() override;
+
+  ConstString GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa) override;
+
+  ClassDescriptorSP GetClassDescriptor(ValueObject &in_value) override;
+
+  ClassDescriptorSP GetClassDescriptorFromISA(ObjCISA isa) override;
+
+  DeclVendor *GetDeclVendor() override;
+
+  lldb::addr_t LookupRuntimeSymbol(const ConstString &name) override;
+
+  EncodingToTypeSP GetEncodingToType() override;
+
+  TaggedPointerVendor *GetTaggedPointerVendor() override {
+    return m_tagged_pointer_vendor_ap.get();
+  }
+
+  void GetValuesForGlobalCFBooleans(lldb::addr_t &cf_true,
+                                    lldb::addr_t &cf_false) override;
+
+  // none of these are valid ISAs - we use them to infer the type
+  // of tagged pointers - if we have something meaningful to say
+  // we report an actual type - otherwise, we just say tagged
+  // there is no connection between the values here and the tagged pointers map
+  static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA = 1;
+  static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSAtom = 2;
+  static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSNumber = 3;
+  static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSDateTS = 4;
+  static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSManagedObject =
+      5;
+  static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA_NSDate = 6;
 
 protected:
-    lldb::BreakpointResolverSP
-    CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override;
+  lldb::BreakpointResolverSP CreateExceptionResolver(Breakpoint *bkpt,
+                                                     bool catch_bp,
+                                                     bool throw_bp) override;
 
 private:
-    class HashTableSignature
-    {
-    public:
-        HashTableSignature ();
-
-        bool
-        NeedsUpdate (Process *process,
-                     AppleObjCRuntimeV2 *runtime,
+  class HashTableSignature {
+  public:
+    HashTableSignature();
+
+    bool NeedsUpdate(Process *process, AppleObjCRuntimeV2 *runtime,
                      RemoteNXMapTable &hash_table);
-        
-        void
-        UpdateSignature (const RemoteNXMapTable &hash_table);
-
-    protected:
-        uint32_t m_count;
-        uint32_t m_num_buckets;
-        lldb::addr_t m_buckets_ptr;
-    };
-
-    class NonPointerISACache
-    {
-    public:
-        static NonPointerISACache*
-        CreateInstance (AppleObjCRuntimeV2& runtime,
-                        const lldb::ModuleSP& objc_module_sp);
-        
-
-        ObjCLanguageRuntime::ClassDescriptorSP
-        GetClassDescriptor (ObjCISA isa);
-
-    private:
-        NonPointerISACache (AppleObjCRuntimeV2& runtime,
-                            uint64_t objc_debug_isa_class_mask,
-                            uint64_t objc_debug_isa_magic_mask,
-                            uint64_t objc_debug_isa_magic_value);
-        
-        bool
-        EvaluateNonPointerISA (ObjCISA isa, ObjCISA& ret_isa);
-        
-        AppleObjCRuntimeV2&                                         m_runtime;
-        std::map<ObjCISA,ObjCLanguageRuntime::ClassDescriptorSP>    m_cache;
-        uint64_t                                                    m_objc_debug_isa_class_mask;
-        uint64_t                                                    m_objc_debug_isa_magic_mask;
-        uint64_t                                                    m_objc_debug_isa_magic_value;
-
-        friend class AppleObjCRuntimeV2;
-        
-        DISALLOW_COPY_AND_ASSIGN(NonPointerISACache);
-    };
-    
-    class TaggedPointerVendorV2 : public ObjCLanguageRuntime::TaggedPointerVendor
-    {
-    public:
-        ~TaggedPointerVendorV2() override = default;
-
-        static TaggedPointerVendorV2*
-        CreateInstance (AppleObjCRuntimeV2& runtime,
-                        const lldb::ModuleSP& objc_module_sp);
-
-    protected:
-        AppleObjCRuntimeV2&                                         m_runtime;
-        
-        TaggedPointerVendorV2 (AppleObjCRuntimeV2& runtime) :
-        TaggedPointerVendor(),
-        m_runtime(runtime)
-        {
-        }
-
-    private:
-        DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorV2);
-    };
-    
-    class TaggedPointerVendorRuntimeAssisted : public TaggedPointerVendorV2
-    {
-    public:
-        bool
-        IsPossibleTaggedPointer(lldb::addr_t ptr) override;
-        
-        ObjCLanguageRuntime::ClassDescriptorSP
-        GetClassDescriptor(lldb::addr_t ptr) override;
-
-    protected:
-        TaggedPointerVendorRuntimeAssisted (AppleObjCRuntimeV2& runtime,
-                                             uint64_t objc_debug_taggedpointer_mask,
-                                             uint32_t objc_debug_taggedpointer_slot_shift,
-                                             uint32_t objc_debug_taggedpointer_slot_mask,
-                                             uint32_t objc_debug_taggedpointer_payload_lshift,
-                                             uint32_t objc_debug_taggedpointer_payload_rshift,
-                                             lldb::addr_t objc_debug_taggedpointer_classes);
-        
-        typedef std::map<uint8_t,ObjCLanguageRuntime::ClassDescriptorSP> Cache;
-        typedef Cache::iterator CacheIterator;
-        Cache                                                       m_cache;
-        uint64_t                                                    m_objc_debug_taggedpointer_mask;
-        uint32_t                                                    m_objc_debug_taggedpointer_slot_shift;
-        uint32_t                                                    m_objc_debug_taggedpointer_slot_mask;
-        uint32_t                                                    m_objc_debug_taggedpointer_payload_lshift;
-        uint32_t                                                    m_objc_debug_taggedpointer_payload_rshift;
-        lldb::addr_t                                                m_objc_debug_taggedpointer_classes;
-        
-        friend class AppleObjCRuntimeV2::TaggedPointerVendorV2;
-        
-        DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorRuntimeAssisted);
-    };
-    
-    class TaggedPointerVendorExtended : public TaggedPointerVendorRuntimeAssisted
-    {
-        public:
-        ObjCLanguageRuntime::ClassDescriptorSP
-        GetClassDescriptor(lldb::addr_t ptr) override;
-
-        protected:
-        TaggedPointerVendorExtended (AppleObjCRuntimeV2& runtime,
-                                     uint64_t objc_debug_taggedpointer_mask,
-                                     uint64_t objc_debug_taggedpointer_ext_mask,
-                                     uint32_t objc_debug_taggedpointer_slot_shift,
-                                     uint32_t objc_debug_taggedpointer_ext_slot_shift,
-                                     uint32_t objc_debug_taggedpointer_slot_mask,
-                                     uint32_t objc_debug_taggedpointer_ext_slot_mask,
-                                     uint32_t objc_debug_taggedpointer_payload_lshift,
-                                     uint32_t objc_debug_taggedpointer_payload_rshift,
-                                     uint32_t objc_debug_taggedpointer_ext_payload_lshift,
-                                     uint32_t objc_debug_taggedpointer_ext_payload_rshift,
-                                     lldb::addr_t objc_debug_taggedpointer_classes,
-                                     lldb::addr_t objc_debug_taggedpointer_ext_classes);
-
-        bool
-        IsPossibleExtendedTaggedPointer (lldb::addr_t ptr);
-
-        typedef std::map<uint8_t,ObjCLanguageRuntime::ClassDescriptorSP> Cache;
-        typedef Cache::iterator CacheIterator;
-        Cache                                                       m_ext_cache;
-        uint64_t                                                    m_objc_debug_taggedpointer_ext_mask;
-        uint32_t                                                    m_objc_debug_taggedpointer_ext_slot_shift;
-        uint32_t                                                    m_objc_debug_taggedpointer_ext_slot_mask;
-        uint32_t                                                    m_objc_debug_taggedpointer_ext_payload_lshift;
-        uint32_t                                                    m_objc_debug_taggedpointer_ext_payload_rshift;
-        lldb::addr_t                                                m_objc_debug_taggedpointer_ext_classes;
-
-        friend class AppleObjCRuntimeV2::TaggedPointerVendorV2;
-
-        DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorExtended);
-    };
-    
-    class TaggedPointerVendorLegacy : public TaggedPointerVendorV2
-    {
-    public:
-        bool
-        IsPossibleTaggedPointer(lldb::addr_t ptr) override;
-        
-        ObjCLanguageRuntime::ClassDescriptorSP
-        GetClassDescriptor (lldb::addr_t ptr) override;
-
-    protected:
-        TaggedPointerVendorLegacy (AppleObjCRuntimeV2& runtime) :
-        TaggedPointerVendorV2 (runtime)
-        {
-        }
-        
-        friend class AppleObjCRuntimeV2::TaggedPointerVendorV2;
-        
-        DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorLegacy);
-    };
-    
-    struct DescriptorMapUpdateResult
-    {
-        bool m_update_ran;
-        uint32_t m_num_found;
-        
-        DescriptorMapUpdateResult (bool ran,
-                                   uint32_t found)
-        {
-            m_update_ran = ran;
-            m_num_found = found;
-        }
-        
-        static DescriptorMapUpdateResult
-        Fail ()
-        {
-            return {false, 0};
-        }
-        
-        static DescriptorMapUpdateResult
-        Success (uint32_t found)
-        {
-            return {true, found};
-        }
-    };
-    
-    AppleObjCRuntimeV2 (Process *process,
-                        const lldb::ModuleSP &objc_module_sp);
-    
-    ObjCISA
-    GetPointerISA (ObjCISA isa);
-    
-    bool
-    IsTaggedPointer(lldb::addr_t ptr);
-    
-    lldb::addr_t
-    GetISAHashTablePointer ();
-
-    bool
-    UpdateISAToDescriptorMapFromMemory (RemoteNXMapTable &hash_table);
-    
-    DescriptorMapUpdateResult
-    UpdateISAToDescriptorMapDynamic(RemoteNXMapTable &hash_table);
-    
-    uint32_t
-    ParseClassInfoArray (const lldb_private::DataExtractor &data,
-                         uint32_t num_class_infos);
-    
-    DescriptorMapUpdateResult
-    UpdateISAToDescriptorMapSharedCache ();
-    
-    enum class SharedCacheWarningReason
-    {
-        eExpressionExecutionFailure,
-        eNotEnoughClassesRead
-    };
-    
-    void
-    WarnIfNoClassesCached (SharedCacheWarningReason reason);
-
-    lldb::addr_t
-    GetSharedCacheReadOnlyAddress();
-    
-    bool
-    GetCFBooleanValuesIfNeeded ();
-    
-    friend class ClassDescriptorV2;
-
-    std::unique_ptr<UtilityFunction>        m_get_class_info_code;
-    lldb::addr_t                            m_get_class_info_args;
-    std::mutex m_get_class_info_args_mutex;
-
-    std::unique_ptr<UtilityFunction>        m_get_shared_cache_class_info_code;
-    lldb::addr_t                            m_get_shared_cache_class_info_args;
-    std::mutex m_get_shared_cache_class_info_args_mutex;
-
-    std::unique_ptr<DeclVendor>             m_decl_vendor_ap;
-    lldb::addr_t                            m_isa_hash_table_ptr;
-    HashTableSignature                      m_hash_signature;
-    bool                                    m_has_object_getClass;
-    bool                                    m_loaded_objc_opt;
-    std::unique_ptr<NonPointerISACache>     m_non_pointer_isa_cache_ap;
-    std::unique_ptr<TaggedPointerVendor>    m_tagged_pointer_vendor_ap;
-    EncodingToTypeSP                        m_encoding_to_type_sp;
-    bool                                    m_noclasses_warning_emitted;
-    llvm::Optional<std::pair<lldb::addr_t,
-                             lldb::addr_t>>  m_CFBoolean_values;
+
+    void UpdateSignature(const RemoteNXMapTable &hash_table);
+
+  protected:
+    uint32_t m_count;
+    uint32_t m_num_buckets;
+    lldb::addr_t m_buckets_ptr;
+  };
+
+  class NonPointerISACache {
+  public:
+    static NonPointerISACache *
+    CreateInstance(AppleObjCRuntimeV2 &runtime,
+                   const lldb::ModuleSP &objc_module_sp);
+
+    ObjCLanguageRuntime::ClassDescriptorSP GetClassDescriptor(ObjCISA isa);
+
+  private:
+    NonPointerISACache(AppleObjCRuntimeV2 &runtime,
+                       uint64_t objc_debug_isa_class_mask,
+                       uint64_t objc_debug_isa_magic_mask,
+                       uint64_t objc_debug_isa_magic_value);
+
+    bool EvaluateNonPointerISA(ObjCISA isa, ObjCISA &ret_isa);
+
+    AppleObjCRuntimeV2 &m_runtime;
+    std::map<ObjCISA, ObjCLanguageRuntime::ClassDescriptorSP> m_cache;
+    uint64_t m_objc_debug_isa_class_mask;
+    uint64_t m_objc_debug_isa_magic_mask;
+    uint64_t m_objc_debug_isa_magic_value;
+
+    friend class AppleObjCRuntimeV2;
+
+    DISALLOW_COPY_AND_ASSIGN(NonPointerISACache);
+  };
+
+  class TaggedPointerVendorV2
+      : public ObjCLanguageRuntime::TaggedPointerVendor {
+  public:
+    ~TaggedPointerVendorV2() override = default;
+
+    static TaggedPointerVendorV2 *
+    CreateInstance(AppleObjCRuntimeV2 &runtime,
+                   const lldb::ModuleSP &objc_module_sp);
+
+  protected:
+    AppleObjCRuntimeV2 &m_runtime;
+
+    TaggedPointerVendorV2(AppleObjCRuntimeV2 &runtime)
+        : TaggedPointerVendor(), m_runtime(runtime) {}
+
+  private:
+    DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorV2);
+  };
+
+  class TaggedPointerVendorRuntimeAssisted : public TaggedPointerVendorV2 {
+  public:
+    bool IsPossibleTaggedPointer(lldb::addr_t ptr) override;
+
+    ObjCLanguageRuntime::ClassDescriptorSP
+    GetClassDescriptor(lldb::addr_t ptr) override;
+
+  protected:
+    TaggedPointerVendorRuntimeAssisted(
+        AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_taggedpointer_mask,
+        uint32_t objc_debug_taggedpointer_slot_shift,
+        uint32_t objc_debug_taggedpointer_slot_mask,
+        uint32_t objc_debug_taggedpointer_payload_lshift,
+        uint32_t objc_debug_taggedpointer_payload_rshift,
+        lldb::addr_t objc_debug_taggedpointer_classes);
+
+    typedef std::map<uint8_t, ObjCLanguageRuntime::ClassDescriptorSP> Cache;
+    typedef Cache::iterator CacheIterator;
+    Cache m_cache;
+    uint64_t m_objc_debug_taggedpointer_mask;
+    uint32_t m_objc_debug_taggedpointer_slot_shift;
+    uint32_t m_objc_debug_taggedpointer_slot_mask;
+    uint32_t m_objc_debug_taggedpointer_payload_lshift;
+    uint32_t m_objc_debug_taggedpointer_payload_rshift;
+    lldb::addr_t m_objc_debug_taggedpointer_classes;
+
+    friend class AppleObjCRuntimeV2::TaggedPointerVendorV2;
+
+    DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorRuntimeAssisted);
+  };
+
+  class TaggedPointerVendorExtended
+      : public TaggedPointerVendorRuntimeAssisted {
+  public:
+    ObjCLanguageRuntime::ClassDescriptorSP
+    GetClassDescriptor(lldb::addr_t ptr) override;
+
+  protected:
+    TaggedPointerVendorExtended(
+        AppleObjCRuntimeV2 &runtime, uint64_t objc_debug_taggedpointer_mask,
+        uint64_t objc_debug_taggedpointer_ext_mask,
+        uint32_t objc_debug_taggedpointer_slot_shift,
+        uint32_t objc_debug_taggedpointer_ext_slot_shift,
+        uint32_t objc_debug_taggedpointer_slot_mask,
+        uint32_t objc_debug_taggedpointer_ext_slot_mask,
+        uint32_t objc_debug_taggedpointer_payload_lshift,
+        uint32_t objc_debug_taggedpointer_payload_rshift,
+        uint32_t objc_debug_taggedpointer_ext_payload_lshift,
+        uint32_t objc_debug_taggedpointer_ext_payload_rshift,
+        lldb::addr_t objc_debug_taggedpointer_classes,
+        lldb::addr_t objc_debug_taggedpointer_ext_classes);
+
+    bool IsPossibleExtendedTaggedPointer(lldb::addr_t ptr);
+
+    typedef std::map<uint8_t, ObjCLanguageRuntime::ClassDescriptorSP> Cache;
+    typedef Cache::iterator CacheIterator;
+    Cache m_ext_cache;
+    uint64_t m_objc_debug_taggedpointer_ext_mask;
+    uint32_t m_objc_debug_taggedpointer_ext_slot_shift;
+    uint32_t m_objc_debug_taggedpointer_ext_slot_mask;
+    uint32_t m_objc_debug_taggedpointer_ext_payload_lshift;
+    uint32_t m_objc_debug_taggedpointer_ext_payload_rshift;
+    lldb::addr_t m_objc_debug_taggedpointer_ext_classes;
+
+    friend class AppleObjCRuntimeV2::TaggedPointerVendorV2;
+
+    DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorExtended);
+  };
+
+  class TaggedPointerVendorLegacy : public TaggedPointerVendorV2 {
+  public:
+    bool IsPossibleTaggedPointer(lldb::addr_t ptr) override;
+
+    ObjCLanguageRuntime::ClassDescriptorSP
+    GetClassDescriptor(lldb::addr_t ptr) override;
+
+  protected:
+    TaggedPointerVendorLegacy(AppleObjCRuntimeV2 &runtime)
+        : TaggedPointerVendorV2(runtime) {}
+
+    friend class AppleObjCRuntimeV2::TaggedPointerVendorV2;
+
+    DISALLOW_COPY_AND_ASSIGN(TaggedPointerVendorLegacy);
+  };
+
+  struct DescriptorMapUpdateResult {
+    bool m_update_ran;
+    uint32_t m_num_found;
+
+    DescriptorMapUpdateResult(bool ran, uint32_t found) {
+      m_update_ran = ran;
+      m_num_found = found;
+    }
+
+    static DescriptorMapUpdateResult Fail() { return {false, 0}; }
+
+    static DescriptorMapUpdateResult Success(uint32_t found) {
+      return {true, found};
+    }
+  };
+
+  AppleObjCRuntimeV2(Process *process, const lldb::ModuleSP &objc_module_sp);
+
+  ObjCISA GetPointerISA(ObjCISA isa);
+
+  bool IsTaggedPointer(lldb::addr_t ptr);
+
+  lldb::addr_t GetISAHashTablePointer();
+
+  bool UpdateISAToDescriptorMapFromMemory(RemoteNXMapTable &hash_table);
+
+  DescriptorMapUpdateResult
+  UpdateISAToDescriptorMapDynamic(RemoteNXMapTable &hash_table);
+
+  uint32_t ParseClassInfoArray(const lldb_private::DataExtractor &data,
+                               uint32_t num_class_infos);
+
+  DescriptorMapUpdateResult UpdateISAToDescriptorMapSharedCache();
+
+  enum class SharedCacheWarningReason {
+    eExpressionExecutionFailure,
+    eNotEnoughClassesRead
+  };
+
+  void WarnIfNoClassesCached(SharedCacheWarningReason reason);
+
+  lldb::addr_t GetSharedCacheReadOnlyAddress();
+
+  bool GetCFBooleanValuesIfNeeded();
+
+  friend class ClassDescriptorV2;
+
+  std::unique_ptr<UtilityFunction> m_get_class_info_code;
+  lldb::addr_t m_get_class_info_args;
+  std::mutex m_get_class_info_args_mutex;
+
+  std::unique_ptr<UtilityFunction> m_get_shared_cache_class_info_code;
+  lldb::addr_t m_get_shared_cache_class_info_args;
+  std::mutex m_get_shared_cache_class_info_args_mutex;
+
+  std::unique_ptr<DeclVendor> m_decl_vendor_ap;
+  lldb::addr_t m_isa_hash_table_ptr;
+  HashTableSignature m_hash_signature;
+  bool m_has_object_getClass;
+  bool m_loaded_objc_opt;
+  std::unique_ptr<NonPointerISACache> m_non_pointer_isa_cache_ap;
+  std::unique_ptr<TaggedPointerVendor> m_tagged_pointer_vendor_ap;
+  EncodingToTypeSP m_encoding_to_type_sp;
+  bool m_noclasses_warning_emitted;
+  llvm::Optional<std::pair<lldb::addr_t, lldb::addr_t>> m_CFBoolean_values;
 };
-    
+
 } // namespace lldb_private
 
 #endif // liblldb_AppleObjCRuntimeV2_h_

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- AppleObjCTrampolineHandler.cpp ----------------------------*- C++ -*-===//
+//===-- AppleObjCTrampolineHandler.cpp ----------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -43,8 +44,11 @@
 using namespace lldb;
 using namespace lldb_private;
 
-const char *AppleObjCTrampolineHandler::g_lookup_implementation_function_name = "__lldb_objc_find_implementation_for_selector";
-const char *AppleObjCTrampolineHandler::g_lookup_implementation_with_stret_function_code = "                               \n\
+const char *AppleObjCTrampolineHandler::g_lookup_implementation_function_name =
+    "__lldb_objc_find_implementation_for_selector";
+const char *AppleObjCTrampolineHandler::
+    g_lookup_implementation_with_stret_function_code =
+        "                               \n\
 extern \"C\"                                                                                                    \n\
 {                                                                                                               \n\
     extern void *class_getMethodImplementation(void *objc_class, void *sel);                                    \n\
@@ -159,7 +163,9 @@ extern \"C\" void * __lldb_objc_find_imp
     return return_struct.impl_addr;                                                                             \n\
 }                                                                                                               \n\
 ";
-const char *AppleObjCTrampolineHandler::g_lookup_implementation_no_stret_function_code = "                      \n\
+const char *
+    AppleObjCTrampolineHandler::g_lookup_implementation_no_stret_function_code =
+        "                      \n\
 extern \"C\"                                                                                                    \n\
 {                                                                                                               \n\
     extern void *class_getMethodImplementation(void *objc_class, void *sel);                                    \n\
@@ -266,887 +272,879 @@ extern \"C\" void * __lldb_objc_find_imp
 }                                                                                                               \n\
 ";
 
-AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::VTableRegion(AppleObjCVTables *owner, lldb::addr_t header_addr) :
-    m_valid (true),
-    m_owner(owner),
-    m_header_addr (header_addr),
-    m_code_start_addr(0),
-    m_code_end_addr (0),
-    m_next_region (0)
-{
-    SetUpRegion ();
+AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::VTableRegion(
+    AppleObjCVTables *owner, lldb::addr_t header_addr)
+    : m_valid(true), m_owner(owner), m_header_addr(header_addr),
+      m_code_start_addr(0), m_code_end_addr(0), m_next_region(0) {
+  SetUpRegion();
 }
 
-AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler()
-{
-}
+AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler() {}
 
-void
-AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion()
-{
-    // The header looks like:
-    //
-    //   uint16_t headerSize
-    //   uint16_t descSize
-    //   uint32_t descCount
-    //   void * next
-    //
-    // First read in the header:
-    
-    char memory_buffer[16];
-    ProcessSP process_sp = m_owner->GetProcessSP();
-    if (!process_sp)
-        return;
-    DataExtractor data(memory_buffer, sizeof(memory_buffer), 
-                       process_sp->GetByteOrder(),
-                       process_sp->GetAddressByteSize());
-    size_t actual_size = 8 + process_sp->GetAddressByteSize();
-    Error error;
-    size_t bytes_read = process_sp->ReadMemory (m_header_addr, memory_buffer, actual_size, error);
-    if (bytes_read != actual_size)
-    {
-        m_valid = false;
-        return;
-    }
-    
-    lldb::offset_t offset = 0;
-    const uint16_t header_size = data.GetU16(&offset);
-    const uint16_t descriptor_size = data.GetU16(&offset);
-    const size_t num_descriptors = data.GetU32(&offset);
-    
-    m_next_region = data.GetPointer(&offset);
-    
-    // If the header size is 0, that means we've come in too early before this data is set up.
-    // Set ourselves as not valid, and continue.
-    if (header_size == 0 || num_descriptors == 0)
-    {
-        m_valid = false;
-        return;
-    }
-    
-    // Now read in all the descriptors:
-    // The descriptor looks like:
-    //
-    // uint32_t offset
-    // uint32_t flags
-    //
-    // Where offset is either 0 - in which case it is unused, or
-    // it is the offset of the vtable code from the beginning of the descriptor record.
-    // Below, we'll convert that into an absolute code address, since I don't want to have
-    // to compute it over and over.
-    
-    // Ingest the whole descriptor array:
-    const lldb::addr_t desc_ptr = m_header_addr + header_size;
-    const size_t desc_array_size = num_descriptors * descriptor_size;
-    DataBufferSP data_sp(new DataBufferHeap (desc_array_size, '\0'));
-    uint8_t* dst = (uint8_t*)data_sp->GetBytes();
-
-    DataExtractor desc_extractor (dst, desc_array_size,
-                                  process_sp->GetByteOrder(),
-                                  process_sp->GetAddressByteSize());
-    bytes_read = process_sp->ReadMemory(desc_ptr, dst, desc_array_size, error);
-    if (bytes_read != desc_array_size)
-    {
-        m_valid = false;
-        return;
-    }
-    
-    // The actual code for the vtables will be laid out consecutively, so I also
-    // compute the start and end of the whole code block.
-
-    offset = 0;
-    m_code_start_addr = 0;
-    m_code_end_addr = 0;
-
-    for (size_t i = 0; i < num_descriptors; i++)
-    {
-        lldb::addr_t start_offset = offset;
-        uint32_t voffset = desc_extractor.GetU32 (&offset);
-        uint32_t flags  = desc_extractor.GetU32 (&offset);
-        lldb::addr_t code_addr = desc_ptr + start_offset + voffset;
-        m_descriptors.push_back (VTableDescriptor(flags, code_addr));
-        
-        if (m_code_start_addr == 0 || code_addr < m_code_start_addr)
-            m_code_start_addr = code_addr;
-        if (code_addr > m_code_end_addr)
-            m_code_end_addr = code_addr;
-            
-        offset = start_offset + descriptor_size;
-    }
-    // Finally, a little bird told me that all the vtable code blocks are the same size.  
-    // Let's compute the blocks and if they are all the same add the size to the code end address:
-    lldb::addr_t code_size = 0;
-    bool all_the_same = true;
-    for (size_t i = 0; i < num_descriptors - 1; i++)
-    {
-        lldb::addr_t this_size = m_descriptors[i + 1].code_start - m_descriptors[i].code_start;
-        if (code_size == 0)
-            code_size = this_size;
-        else
-        {
-            if (this_size != code_size)
-                all_the_same = false;
-            if (this_size > code_size)
-                code_size = this_size;
-        }
-    }
-    if (all_the_same)
-        m_code_end_addr += code_size;
+void AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion() {
+  // The header looks like:
+  //
+  //   uint16_t headerSize
+  //   uint16_t descSize
+  //   uint32_t descCount
+  //   void * next
+  //
+  // First read in the header:
+
+  char memory_buffer[16];
+  ProcessSP process_sp = m_owner->GetProcessSP();
+  if (!process_sp)
+    return;
+  DataExtractor data(memory_buffer, sizeof(memory_buffer),
+                     process_sp->GetByteOrder(),
+                     process_sp->GetAddressByteSize());
+  size_t actual_size = 8 + process_sp->GetAddressByteSize();
+  Error error;
+  size_t bytes_read =
+      process_sp->ReadMemory(m_header_addr, memory_buffer, actual_size, error);
+  if (bytes_read != actual_size) {
+    m_valid = false;
+    return;
+  }
+
+  lldb::offset_t offset = 0;
+  const uint16_t header_size = data.GetU16(&offset);
+  const uint16_t descriptor_size = data.GetU16(&offset);
+  const size_t num_descriptors = data.GetU32(&offset);
+
+  m_next_region = data.GetPointer(&offset);
+
+  // If the header size is 0, that means we've come in too early before this
+  // data is set up.
+  // Set ourselves as not valid, and continue.
+  if (header_size == 0 || num_descriptors == 0) {
+    m_valid = false;
+    return;
+  }
+
+  // Now read in all the descriptors:
+  // The descriptor looks like:
+  //
+  // uint32_t offset
+  // uint32_t flags
+  //
+  // Where offset is either 0 - in which case it is unused, or
+  // it is the offset of the vtable code from the beginning of the descriptor
+  // record.
+  // Below, we'll convert that into an absolute code address, since I don't want
+  // to have
+  // to compute it over and over.
+
+  // Ingest the whole descriptor array:
+  const lldb::addr_t desc_ptr = m_header_addr + header_size;
+  const size_t desc_array_size = num_descriptors * descriptor_size;
+  DataBufferSP data_sp(new DataBufferHeap(desc_array_size, '\0'));
+  uint8_t *dst = (uint8_t *)data_sp->GetBytes();
+
+  DataExtractor desc_extractor(dst, desc_array_size, process_sp->GetByteOrder(),
+                               process_sp->GetAddressByteSize());
+  bytes_read = process_sp->ReadMemory(desc_ptr, dst, desc_array_size, error);
+  if (bytes_read != desc_array_size) {
+    m_valid = false;
+    return;
+  }
+
+  // The actual code for the vtables will be laid out consecutively, so I also
+  // compute the start and end of the whole code block.
+
+  offset = 0;
+  m_code_start_addr = 0;
+  m_code_end_addr = 0;
+
+  for (size_t i = 0; i < num_descriptors; i++) {
+    lldb::addr_t start_offset = offset;
+    uint32_t voffset = desc_extractor.GetU32(&offset);
+    uint32_t flags = desc_extractor.GetU32(&offset);
+    lldb::addr_t code_addr = desc_ptr + start_offset + voffset;
+    m_descriptors.push_back(VTableDescriptor(flags, code_addr));
+
+    if (m_code_start_addr == 0 || code_addr < m_code_start_addr)
+      m_code_start_addr = code_addr;
+    if (code_addr > m_code_end_addr)
+      m_code_end_addr = code_addr;
+
+    offset = start_offset + descriptor_size;
+  }
+  // Finally, a little bird told me that all the vtable code blocks are the same
+  // size.
+  // Let's compute the blocks and if they are all the same add the size to the
+  // code end address:
+  lldb::addr_t code_size = 0;
+  bool all_the_same = true;
+  for (size_t i = 0; i < num_descriptors - 1; i++) {
+    lldb::addr_t this_size =
+        m_descriptors[i + 1].code_start - m_descriptors[i].code_start;
+    if (code_size == 0)
+      code_size = this_size;
+    else {
+      if (this_size != code_size)
+        all_the_same = false;
+      if (this_size > code_size)
+        code_size = this_size;
+    }
+  }
+  if (all_the_same)
+    m_code_end_addr += code_size;
 }
 
-bool 
-AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::AddressInRegion (lldb::addr_t addr, uint32_t &flags)
-{
-    if (!IsValid())
-        return false;
-        
-    if (addr < m_code_start_addr || addr > m_code_end_addr)
-        return false;
-        
-    std::vector<VTableDescriptor>::iterator pos, end = m_descriptors.end();
-    for (pos = m_descriptors.begin(); pos != end; pos++)
-    {
-        if (addr <= (*pos).code_start)
-        {
-            flags = (*pos).flags;
-            return true;
-        }
-    }
+bool AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::
+    AddressInRegion(lldb::addr_t addr, uint32_t &flags) {
+  if (!IsValid())
+    return false;
+
+  if (addr < m_code_start_addr || addr > m_code_end_addr)
     return false;
-}
 
-void
-AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::Dump (Stream &s)
-{
-    s.Printf ("Header addr: 0x%" PRIx64 " Code start: 0x%" PRIx64 " Code End: 0x%" PRIx64 " Next: 0x%" PRIx64 "\n",
-              m_header_addr, m_code_start_addr, m_code_end_addr, m_next_region);
-    size_t num_elements = m_descriptors.size();
-    for (size_t i = 0; i < num_elements; i++)
-    {
-        s.Indent();
-        s.Printf ("Code start: 0x%" PRIx64 " Flags: %d\n", m_descriptors[i].code_start, m_descriptors[i].flags);
+  std::vector<VTableDescriptor>::iterator pos, end = m_descriptors.end();
+  for (pos = m_descriptors.begin(); pos != end; pos++) {
+    if (addr <= (*pos).code_start) {
+      flags = (*pos).flags;
+      return true;
     }
+  }
+  return false;
 }
-        
-AppleObjCTrampolineHandler::AppleObjCVTables::AppleObjCVTables (const ProcessSP &process_sp, 
-                                                                const ModuleSP &objc_module_sp) :
-    m_process_wp (),
-    m_trampoline_header (LLDB_INVALID_ADDRESS),
-    m_trampolines_changed_bp_id (LLDB_INVALID_BREAK_ID),
-    m_objc_module_sp (objc_module_sp)
-{
-    if (process_sp)
-        m_process_wp = process_sp;
+
+void AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::Dump(
+    Stream &s) {
+  s.Printf("Header addr: 0x%" PRIx64 " Code start: 0x%" PRIx64
+           " Code End: 0x%" PRIx64 " Next: 0x%" PRIx64 "\n",
+           m_header_addr, m_code_start_addr, m_code_end_addr, m_next_region);
+  size_t num_elements = m_descriptors.size();
+  for (size_t i = 0; i < num_elements; i++) {
+    s.Indent();
+    s.Printf("Code start: 0x%" PRIx64 " Flags: %d\n",
+             m_descriptors[i].code_start, m_descriptors[i].flags);
+  }
 }
 
-AppleObjCTrampolineHandler::AppleObjCVTables::~AppleObjCVTables()
-{
-    ProcessSP process_sp = GetProcessSP ();
-    if (process_sp)
-    {
-        if (m_trampolines_changed_bp_id != LLDB_INVALID_BREAK_ID)
-            process_sp->GetTarget().RemoveBreakpointByID (m_trampolines_changed_bp_id);
-    }
+AppleObjCTrampolineHandler::AppleObjCVTables::AppleObjCVTables(
+    const ProcessSP &process_sp, const ModuleSP &objc_module_sp)
+    : m_process_wp(), m_trampoline_header(LLDB_INVALID_ADDRESS),
+      m_trampolines_changed_bp_id(LLDB_INVALID_BREAK_ID),
+      m_objc_module_sp(objc_module_sp) {
+  if (process_sp)
+    m_process_wp = process_sp;
 }
 
-bool
-AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols ()
-{
-    if (m_trampoline_header != LLDB_INVALID_ADDRESS)
-        return true;
+AppleObjCTrampolineHandler::AppleObjCVTables::~AppleObjCVTables() {
+  ProcessSP process_sp = GetProcessSP();
+  if (process_sp) {
+    if (m_trampolines_changed_bp_id != LLDB_INVALID_BREAK_ID)
+      process_sp->GetTarget().RemoveBreakpointByID(m_trampolines_changed_bp_id);
+  }
+}
 
-    ProcessSP process_sp = GetProcessSP ();
-    if (process_sp)
-    {
-        Target &target = process_sp->GetTarget();
-        
-        const ModuleList &target_modules = target.GetImages();
-        std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
-        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)))
-                {
-                    m_objc_module_sp = target_modules.GetModuleAtIndexUnlocked(i);
-                    break;
-                }
-            }
-        }
-        
-        if (m_objc_module_sp)
-        {
-            ConstString trampoline_name ("gdb_objc_trampolines");
-            const Symbol *trampoline_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType (trampoline_name, 
-                                                                                                eSymbolTypeData);
-            if (trampoline_symbol != NULL)
-            {
-                m_trampoline_header = trampoline_symbol->GetLoadAddress(&target);
-                if (m_trampoline_header == LLDB_INVALID_ADDRESS)
-                    return false;
-                
-                // Next look up the "changed" symbol and set a breakpoint on that...
-                ConstString changed_name ("gdb_objc_trampolines_changed");
-                const Symbol *changed_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType (changed_name, 
-                                                                                                 eSymbolTypeCode);
-                if (changed_symbol != NULL)
-                {
-                    const Address changed_symbol_addr = changed_symbol->GetAddress();
-                    if (!changed_symbol_addr.IsValid())
-                        return false;
-                        
-                    lldb::addr_t changed_addr = changed_symbol_addr.GetOpcodeLoadAddress (&target);
-                    if (changed_addr != LLDB_INVALID_ADDRESS)
-                    {
-                        BreakpointSP trampolines_changed_bp_sp = target.CreateBreakpoint (changed_addr, true, false);
-                        if (trampolines_changed_bp_sp)
-                        {
-                            m_trampolines_changed_bp_id = trampolines_changed_bp_sp->GetID();
-                            trampolines_changed_bp_sp->SetCallback (RefreshTrampolines, this, true);
-                            trampolines_changed_bp_sp->SetBreakpointKind ("objc-trampolines-changed");
-                            return true;
-                        }
-                    }
-                }
-            }
+bool AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols() {
+  if (m_trampoline_header != LLDB_INVALID_ADDRESS)
+    return true;
+
+  ProcessSP process_sp = GetProcessSP();
+  if (process_sp) {
+    Target &target = process_sp->GetTarget();
+
+    const ModuleList &target_modules = target.GetImages();
+    std::lock_guard<std::recursive_mutex> guard(target_modules.GetMutex());
+    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))) {
+          m_objc_module_sp = target_modules.GetModuleAtIndexUnlocked(i);
+          break;
         }
+      }
     }
-    return false;
-}
-    
-bool 
-AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines (void *baton, 
-                                                                  StoppointCallbackContext *context, 
-                                                                  lldb::user_id_t break_id, 
-                                                                  lldb::user_id_t break_loc_id)
-{
-    AppleObjCVTables *vtable_handler = (AppleObjCVTables *) baton;
-    if (vtable_handler->InitializeVTableSymbols())
-    {
-        // The Update function is called with the address of an added region.  So we grab that address, and
-        // feed it into ReadRegions.  Of course, our friend the ABI will get the values for us.
-        ExecutionContext exe_ctx (context->exe_ctx_ref);
-        Process *process = exe_ctx.GetProcessPtr();
-        const ABI *abi = process->GetABI().get();
-        
-        ClangASTContext *clang_ast_context = process->GetTarget().GetScratchClangASTContext();
-        ValueList argument_values;
-        Value input_value;
-        CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
-
-        input_value.SetValueType (Value::eValueTypeScalar);
-        //input_value.SetContext (Value::eContextTypeClangType, clang_void_ptr_type);
-        input_value.SetCompilerType (clang_void_ptr_type);
-        argument_values.PushValue(input_value);
-        
-        bool success = abi->GetArgumentValues (exe_ctx.GetThreadRef(), argument_values);
-        if (!success)
+
+    if (m_objc_module_sp) {
+      ConstString trampoline_name("gdb_objc_trampolines");
+      const Symbol *trampoline_symbol =
+          m_objc_module_sp->FindFirstSymbolWithNameAndType(trampoline_name,
+                                                           eSymbolTypeData);
+      if (trampoline_symbol != NULL) {
+        m_trampoline_header = trampoline_symbol->GetLoadAddress(&target);
+        if (m_trampoline_header == LLDB_INVALID_ADDRESS)
+          return false;
+
+        // Next look up the "changed" symbol and set a breakpoint on that...
+        ConstString changed_name("gdb_objc_trampolines_changed");
+        const Symbol *changed_symbol =
+            m_objc_module_sp->FindFirstSymbolWithNameAndType(changed_name,
+                                                             eSymbolTypeCode);
+        if (changed_symbol != NULL) {
+          const Address changed_symbol_addr = changed_symbol->GetAddress();
+          if (!changed_symbol_addr.IsValid())
             return false;
-            
-        // Now get a pointer value from the zeroth argument.
-        Error error;
-        DataExtractor data;
-        error = argument_values.GetValueAtIndex(0)->GetValueAsData (&exe_ctx, 
-                                                                    data, 
-                                                                    0,
-                                                                    NULL);
-        lldb::offset_t offset = 0;
-        lldb::addr_t region_addr = data.GetPointer(&offset);
-        
-        if (region_addr != 0)
-            vtable_handler->ReadRegions(region_addr);
+
+          lldb::addr_t changed_addr =
+              changed_symbol_addr.GetOpcodeLoadAddress(&target);
+          if (changed_addr != LLDB_INVALID_ADDRESS) {
+            BreakpointSP trampolines_changed_bp_sp =
+                target.CreateBreakpoint(changed_addr, true, false);
+            if (trampolines_changed_bp_sp) {
+              m_trampolines_changed_bp_id = trampolines_changed_bp_sp->GetID();
+              trampolines_changed_bp_sp->SetCallback(RefreshTrampolines, this,
+                                                     true);
+              trampolines_changed_bp_sp->SetBreakpointKind(
+                  "objc-trampolines-changed");
+              return true;
+            }
+          }
+        }
+      }
     }
-    return false;
+  }
+  return false;
 }
 
-bool
-AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions ()
-{
-    // The no argument version reads the start region from the value of the gdb_regions_header, and 
-    // gets started from there.
-    
-    m_regions.clear();
-    if (!InitializeVTableSymbols())
-        return false;
+bool AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(
+    void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
+    lldb::user_id_t break_loc_id) {
+  AppleObjCVTables *vtable_handler = (AppleObjCVTables *)baton;
+  if (vtable_handler->InitializeVTableSymbols()) {
+    // The Update function is called with the address of an added region.  So we
+    // grab that address, and
+    // feed it into ReadRegions.  Of course, our friend the ABI will get the
+    // values for us.
+    ExecutionContext exe_ctx(context->exe_ctx_ref);
+    Process *process = exe_ctx.GetProcessPtr();
+    const ABI *abi = process->GetABI().get();
+
+    ClangASTContext *clang_ast_context =
+        process->GetTarget().GetScratchClangASTContext();
+    ValueList argument_values;
+    Value input_value;
+    CompilerType clang_void_ptr_type =
+        clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
+
+    input_value.SetValueType(Value::eValueTypeScalar);
+    // input_value.SetContext (Value::eContextTypeClangType,
+    // clang_void_ptr_type);
+    input_value.SetCompilerType(clang_void_ptr_type);
+    argument_values.PushValue(input_value);
+
+    bool success =
+        abi->GetArgumentValues(exe_ctx.GetThreadRef(), argument_values);
+    if (!success)
+      return false;
+
+    // Now get a pointer value from the zeroth argument.
     Error error;
-    ProcessSP process_sp = GetProcessSP ();
-    if (process_sp)
-    {
-        lldb::addr_t region_addr = process_sp->ReadPointerFromMemory (m_trampoline_header, error);
-        if (error.Success())
-            return ReadRegions (region_addr);
-    }
+    DataExtractor data;
+    error = argument_values.GetValueAtIndex(0)->GetValueAsData(&exe_ctx, data,
+                                                               0, NULL);
+    lldb::offset_t offset = 0;
+    lldb::addr_t region_addr = data.GetPointer(&offset);
+
+    if (region_addr != 0)
+      vtable_handler->ReadRegions(region_addr);
+  }
+  return false;
+}
+
+bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions() {
+  // The no argument version reads the start region from the value of the
+  // gdb_regions_header, and
+  // gets started from there.
+
+  m_regions.clear();
+  if (!InitializeVTableSymbols())
     return false;
+  Error error;
+  ProcessSP process_sp = GetProcessSP();
+  if (process_sp) {
+    lldb::addr_t region_addr =
+        process_sp->ReadPointerFromMemory(m_trampoline_header, error);
+    if (error.Success())
+      return ReadRegions(region_addr);
+  }
+  return false;
 }
 
-bool
-AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions (lldb::addr_t region_addr)
-{
-    ProcessSP process_sp = GetProcessSP ();
-    if (!process_sp)
-        return false;
-        
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
-    
-    // We aren't starting at the trampoline symbol.
-    InitializeVTableSymbols ();
-    lldb::addr_t next_region = region_addr;
-    
-    // Read in the sizes of the headers.
-    while (next_region != 0) 
-    {
-        m_regions.push_back (VTableRegion(this, next_region));
-        if (!m_regions.back().IsValid())
-        {
-            m_regions.clear();
-            return false;
-        }
-        if (log)
-        {
-            StreamString s;
-            m_regions.back().Dump(s);
-            log->Printf("Read vtable region: \n%s", s.GetData());
-        }
-        
-        next_region = m_regions.back().GetNextRegionAddr();
+bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions(
+    lldb::addr_t region_addr) {
+  ProcessSP process_sp = GetProcessSP();
+  if (!process_sp)
+    return false;
+
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
+
+  // We aren't starting at the trampoline symbol.
+  InitializeVTableSymbols();
+  lldb::addr_t next_region = region_addr;
+
+  // Read in the sizes of the headers.
+  while (next_region != 0) {
+    m_regions.push_back(VTableRegion(this, next_region));
+    if (!m_regions.back().IsValid()) {
+      m_regions.clear();
+      return false;
     }
-    
-    return true;
-}
-    
-bool
-AppleObjCTrampolineHandler::AppleObjCVTables::IsAddressInVTables (lldb::addr_t addr, uint32_t &flags)
-{
-    region_collection::iterator pos, end = m_regions.end();
-    for (pos = m_regions.begin(); pos != end; pos++)
-    {
-        if ((*pos).AddressInRegion (addr, flags))
-            return true;
+    if (log) {
+      StreamString s;
+      m_regions.back().Dump(s);
+      log->Printf("Read vtable region: \n%s", s.GetData());
     }
-    return false;
+
+    next_region = m_regions.back().GetNextRegionAddr();
+  }
+
+  return true;
+}
+
+bool AppleObjCTrampolineHandler::AppleObjCVTables::IsAddressInVTables(
+    lldb::addr_t addr, uint32_t &flags) {
+  region_collection::iterator pos, end = m_regions.end();
+  for (pos = m_regions.begin(); pos != end; pos++) {
+    if ((*pos).AddressInRegion(addr, flags))
+      return true;
+  }
+  return false;
 }
 
 const AppleObjCTrampolineHandler::DispatchFunction
-AppleObjCTrampolineHandler::g_dispatch_functions[] =
-{
-    // NAME                              STRET  SUPER  SUPER2  FIXUP TYPE
-    {"objc_msgSend",                     false, false, false, DispatchFunction::eFixUpNone    },
-    {"objc_msgSend_fixup",               false, false, false, DispatchFunction::eFixUpToFix   },
-    {"objc_msgSend_fixedup",             false, false, false, DispatchFunction::eFixUpFixed   },
-    {"objc_msgSend_stret",               true,  false, false, DispatchFunction::eFixUpNone    },
-    {"objc_msgSend_stret_fixup",         true,  false, false, DispatchFunction::eFixUpToFix   },
-    {"objc_msgSend_stret_fixedup",       true,  false, false, DispatchFunction::eFixUpFixed   },
-    {"objc_msgSend_fpret",               false, false, false, DispatchFunction::eFixUpNone    },
-    {"objc_msgSend_fpret_fixup",         false, false, false, DispatchFunction::eFixUpToFix   },
-    {"objc_msgSend_fpret_fixedup",       false, false, false, DispatchFunction::eFixUpFixed   },
-    {"objc_msgSend_fp2ret",              false, false,  true, DispatchFunction::eFixUpNone    },
-    {"objc_msgSend_fp2ret_fixup",        false, false,  true, DispatchFunction::eFixUpToFix   },
-    {"objc_msgSend_fp2ret_fixedup",      false, false,  true, DispatchFunction::eFixUpFixed   },
-    {"objc_msgSendSuper",                false, true,  false, DispatchFunction::eFixUpNone    },
-    {"objc_msgSendSuper_stret",          true,  true,  false, DispatchFunction::eFixUpNone    },
-    {"objc_msgSendSuper2",               false, true,   true, DispatchFunction::eFixUpNone    },
-    {"objc_msgSendSuper2_fixup",         false, true,   true, DispatchFunction::eFixUpToFix   },
-    {"objc_msgSendSuper2_fixedup",       false, true,   true, DispatchFunction::eFixUpFixed   },
-    {"objc_msgSendSuper2_stret",         true,  true,   true, DispatchFunction::eFixUpNone    },
-    {"objc_msgSendSuper2_stret_fixup",   true,  true,   true, DispatchFunction::eFixUpToFix   },
-    {"objc_msgSendSuper2_stret_fixedup", true,  true,   true, DispatchFunction::eFixUpFixed   },
+    AppleObjCTrampolineHandler::g_dispatch_functions[] = {
+        // NAME                              STRET  SUPER  SUPER2  FIXUP TYPE
+        {"objc_msgSend", false, false, false, DispatchFunction::eFixUpNone},
+        {"objc_msgSend_fixup", false, false, false,
+         DispatchFunction::eFixUpToFix},
+        {"objc_msgSend_fixedup", false, false, false,
+         DispatchFunction::eFixUpFixed},
+        {"objc_msgSend_stret", true, false, false,
+         DispatchFunction::eFixUpNone},
+        {"objc_msgSend_stret_fixup", true, false, false,
+         DispatchFunction::eFixUpToFix},
+        {"objc_msgSend_stret_fixedup", true, false, false,
+         DispatchFunction::eFixUpFixed},
+        {"objc_msgSend_fpret", false, false, false,
+         DispatchFunction::eFixUpNone},
+        {"objc_msgSend_fpret_fixup", false, false, false,
+         DispatchFunction::eFixUpToFix},
+        {"objc_msgSend_fpret_fixedup", false, false, false,
+         DispatchFunction::eFixUpFixed},
+        {"objc_msgSend_fp2ret", false, false, true,
+         DispatchFunction::eFixUpNone},
+        {"objc_msgSend_fp2ret_fixup", false, false, true,
+         DispatchFunction::eFixUpToFix},
+        {"objc_msgSend_fp2ret_fixedup", false, false, true,
+         DispatchFunction::eFixUpFixed},
+        {"objc_msgSendSuper", false, true, false, DispatchFunction::eFixUpNone},
+        {"objc_msgSendSuper_stret", true, true, false,
+         DispatchFunction::eFixUpNone},
+        {"objc_msgSendSuper2", false, true, true, DispatchFunction::eFixUpNone},
+        {"objc_msgSendSuper2_fixup", false, true, true,
+         DispatchFunction::eFixUpToFix},
+        {"objc_msgSendSuper2_fixedup", false, true, true,
+         DispatchFunction::eFixUpFixed},
+        {"objc_msgSendSuper2_stret", true, true, true,
+         DispatchFunction::eFixUpNone},
+        {"objc_msgSendSuper2_stret_fixup", true, true, true,
+         DispatchFunction::eFixUpToFix},
+        {"objc_msgSendSuper2_stret_fixedup", true, true, true,
+         DispatchFunction::eFixUpFixed},
 };
 
-AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (const ProcessSP &process_sp, 
-                                                        const ModuleSP &objc_module_sp) :
-    m_process_wp (),
-    m_objc_module_sp (objc_module_sp),
-    m_lookup_implementation_function_code(nullptr),
-    m_impl_fn_addr (LLDB_INVALID_ADDRESS),
-    m_impl_stret_fn_addr (LLDB_INVALID_ADDRESS),
-    m_msg_forward_addr (LLDB_INVALID_ADDRESS)
-{
-    if (process_sp)
-        m_process_wp = process_sp;
-    // Look up the known resolution functions:
-    
-    ConstString get_impl_name("class_getMethodImplementation");
-    ConstString get_impl_stret_name("class_getMethodImplementation_stret");
-    ConstString msg_forward_name("_objc_msgForward");
-    ConstString msg_forward_stret_name("_objc_msgForward_stret");
-    
-    Target *target = process_sp ? &process_sp->GetTarget() : NULL;
-    const Symbol *class_getMethodImplementation = m_objc_module_sp->FindFirstSymbolWithNameAndType (get_impl_name, eSymbolTypeCode);
-    const Symbol *class_getMethodImplementation_stret = m_objc_module_sp->FindFirstSymbolWithNameAndType (get_impl_stret_name, eSymbolTypeCode);
-    const Symbol *msg_forward = m_objc_module_sp->FindFirstSymbolWithNameAndType (msg_forward_name, eSymbolTypeCode);
-    const Symbol *msg_forward_stret = m_objc_module_sp->FindFirstSymbolWithNameAndType (msg_forward_stret_name, eSymbolTypeCode);
-    
-    if (class_getMethodImplementation)
-        m_impl_fn_addr = class_getMethodImplementation->GetAddress().GetOpcodeLoadAddress (target);
-    if  (class_getMethodImplementation_stret)
-        m_impl_stret_fn_addr = class_getMethodImplementation_stret->GetAddress().GetOpcodeLoadAddress (target);
-    if (msg_forward)
-        m_msg_forward_addr = msg_forward->GetAddress().GetOpcodeLoadAddress(target);
-    if  (msg_forward_stret)
-        m_msg_forward_stret_addr = msg_forward_stret->GetAddress().GetOpcodeLoadAddress(target);
-    
-    // FIXME: Do some kind of logging here.
-    if (m_impl_fn_addr == LLDB_INVALID_ADDRESS)
-    {
-        // If we can't even find the ordinary get method implementation function, then we aren't going to be able to
-        // step through any method dispatches.  Warn to that effect and get out of here.
-        if (process_sp->CanJIT())
-        {
-            process_sp->GetTarget().GetDebugger().GetErrorFile()->Printf ("Could not find implementation lookup function \"%s\""
-                                                                          " step in through ObjC method dispatch will not work.\n",
-                                                                          get_impl_name.AsCString());
-        }
-        return;
-    }
-    else if (m_impl_stret_fn_addr == LLDB_INVALID_ADDRESS)
-    {
-        // It there is no stret return lookup function, assume that it is the same as the straight lookup:
-        m_impl_stret_fn_addr = m_impl_fn_addr;
-        // Also we will use the version of the lookup code that doesn't rely on the stret version of the function.
-        m_lookup_implementation_function_code = g_lookup_implementation_no_stret_function_code;
-    }
-    else
-    {
-        m_lookup_implementation_function_code = g_lookup_implementation_with_stret_function_code;
-    }
-        
-    // Look up the addresses for the objc dispatch functions and cache them.  For now I'm inspecting the symbol
-    // names dynamically to figure out how to dispatch to them.  If it becomes more complicated than this we can 
-    // turn the g_dispatch_functions char * array into a template table, and populate the DispatchFunction map
-    // from there.
-
-    for (size_t i = 0; i != llvm::array_lengthof(g_dispatch_functions); i++)
-    {
-        ConstString name_const_str(g_dispatch_functions[i].name);
-        const Symbol *msgSend_symbol = m_objc_module_sp->FindFirstSymbolWithNameAndType (name_const_str, eSymbolTypeCode);
-        if (msgSend_symbol && msgSend_symbol->ValueIsAddress())
-        {
-            // FixMe: Make g_dispatch_functions static table of DispatchFunctions, and have the map be address->index.
-            // Problem is we also need to lookup the dispatch function.  For now we could have a side table of stret & non-stret
-            // dispatch functions.  If that's as complex as it gets, we're fine.
-            
-            lldb::addr_t sym_addr = msgSend_symbol->GetAddressRef().GetOpcodeLoadAddress(target);
-            
-            m_msgSend_map.insert(std::pair<lldb::addr_t, int>(sym_addr, i));
-        }
-    }
-    
-    // Build our vtable dispatch handler here:
-    m_vtables_ap.reset(new AppleObjCVTables(process_sp, m_objc_module_sp));
-    if (m_vtables_ap.get())
-        m_vtables_ap->ReadRegions();        
+AppleObjCTrampolineHandler::AppleObjCTrampolineHandler(
+    const ProcessSP &process_sp, const ModuleSP &objc_module_sp)
+    : m_process_wp(), m_objc_module_sp(objc_module_sp),
+      m_lookup_implementation_function_code(nullptr),
+      m_impl_fn_addr(LLDB_INVALID_ADDRESS),
+      m_impl_stret_fn_addr(LLDB_INVALID_ADDRESS),
+      m_msg_forward_addr(LLDB_INVALID_ADDRESS) {
+  if (process_sp)
+    m_process_wp = process_sp;
+  // Look up the known resolution functions:
+
+  ConstString get_impl_name("class_getMethodImplementation");
+  ConstString get_impl_stret_name("class_getMethodImplementation_stret");
+  ConstString msg_forward_name("_objc_msgForward");
+  ConstString msg_forward_stret_name("_objc_msgForward_stret");
+
+  Target *target = process_sp ? &process_sp->GetTarget() : NULL;
+  const Symbol *class_getMethodImplementation =
+      m_objc_module_sp->FindFirstSymbolWithNameAndType(get_impl_name,
+                                                       eSymbolTypeCode);
+  const Symbol *class_getMethodImplementation_stret =
+      m_objc_module_sp->FindFirstSymbolWithNameAndType(get_impl_stret_name,
+                                                       eSymbolTypeCode);
+  const Symbol *msg_forward = m_objc_module_sp->FindFirstSymbolWithNameAndType(
+      msg_forward_name, eSymbolTypeCode);
+  const Symbol *msg_forward_stret =
+      m_objc_module_sp->FindFirstSymbolWithNameAndType(msg_forward_stret_name,
+                                                       eSymbolTypeCode);
+
+  if (class_getMethodImplementation)
+    m_impl_fn_addr =
+        class_getMethodImplementation->GetAddress().GetOpcodeLoadAddress(
+            target);
+  if (class_getMethodImplementation_stret)
+    m_impl_stret_fn_addr =
+        class_getMethodImplementation_stret->GetAddress().GetOpcodeLoadAddress(
+            target);
+  if (msg_forward)
+    m_msg_forward_addr = msg_forward->GetAddress().GetOpcodeLoadAddress(target);
+  if (msg_forward_stret)
+    m_msg_forward_stret_addr =
+        msg_forward_stret->GetAddress().GetOpcodeLoadAddress(target);
+
+  // FIXME: Do some kind of logging here.
+  if (m_impl_fn_addr == LLDB_INVALID_ADDRESS) {
+    // If we can't even find the ordinary get method implementation function,
+    // then we aren't going to be able to
+    // step through any method dispatches.  Warn to that effect and get out of
+    // here.
+    if (process_sp->CanJIT()) {
+      process_sp->GetTarget().GetDebugger().GetErrorFile()->Printf(
+          "Could not find implementation lookup function \"%s\""
+          " step in through ObjC method dispatch will not work.\n",
+          get_impl_name.AsCString());
+    }
+    return;
+  } else if (m_impl_stret_fn_addr == LLDB_INVALID_ADDRESS) {
+    // It there is no stret return lookup function, assume that it is the same
+    // as the straight lookup:
+    m_impl_stret_fn_addr = m_impl_fn_addr;
+    // Also we will use the version of the lookup code that doesn't rely on the
+    // stret version of the function.
+    m_lookup_implementation_function_code =
+        g_lookup_implementation_no_stret_function_code;
+  } else {
+    m_lookup_implementation_function_code =
+        g_lookup_implementation_with_stret_function_code;
+  }
+
+  // Look up the addresses for the objc dispatch functions and cache them.  For
+  // now I'm inspecting the symbol
+  // names dynamically to figure out how to dispatch to them.  If it becomes
+  // more complicated than this we can
+  // turn the g_dispatch_functions char * array into a template table, and
+  // populate the DispatchFunction map
+  // from there.
+
+  for (size_t i = 0; i != llvm::array_lengthof(g_dispatch_functions); i++) {
+    ConstString name_const_str(g_dispatch_functions[i].name);
+    const Symbol *msgSend_symbol =
+        m_objc_module_sp->FindFirstSymbolWithNameAndType(name_const_str,
+                                                         eSymbolTypeCode);
+    if (msgSend_symbol && msgSend_symbol->ValueIsAddress()) {
+      // FixMe: Make g_dispatch_functions static table of DispatchFunctions, and
+      // have the map be address->index.
+      // Problem is we also need to lookup the dispatch function.  For now we
+      // could have a side table of stret & non-stret
+      // dispatch functions.  If that's as complex as it gets, we're fine.
+
+      lldb::addr_t sym_addr =
+          msgSend_symbol->GetAddressRef().GetOpcodeLoadAddress(target);
+
+      m_msgSend_map.insert(std::pair<lldb::addr_t, int>(sym_addr, i));
+    }
+  }
+
+  // Build our vtable dispatch handler here:
+  m_vtables_ap.reset(new AppleObjCVTables(process_sp, m_objc_module_sp));
+  if (m_vtables_ap.get())
+    m_vtables_ap->ReadRegions();
 }
 
 lldb::addr_t
-AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread, ValueList &dispatch_values)
-{
-    ThreadSP thread_sp(thread.shared_from_this());
-    ExecutionContext exe_ctx (thread_sp);
-    DiagnosticManager diagnostics;
-    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
-
-    lldb::addr_t args_addr = LLDB_INVALID_ADDRESS;
-    FunctionCaller *impl_function_caller = nullptr;
+AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
+                                                  ValueList &dispatch_values) {
+  ThreadSP thread_sp(thread.shared_from_this());
+  ExecutionContext exe_ctx(thread_sp);
+  DiagnosticManager diagnostics;
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
+
+  lldb::addr_t args_addr = LLDB_INVALID_ADDRESS;
+  FunctionCaller *impl_function_caller = nullptr;
+
+  // Scope for mutex locker:
+  {
+    std::lock_guard<std::mutex> guard(m_impl_function_mutex);
 
-    // Scope for mutex locker:
-    {
-        std::lock_guard<std::mutex> guard(m_impl_function_mutex);
-
-        // First stage is to make the ClangUtility to hold our injected function:
-
-        if (!m_impl_code.get())
-        {
-            if (m_lookup_implementation_function_code != NULL)
-            {
-                Error error;
-                m_impl_code.reset (exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage (m_lookup_implementation_function_code,
-                                                                                         eLanguageTypeObjC,
-                                                                                         g_lookup_implementation_function_name,
-                                                                                         error));
-                if (error.Fail())
-                {
-                    if (log)
-                        log->Printf ("Failed to get Utility Function for implementation lookup: %s.", error.AsCString());
-                    m_impl_code.reset();
-                    return args_addr;
-                }
-
-                if (!m_impl_code->Install(diagnostics, exe_ctx))
-                {
-                    if (log)
-                    {
-                        log->Printf("Failed to install implementation lookup.");
-                        diagnostics.Dump(log);
-                    }
-                    m_impl_code.reset();
-                    return args_addr;
-                }
-            }
-            else
-            {
-                if (log)
-                    log->Printf("No method lookup implementation code.");
-                return LLDB_INVALID_ADDRESS;
-            }
+    // First stage is to make the ClangUtility to hold our injected function:
 
-            // Next make the runner function for our implementation utility function.
-            ClangASTContext *clang_ast_context = thread.GetProcess()->GetTarget().GetScratchClangASTContext();
-            CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
-            Error error;
-            
-            impl_function_caller = m_impl_code->MakeFunctionCaller(clang_void_ptr_type,
-                                                                   dispatch_values,
-                                                                   thread_sp,
-                                                                   error);
-            if (error.Fail())
-            {
-                if (log)
-                    log->Printf ("Error getting function caller for dispatch lookup: \"%s\".", error.AsCString());
-                return args_addr;
-            }
-        }
-        else
-        {
-            impl_function_caller = m_impl_code->GetFunctionCaller();
+    if (!m_impl_code.get()) {
+      if (m_lookup_implementation_function_code != NULL) {
+        Error error;
+        m_impl_code.reset(exe_ctx.GetTargetRef().GetUtilityFunctionForLanguage(
+            m_lookup_implementation_function_code, eLanguageTypeObjC,
+            g_lookup_implementation_function_name, error));
+        if (error.Fail()) {
+          if (log)
+            log->Printf(
+                "Failed to get Utility Function for implementation lookup: %s.",
+                error.AsCString());
+          m_impl_code.reset();
+          return args_addr;
         }
-    }
-
-    diagnostics.Clear();
 
-    // Now write down the argument values for this particular call.  This looks like it might be a race condition
-    // if other threads were calling into here, but actually it isn't because we allocate a new args structure for
-    // this call by passing args_addr = LLDB_INVALID_ADDRESS...
-
-    if (!impl_function_caller->WriteFunctionArguments(exe_ctx, args_addr, dispatch_values, diagnostics))
-    {
-        if (log)
-        {
-            log->Printf("Error writing function arguments.");
+        if (!m_impl_code->Install(diagnostics, exe_ctx)) {
+          if (log) {
+            log->Printf("Failed to install implementation lookup.");
             diagnostics.Dump(log);
+          }
+          m_impl_code.reset();
+          return args_addr;
         }
+      } else {
+        if (log)
+          log->Printf("No method lookup implementation code.");
+        return LLDB_INVALID_ADDRESS;
+      }
+
+      // Next make the runner function for our implementation utility function.
+      ClangASTContext *clang_ast_context =
+          thread.GetProcess()->GetTarget().GetScratchClangASTContext();
+      CompilerType clang_void_ptr_type =
+          clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
+      Error error;
+
+      impl_function_caller = m_impl_code->MakeFunctionCaller(
+          clang_void_ptr_type, dispatch_values, thread_sp, error);
+      if (error.Fail()) {
+        if (log)
+          log->Printf(
+              "Error getting function caller for dispatch lookup: \"%s\".",
+              error.AsCString());
         return args_addr;
+      }
+    } else {
+      impl_function_caller = m_impl_code->GetFunctionCaller();
+    }
+  }
+
+  diagnostics.Clear();
+
+  // Now write down the argument values for this particular call.  This looks
+  // like it might be a race condition
+  // if other threads were calling into here, but actually it isn't because we
+  // allocate a new args structure for
+  // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+
+  if (!impl_function_caller->WriteFunctionArguments(
+          exe_ctx, args_addr, dispatch_values, diagnostics)) {
+    if (log) {
+      log->Printf("Error writing function arguments.");
+      diagnostics.Dump(log);
     }
-
     return args_addr;
+  }
+
+  return args_addr;
 }
 
 ThreadPlanSP
-AppleObjCTrampolineHandler::GetStepThroughDispatchPlan (Thread &thread, bool stop_others)
-{
-    ThreadPlanSP ret_plan_sp;
-    lldb::addr_t curr_pc = thread.GetRegisterContext()->GetPC();
-    
-    DispatchFunction this_dispatch;
-    bool found_it = false;
-    
-    // First step is to look and see if we are in one of the known ObjC dispatch functions.  We've already compiled
-    // a table of same, so consult it.
-    
-    MsgsendMap::iterator pos;
-    pos = m_msgSend_map.find (curr_pc);
-    if (pos != m_msgSend_map.end())
-    {
-        this_dispatch = g_dispatch_functions[(*pos).second];
-        found_it = true;
+AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
+                                                       bool stop_others) {
+  ThreadPlanSP ret_plan_sp;
+  lldb::addr_t curr_pc = thread.GetRegisterContext()->GetPC();
+
+  DispatchFunction this_dispatch;
+  bool found_it = false;
+
+  // First step is to look and see if we are in one of the known ObjC dispatch
+  // functions.  We've already compiled
+  // a table of same, so consult it.
+
+  MsgsendMap::iterator pos;
+  pos = m_msgSend_map.find(curr_pc);
+  if (pos != m_msgSend_map.end()) {
+    this_dispatch = g_dispatch_functions[(*pos).second];
+    found_it = true;
+  }
+
+  // Next check to see if we are in a vtable region:
+
+  if (!found_it) {
+    uint32_t flags;
+    if (m_vtables_ap.get()) {
+      found_it = m_vtables_ap->IsAddressInVTables(curr_pc, flags);
+      if (found_it) {
+        this_dispatch.name = "vtable";
+        this_dispatch.stret_return =
+            (flags & AppleObjCVTables::eOBJC_TRAMPOLINE_STRET) ==
+            AppleObjCVTables::eOBJC_TRAMPOLINE_STRET;
+        this_dispatch.is_super = false;
+        this_dispatch.is_super2 = false;
+        this_dispatch.fixedup = DispatchFunction::eFixUpFixed;
+      }
     }
-    
-    // Next check to see if we are in a vtable region:
-    
-    if (!found_it)
-    {
-        uint32_t flags;
-        if (m_vtables_ap.get())
-        {
-            found_it = m_vtables_ap->IsAddressInVTables (curr_pc, flags);
-            if (found_it)
-            {
-                this_dispatch.name = "vtable";
-                this_dispatch.stret_return 
-                        = (flags & AppleObjCVTables::eOBJC_TRAMPOLINE_STRET) == AppleObjCVTables::eOBJC_TRAMPOLINE_STRET;
-                this_dispatch.is_super = false;
-                this_dispatch.is_super2 = false;
-                this_dispatch.fixedup = DispatchFunction::eFixUpFixed;
-            }
-        }
-    }
-    
-    if (found_it)
-    {
-        Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
-
-        // We are decoding a method dispatch.  
-        // First job is to pull the arguments out:
-        
-        lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);
-        
-        const ABI *abi = NULL;
-        ProcessSP process_sp (thread.CalculateProcess());
-        if (process_sp)
-            abi = process_sp->GetABI().get();
-        if (abi == NULL)
-            return ret_plan_sp;
-            
-        TargetSP target_sp (thread.CalculateTarget());
-        
-        ClangASTContext *clang_ast_context = target_sp->GetScratchClangASTContext();
-        ValueList argument_values;
-        Value void_ptr_value;
-        CompilerType clang_void_ptr_type = clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
-        void_ptr_value.SetValueType (Value::eValueTypeScalar);
-        //void_ptr_value.SetContext (Value::eContextTypeClangType, clang_void_ptr_type);
-        void_ptr_value.SetCompilerType (clang_void_ptr_type);
-        
-        int obj_index;
-        int sel_index;
-        
-        // If this is a struct return dispatch, then the first argument is the
-        // return struct pointer, and the object is the second, and the selector is the third.
-        // Otherwise the object is the first and the selector the second.
-        if (this_dispatch.stret_return)
-        {
-            obj_index = 1;
-            sel_index = 2;
-            argument_values.PushValue(void_ptr_value);
-            argument_values.PushValue(void_ptr_value);
-            argument_values.PushValue(void_ptr_value);
-        }
-        else
-        {
-            obj_index = 0;
-            sel_index = 1;
-            argument_values.PushValue(void_ptr_value);
-            argument_values.PushValue(void_ptr_value);
-        }
+  }
 
-        
-        bool success = abi->GetArgumentValues (thread, argument_values);
-        if (!success)
-            return ret_plan_sp;
-        
-        lldb::addr_t obj_addr = argument_values.GetValueAtIndex(obj_index)->GetScalar().ULongLong();
-        if (obj_addr == 0x0)
-        {
-            if (log)
-                log->Printf("Asked to step to dispatch to nil object, returning empty plan.");
-            return ret_plan_sp;
-        }
-        
-        ExecutionContext exe_ctx (thread.shared_from_this());
-        Process *process = exe_ctx.GetProcessPtr();
-        // isa_addr will store the class pointer that the method is being dispatched to - so either the class
-        // directly or the super class if this is one of the objc_msgSendSuper flavors.  That's mostly used to
-        // look up the class/selector pair in our cache.
-        
-        lldb::addr_t isa_addr = LLDB_INVALID_ADDRESS;
-        lldb::addr_t sel_addr = argument_values.GetValueAtIndex(sel_index)->GetScalar().ULongLong();
-         
-        // Figure out the class this is being dispatched to and see if we've already cached this method call,
-        // If so we can push a run-to-address plan directly.  Otherwise we have to figure out where
-        // the implementation lives.
-
-        if (this_dispatch.is_super)
-        {
-            if (this_dispatch.is_super2)
-            {
-               // In the objc_msgSendSuper2 case, we don't get the object directly, we get a structure containing
-               // the object and the class to which the super message is being sent.  So we need to dig the super
-               // out of the class and use that.
-               
-                Value super_value(*(argument_values.GetValueAtIndex(obj_index)));
-                super_value.GetScalar() += process->GetAddressByteSize();
-                super_value.ResolveValue (&exe_ctx);
-                
-                if (super_value.GetScalar().IsValid())
-                {
-                
-                    // isa_value now holds the class pointer.  The second word of the class pointer is the super-class pointer:
-                    super_value.GetScalar() += process->GetAddressByteSize();
-                    super_value.ResolveValue (&exe_ctx);
-                    if (super_value.GetScalar().IsValid())
-                        isa_addr = super_value.GetScalar().ULongLong();
-                    else
-                    {
-                       if (log)
-                        log->Printf("Failed to extract the super class value from the class in objc_super.");
-                    }
-                }
-                else
-                {
-                   if (log)
-                    log->Printf("Failed to extract the class value from objc_super.");
-                }
-            }
-            else
-            {
-               // In the objc_msgSendSuper case, we don't get the object directly, we get a two element structure containing
-               // the object and the super class to which the super message is being sent.  So the class we want is
-               // the second element of this structure.
-               
-                Value super_value(*(argument_values.GetValueAtIndex(obj_index)));
-                super_value.GetScalar() += process->GetAddressByteSize();
-                super_value.ResolveValue (&exe_ctx);
-                
-                if (super_value.GetScalar().IsValid())
-                {
-                    isa_addr = super_value.GetScalar().ULongLong();
-                }
-                else
-                {
-                   if (log)
-                    log->Printf("Failed to extract the class value from objc_super.");
-                }
-            }
-        }
-        else
-        {
-            // In the direct dispatch case, the object->isa is the class pointer we want.
-            
-            // This is a little cheesy, but since object->isa is the first field,
-            // making the object value a load address value and resolving it will get
-            // the pointer sized data pointed to by that value...
-            
-            // Note, it isn't a fatal error not to be able to get the address from the object, since this might
-            // be a "tagged pointer" which isn't a real object, but rather some word length encoded dingus.
-            
-            Value isa_value(*(argument_values.GetValueAtIndex(obj_index)));
-
-            isa_value.SetValueType(Value::eValueTypeLoadAddress);
-            isa_value.ResolveValue(&exe_ctx);
-            if (isa_value.GetScalar().IsValid())
-            {
-                isa_addr = isa_value.GetScalar().ULongLong();
-            }
-            else
-            {
-               if (log)
-                log->Printf("Failed to extract the isa value from object.");
-            }
+  if (found_it) {
+    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
 
-        } 
-        
-        // Okay, we've got the address of the class for which we're resolving this, let's see if it's in our cache:
-        lldb::addr_t impl_addr = LLDB_INVALID_ADDRESS;
-        
-        if (isa_addr != LLDB_INVALID_ADDRESS)
-        {
-            if (log)
-            {
-                log->Printf("Resolving call for class - 0x%" PRIx64 " and selector - 0x%" PRIx64,
-                            isa_addr, sel_addr);
-            }
-            ObjCLanguageRuntime *objc_runtime = thread.GetProcess()->GetObjCLanguageRuntime ();
-            assert(objc_runtime != NULL);
-            
-            impl_addr = objc_runtime->LookupInMethodCache (isa_addr, sel_addr);
-        }                                      
-                                                                                                                          
-        if (impl_addr != LLDB_INVALID_ADDRESS)
-        {
-            // Yup, it was in the cache, so we can run to that address directly.
-            
+    // We are decoding a method dispatch.
+    // First job is to pull the arguments out:
+
+    lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);
+
+    const ABI *abi = NULL;
+    ProcessSP process_sp(thread.CalculateProcess());
+    if (process_sp)
+      abi = process_sp->GetABI().get();
+    if (abi == NULL)
+      return ret_plan_sp;
+
+    TargetSP target_sp(thread.CalculateTarget());
+
+    ClangASTContext *clang_ast_context = target_sp->GetScratchClangASTContext();
+    ValueList argument_values;
+    Value void_ptr_value;
+    CompilerType clang_void_ptr_type =
+        clang_ast_context->GetBasicType(eBasicTypeVoid).GetPointerType();
+    void_ptr_value.SetValueType(Value::eValueTypeScalar);
+    // void_ptr_value.SetContext (Value::eContextTypeClangType,
+    // clang_void_ptr_type);
+    void_ptr_value.SetCompilerType(clang_void_ptr_type);
+
+    int obj_index;
+    int sel_index;
+
+    // If this is a struct return dispatch, then the first argument is the
+    // return struct pointer, and the object is the second, and the selector is
+    // the third.
+    // Otherwise the object is the first and the selector the second.
+    if (this_dispatch.stret_return) {
+      obj_index = 1;
+      sel_index = 2;
+      argument_values.PushValue(void_ptr_value);
+      argument_values.PushValue(void_ptr_value);
+      argument_values.PushValue(void_ptr_value);
+    } else {
+      obj_index = 0;
+      sel_index = 1;
+      argument_values.PushValue(void_ptr_value);
+      argument_values.PushValue(void_ptr_value);
+    }
+
+    bool success = abi->GetArgumentValues(thread, argument_values);
+    if (!success)
+      return ret_plan_sp;
+
+    lldb::addr_t obj_addr =
+        argument_values.GetValueAtIndex(obj_index)->GetScalar().ULongLong();
+    if (obj_addr == 0x0) {
+      if (log)
+        log->Printf(
+            "Asked to step to dispatch to nil object, returning empty plan.");
+      return ret_plan_sp;
+    }
+
+    ExecutionContext exe_ctx(thread.shared_from_this());
+    Process *process = exe_ctx.GetProcessPtr();
+    // isa_addr will store the class pointer that the method is being dispatched
+    // to - so either the class
+    // directly or the super class if this is one of the objc_msgSendSuper
+    // flavors.  That's mostly used to
+    // look up the class/selector pair in our cache.
+
+    lldb::addr_t isa_addr = LLDB_INVALID_ADDRESS;
+    lldb::addr_t sel_addr =
+        argument_values.GetValueAtIndex(sel_index)->GetScalar().ULongLong();
+
+    // Figure out the class this is being dispatched to and see if we've already
+    // cached this method call,
+    // If so we can push a run-to-address plan directly.  Otherwise we have to
+    // figure out where
+    // the implementation lives.
+
+    if (this_dispatch.is_super) {
+      if (this_dispatch.is_super2) {
+        // In the objc_msgSendSuper2 case, we don't get the object directly, we
+        // get a structure containing
+        // the object and the class to which the super message is being sent.
+        // So we need to dig the super
+        // out of the class and use that.
+
+        Value super_value(*(argument_values.GetValueAtIndex(obj_index)));
+        super_value.GetScalar() += process->GetAddressByteSize();
+        super_value.ResolveValue(&exe_ctx);
+
+        if (super_value.GetScalar().IsValid()) {
+
+          // isa_value now holds the class pointer.  The second word of the
+          // class pointer is the super-class pointer:
+          super_value.GetScalar() += process->GetAddressByteSize();
+          super_value.ResolveValue(&exe_ctx);
+          if (super_value.GetScalar().IsValid())
+            isa_addr = super_value.GetScalar().ULongLong();
+          else {
             if (log)
-                log->Printf ("Found implementation address in cache: 0x%" PRIx64, impl_addr);
-                 
-            ret_plan_sp.reset (new ThreadPlanRunToAddress (thread, impl_addr, stop_others));
+              log->Printf("Failed to extract the super class value from the "
+                          "class in objc_super.");
+          }
+        } else {
+          if (log)
+            log->Printf("Failed to extract the class value from objc_super.");
         }
-        else
-        {
-            // We haven't seen this class/selector pair yet.  Look it up.
-            StreamString errors;
-            Address impl_code_address;
-            
-            ValueList dispatch_values;
-            
-            // We've will inject a little function in the target that takes the object, selector and some flags,
-            // and figures out the implementation.  Looks like:
-            //      void *__lldb_objc_find_implementation_for_selector (void *object, 
-            //                                                          void *sel, 
-            //                                                          int is_stret, 
-            //                                                          int is_super, 
-            //                                                          int is_super2, 
-            //                                                          int is_fixup, 
-            //                                                          int is_fixed,
-            //                                                          int debug)
-            // So set up the arguments for that call.
-            
-            dispatch_values.PushValue (*(argument_values.GetValueAtIndex(obj_index)));
-            dispatch_values.PushValue (*(argument_values.GetValueAtIndex(sel_index)));
-            
-            Value flag_value;
-            CompilerType clang_int_type = clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(lldb::eEncodingSint, 32);
-            flag_value.SetValueType (Value::eValueTypeScalar);
-            //flag_value.SetContext (Value::eContextTypeClangType, clang_int_type);
-            flag_value.SetCompilerType (clang_int_type);
-            
-            if (this_dispatch.stret_return)
-                flag_value.GetScalar() = 1;
-            else
-                flag_value.GetScalar() = 0;
-            dispatch_values.PushValue (flag_value);
-                    
-            if (this_dispatch.is_super)
-                flag_value.GetScalar() = 1;
-            else
-                flag_value.GetScalar() = 0;
-            dispatch_values.PushValue (flag_value);
-                    
-            if (this_dispatch.is_super2)
-                flag_value.GetScalar() = 1;
-            else
-                flag_value.GetScalar() = 0;
-            dispatch_values.PushValue (flag_value);
-                    
-            switch (this_dispatch.fixedup)
-            {
-              case DispatchFunction::eFixUpNone:
-                 flag_value.GetScalar() = 0;
-                 dispatch_values.PushValue (flag_value);
-                 dispatch_values.PushValue (flag_value);
-                 break;
-              case DispatchFunction::eFixUpFixed:
-                 flag_value.GetScalar() = 1;
-                 dispatch_values.PushValue (flag_value);
-                 flag_value.GetScalar() = 1;
-                 dispatch_values.PushValue (flag_value);
-                 break;
-              case DispatchFunction::eFixUpToFix:
-                 flag_value.GetScalar() = 1;
-                 dispatch_values.PushValue (flag_value);
-                 flag_value.GetScalar() = 0;
-                 dispatch_values.PushValue (flag_value);
-                 break;
-            }
-            if (log && log->GetVerbose())
-                flag_value.GetScalar() = 1;
-            else
-                flag_value.GetScalar() = 0;  // FIXME - Set to 0 when debugging is done.
-            dispatch_values.PushValue (flag_value);
-            
-            
-            // The step through code might have to fill in the cache, so it is not safe to run only one thread.
-            // So we override the stop_others value passed in to us here:
-            const bool trampoline_stop_others = false;
-            ret_plan_sp.reset (new AppleThreadPlanStepThroughObjCTrampoline (thread,
-                                                                             this,
-                                                                             dispatch_values,
-                                                                             isa_addr,
-                                                                             sel_addr,
-                                                                             trampoline_stop_others));
-            if (log)
-            {
-                StreamString s;
-                ret_plan_sp->GetDescription(&s, eDescriptionLevelFull);
-                log->Printf("Using ObjC step plan: %s.\n", s.GetData());
-            }
+      } else {
+        // In the objc_msgSendSuper case, we don't get the object directly, we
+        // get a two element structure containing
+        // the object and the super class to which the super message is being
+        // sent.  So the class we want is
+        // the second element of this structure.
+
+        Value super_value(*(argument_values.GetValueAtIndex(obj_index)));
+        super_value.GetScalar() += process->GetAddressByteSize();
+        super_value.ResolveValue(&exe_ctx);
+
+        if (super_value.GetScalar().IsValid()) {
+          isa_addr = super_value.GetScalar().ULongLong();
+        } else {
+          if (log)
+            log->Printf("Failed to extract the class value from objc_super.");
         }
+      }
+    } else {
+      // In the direct dispatch case, the object->isa is the class pointer we
+      // want.
+
+      // This is a little cheesy, but since object->isa is the first field,
+      // making the object value a load address value and resolving it will get
+      // the pointer sized data pointed to by that value...
+
+      // Note, it isn't a fatal error not to be able to get the address from the
+      // object, since this might
+      // be a "tagged pointer" which isn't a real object, but rather some word
+      // length encoded dingus.
+
+      Value isa_value(*(argument_values.GetValueAtIndex(obj_index)));
+
+      isa_value.SetValueType(Value::eValueTypeLoadAddress);
+      isa_value.ResolveValue(&exe_ctx);
+      if (isa_value.GetScalar().IsValid()) {
+        isa_addr = isa_value.GetScalar().ULongLong();
+      } else {
+        if (log)
+          log->Printf("Failed to extract the isa value from object.");
+      }
     }
-    
-    return ret_plan_sp;
+
+    // Okay, we've got the address of the class for which we're resolving this,
+    // let's see if it's in our cache:
+    lldb::addr_t impl_addr = LLDB_INVALID_ADDRESS;
+
+    if (isa_addr != LLDB_INVALID_ADDRESS) {
+      if (log) {
+        log->Printf("Resolving call for class - 0x%" PRIx64
+                    " and selector - 0x%" PRIx64,
+                    isa_addr, sel_addr);
+      }
+      ObjCLanguageRuntime *objc_runtime =
+          thread.GetProcess()->GetObjCLanguageRuntime();
+      assert(objc_runtime != NULL);
+
+      impl_addr = objc_runtime->LookupInMethodCache(isa_addr, sel_addr);
+    }
+
+    if (impl_addr != LLDB_INVALID_ADDRESS) {
+      // Yup, it was in the cache, so we can run to that address directly.
+
+      if (log)
+        log->Printf("Found implementation address in cache: 0x%" PRIx64,
+                    impl_addr);
+
+      ret_plan_sp.reset(
+          new ThreadPlanRunToAddress(thread, impl_addr, stop_others));
+    } else {
+      // We haven't seen this class/selector pair yet.  Look it up.
+      StreamString errors;
+      Address impl_code_address;
+
+      ValueList dispatch_values;
+
+      // We've will inject a little function in the target that takes the
+      // object, selector and some flags,
+      // and figures out the implementation.  Looks like:
+      //      void *__lldb_objc_find_implementation_for_selector (void *object,
+      //                                                          void *sel,
+      //                                                          int is_stret,
+      //                                                          int is_super,
+      //                                                          int is_super2,
+      //                                                          int is_fixup,
+      //                                                          int is_fixed,
+      //                                                          int debug)
+      // So set up the arguments for that call.
+
+      dispatch_values.PushValue(*(argument_values.GetValueAtIndex(obj_index)));
+      dispatch_values.PushValue(*(argument_values.GetValueAtIndex(sel_index)));
+
+      Value flag_value;
+      CompilerType clang_int_type =
+          clang_ast_context->GetBuiltinTypeForEncodingAndBitSize(
+              lldb::eEncodingSint, 32);
+      flag_value.SetValueType(Value::eValueTypeScalar);
+      // flag_value.SetContext (Value::eContextTypeClangType, clang_int_type);
+      flag_value.SetCompilerType(clang_int_type);
+
+      if (this_dispatch.stret_return)
+        flag_value.GetScalar() = 1;
+      else
+        flag_value.GetScalar() = 0;
+      dispatch_values.PushValue(flag_value);
+
+      if (this_dispatch.is_super)
+        flag_value.GetScalar() = 1;
+      else
+        flag_value.GetScalar() = 0;
+      dispatch_values.PushValue(flag_value);
+
+      if (this_dispatch.is_super2)
+        flag_value.GetScalar() = 1;
+      else
+        flag_value.GetScalar() = 0;
+      dispatch_values.PushValue(flag_value);
+
+      switch (this_dispatch.fixedup) {
+      case DispatchFunction::eFixUpNone:
+        flag_value.GetScalar() = 0;
+        dispatch_values.PushValue(flag_value);
+        dispatch_values.PushValue(flag_value);
+        break;
+      case DispatchFunction::eFixUpFixed:
+        flag_value.GetScalar() = 1;
+        dispatch_values.PushValue(flag_value);
+        flag_value.GetScalar() = 1;
+        dispatch_values.PushValue(flag_value);
+        break;
+      case DispatchFunction::eFixUpToFix:
+        flag_value.GetScalar() = 1;
+        dispatch_values.PushValue(flag_value);
+        flag_value.GetScalar() = 0;
+        dispatch_values.PushValue(flag_value);
+        break;
+      }
+      if (log && log->GetVerbose())
+        flag_value.GetScalar() = 1;
+      else
+        flag_value.GetScalar() = 0; // FIXME - Set to 0 when debugging is done.
+      dispatch_values.PushValue(flag_value);
+
+      // The step through code might have to fill in the cache, so it is not
+      // safe to run only one thread.
+      // So we override the stop_others value passed in to us here:
+      const bool trampoline_stop_others = false;
+      ret_plan_sp.reset(new AppleThreadPlanStepThroughObjCTrampoline(
+          thread, this, dispatch_values, isa_addr, sel_addr,
+          trampoline_stop_others));
+      if (log) {
+        StreamString s;
+        ret_plan_sp->GetDescription(&s, eDescriptionLevelFull);
+        log->Printf("Using ObjC step plan: %s.\n", s.GetData());
+      }
+    }
+  }
+
+  return ret_plan_sp;
 }
 
 FunctionCaller *
-AppleObjCTrampolineHandler::GetLookupImplementationFunctionCaller ()
-{
-    return m_impl_code->GetFunctionCaller();
+AppleObjCTrampolineHandler::GetLookupImplementationFunctionCaller() {
+  return m_impl_code->GetFunctionCaller();
 }

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h Tue Sep  6 15:57:50 2016
@@ -18,190 +18,143 @@
 
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/Expression/UtilityFunction.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
 
-namespace lldb_private
-{
-  
 class AppleObjCTrampolineHandler {
 public:
-    AppleObjCTrampolineHandler (const lldb::ProcessSP &process_sp, 
-                                const lldb::ModuleSP &objc_module_sp);
-    
-    ~AppleObjCTrampolineHandler();
-            
-    lldb::ThreadPlanSP
-    GetStepThroughDispatchPlan (Thread &thread, 
-                                bool stop_others);
-    
-    FunctionCaller *
-    GetLookupImplementationFunctionCaller ();
-    
-    bool 
-    AddrIsMsgForward (lldb::addr_t addr) const
-    {
-        return (addr == m_msg_forward_addr || addr == m_msg_forward_stret_addr);
-    }
+  AppleObjCTrampolineHandler(const lldb::ProcessSP &process_sp,
+                             const lldb::ModuleSP &objc_module_sp);
 
-    struct DispatchFunction {
-    public:
-        typedef enum 
-        {
-            eFixUpNone,
-            eFixUpFixed,
-            eFixUpToFix
-        } FixUpState;
-                
-        const char *name;
-        bool stret_return;
-        bool is_super;
-        bool is_super2;
-        FixUpState fixedup;
-    };
+  ~AppleObjCTrampolineHandler();
+
+  lldb::ThreadPlanSP GetStepThroughDispatchPlan(Thread &thread,
+                                                bool stop_others);
+
+  FunctionCaller *GetLookupImplementationFunctionCaller();
+
+  bool AddrIsMsgForward(lldb::addr_t addr) const {
+    return (addr == m_msg_forward_addr || addr == m_msg_forward_stret_addr);
+  }
+
+  struct DispatchFunction {
+  public:
+    typedef enum { eFixUpNone, eFixUpFixed, eFixUpToFix } FixUpState;
 
-    lldb::addr_t
-    SetupDispatchFunction (Thread &thread, ValueList &dispatch_values);
+    const char *name;
+    bool stret_return;
+    bool is_super;
+    bool is_super2;
+    FixUpState fixedup;
+  };
+
+  lldb::addr_t SetupDispatchFunction(Thread &thread,
+                                     ValueList &dispatch_values);
 
 private:
-    static const char *g_lookup_implementation_function_name;
-    static const char *g_lookup_implementation_with_stret_function_code;
-    static const char *g_lookup_implementation_no_stret_function_code;
+  static const char *g_lookup_implementation_function_name;
+  static const char *g_lookup_implementation_with_stret_function_code;
+  static const char *g_lookup_implementation_no_stret_function_code;
+
+  class AppleObjCVTables {
+  public:
+    // These come from objc-gdb.h.
+    enum VTableFlags {
+      eOBJC_TRAMPOLINE_MESSAGE = (1 << 0), // trampoline acts like objc_msgSend
+      eOBJC_TRAMPOLINE_STRET = (1 << 1),   // trampoline is struct-returning
+      eOBJC_TRAMPOLINE_VTABLE = (1 << 2)   // trampoline is vtable dispatcher
+    };
+
+  private:
+    struct VTableDescriptor {
+      VTableDescriptor(uint32_t in_flags, lldb::addr_t in_code_start)
+          : flags(in_flags), code_start(in_code_start) {}
+
+      uint32_t flags;
+      lldb::addr_t code_start;
+    };
 
-    class AppleObjCVTables
-    {
+    class VTableRegion {
     public:
-        // These come from objc-gdb.h.
-        enum VTableFlags
-        {
-             eOBJC_TRAMPOLINE_MESSAGE = (1<<0),   // trampoline acts like objc_msgSend                                                           
-             eOBJC_TRAMPOLINE_STRET   = (1<<1),   // trampoline is struct-returning                                                              
-             eOBJC_TRAMPOLINE_VTABLE  = (1<<2)    // trampoline is vtable dispatcher                                                             
-        };
-            
-    private:
-        struct VTableDescriptor 
-        {
-            VTableDescriptor(uint32_t in_flags, lldb::addr_t in_code_start) :
-                flags(in_flags),
-                code_start(in_code_start) {}
-            
-            uint32_t flags;
-            lldb::addr_t code_start;
-        };
-
-        class VTableRegion 
-        {
-        public:
-            VTableRegion() :
-                    m_valid (false),
-                    m_owner (NULL),
-                    m_header_addr (LLDB_INVALID_ADDRESS),
-                    m_code_start_addr(0),
-                    m_code_end_addr (0),
-                    m_next_region (0)
-            {}
-            
-            VTableRegion(AppleObjCVTables *owner, lldb::addr_t header_addr);
-            
-            void SetUpRegion();
-                        
-            lldb::addr_t GetNextRegionAddr ()
-            {
-                return m_next_region;
-            }
-            
-            lldb::addr_t
-            GetCodeStart ()
-            {
-                return m_code_start_addr;
-            }
-            
-            lldb::addr_t
-            GetCodeEnd ()
-            {
-                return m_code_end_addr;
-            }
-            
-            uint32_t
-            GetFlagsForVTableAtAddress (lldb::addr_t address)
-            {
-                return 0;
-            }
-            
-            bool
-            IsValid ()
-            {
-                return m_valid;
-            }
-            
-            bool 
-            AddressInRegion (lldb::addr_t addr, uint32_t &flags);
-            
-            void
-            Dump (Stream &s);
-            
-        public:
-            bool m_valid;
-            AppleObjCVTables *m_owner;
-            lldb::addr_t m_header_addr;
-            lldb::addr_t m_code_start_addr;
-            lldb::addr_t m_code_end_addr;
-            std::vector<VTableDescriptor> m_descriptors;
-            lldb::addr_t m_next_region;
-        };
-        
+      VTableRegion()
+          : m_valid(false), m_owner(NULL), m_header_addr(LLDB_INVALID_ADDRESS),
+            m_code_start_addr(0), m_code_end_addr(0), m_next_region(0) {}
+
+      VTableRegion(AppleObjCVTables *owner, lldb::addr_t header_addr);
+
+      void SetUpRegion();
+
+      lldb::addr_t GetNextRegionAddr() { return m_next_region; }
+
+      lldb::addr_t GetCodeStart() { return m_code_start_addr; }
+
+      lldb::addr_t GetCodeEnd() { return m_code_end_addr; }
+
+      uint32_t GetFlagsForVTableAtAddress(lldb::addr_t address) { return 0; }
+
+      bool IsValid() { return m_valid; }
+
+      bool AddressInRegion(lldb::addr_t addr, uint32_t &flags);
+
+      void Dump(Stream &s);
+
     public:
-        AppleObjCVTables(const lldb::ProcessSP &process_sp, 
-                         const lldb::ModuleSP &objc_module_sp);
-        
-        ~AppleObjCVTables();
-                
-        bool
-        InitializeVTableSymbols ();
-                
-        static bool RefreshTrampolines (void *baton, 
-                                        StoppointCallbackContext *context, 
-                                        lldb::user_id_t break_id, 
-                                        lldb::user_id_t break_loc_id);
-        bool
-        ReadRegions ();
-        
-        bool
-        ReadRegions (lldb::addr_t region_addr);
-                
-        bool
-        IsAddressInVTables (lldb::addr_t addr, uint32_t &flags);
-                
-        lldb::ProcessSP
-        GetProcessSP ()
-        {   
-            return m_process_wp.lock();
-        }
-        
-    private:
-        lldb::ProcessWP m_process_wp;
-        typedef std::vector<VTableRegion> region_collection;
-        lldb::addr_t m_trampoline_header;
-        lldb::break_id_t m_trampolines_changed_bp_id;
-        region_collection m_regions;
-        lldb::ModuleSP m_objc_module_sp;
+      bool m_valid;
+      AppleObjCVTables *m_owner;
+      lldb::addr_t m_header_addr;
+      lldb::addr_t m_code_start_addr;
+      lldb::addr_t m_code_end_addr;
+      std::vector<VTableDescriptor> m_descriptors;
+      lldb::addr_t m_next_region;
     };
-    
-    static const DispatchFunction g_dispatch_functions[];
-    
-    typedef std::map<lldb::addr_t, int> MsgsendMap; // This table maps an dispatch fn address to the index in g_dispatch_functions
-    MsgsendMap m_msgSend_map;
+
+  public:
+    AppleObjCVTables(const lldb::ProcessSP &process_sp,
+                     const lldb::ModuleSP &objc_module_sp);
+
+    ~AppleObjCVTables();
+
+    bool InitializeVTableSymbols();
+
+    static bool RefreshTrampolines(void *baton,
+                                   StoppointCallbackContext *context,
+                                   lldb::user_id_t break_id,
+                                   lldb::user_id_t break_loc_id);
+    bool ReadRegions();
+
+    bool ReadRegions(lldb::addr_t region_addr);
+
+    bool IsAddressInVTables(lldb::addr_t addr, uint32_t &flags);
+
+    lldb::ProcessSP GetProcessSP() { return m_process_wp.lock(); }
+
+  private:
     lldb::ProcessWP m_process_wp;
+    typedef std::vector<VTableRegion> region_collection;
+    lldb::addr_t m_trampoline_header;
+    lldb::break_id_t m_trampolines_changed_bp_id;
+    region_collection m_regions;
     lldb::ModuleSP m_objc_module_sp;
-    const char *m_lookup_implementation_function_code;
-    std::unique_ptr<UtilityFunction> m_impl_code;
-    std::mutex m_impl_function_mutex;
-    lldb::addr_t m_impl_fn_addr;
-    lldb::addr_t m_impl_stret_fn_addr;
-    lldb::addr_t m_msg_forward_addr;
-    lldb::addr_t m_msg_forward_stret_addr;
-    std::unique_ptr<AppleObjCVTables> m_vtables_ap;
+  };
+
+  static const DispatchFunction g_dispatch_functions[];
+
+  typedef std::map<lldb::addr_t, int> MsgsendMap; // This table maps an dispatch
+                                                  // fn address to the index in
+                                                  // g_dispatch_functions
+  MsgsendMap m_msgSend_map;
+  lldb::ProcessWP m_process_wp;
+  lldb::ModuleSP m_objc_module_sp;
+  const char *m_lookup_implementation_function_code;
+  std::unique_ptr<UtilityFunction> m_impl_code;
+  std::mutex m_impl_function_mutex;
+  lldb::addr_t m_impl_fn_addr;
+  lldb::addr_t m_impl_stret_fn_addr;
+  lldb::addr_t m_msg_forward_addr;
+  lldb::addr_t m_msg_forward_stret_addr;
+  std::unique_ptr<AppleObjCVTables> m_vtables_ap;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Tue Sep  6 15:57:50 2016
@@ -21,379 +21,377 @@
 using namespace lldb_private;
 using namespace lldb_utility;
 
-AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser (ObjCLanguageRuntime& runtime) :
-    ObjCLanguageRuntime::EncodingToType(),
-    m_runtime(runtime)
-{
-    if (!m_scratch_ast_ctx_ap)
-        m_scratch_ast_ctx_ap.reset(new ClangASTContext(runtime.GetProcess()->GetTarget().GetArchitecture().GetTriple().str().c_str()));
+AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
+    ObjCLanguageRuntime &runtime)
+    : ObjCLanguageRuntime::EncodingToType(), m_runtime(runtime) {
+  if (!m_scratch_ast_ctx_ap)
+    m_scratch_ast_ctx_ap.reset(new ClangASTContext(runtime.GetProcess()
+                                                       ->GetTarget()
+                                                       .GetArchitecture()
+                                                       .GetTriple()
+                                                       .str()
+                                                       .c_str()));
 }
 
 std::string
-AppleObjCTypeEncodingParser::ReadStructName(lldb_utility::StringLexer& type)
-{
-    StreamString buffer;
-    while (type.HasAtLeast(1) && type.Peek() != '=')
-        buffer.Printf("%c",type.Next());
-    return buffer.GetString();
+AppleObjCTypeEncodingParser::ReadStructName(lldb_utility::StringLexer &type) {
+  StreamString buffer;
+  while (type.HasAtLeast(1) && type.Peek() != '=')
+    buffer.Printf("%c", type.Next());
+  return buffer.GetString();
 }
 
 std::string
-AppleObjCTypeEncodingParser::ReadQuotedString(lldb_utility::StringLexer& type)
-{
-    StreamString buffer;
-    while (type.HasAtLeast(1) && type.Peek() != '"')
-        buffer.Printf("%c",type.Next());
-    StringLexer::Character next = type.Next();
-    UNUSED_IF_ASSERT_DISABLED(next);
-    assert (next == '"');
-    return buffer.GetString();
+AppleObjCTypeEncodingParser::ReadQuotedString(lldb_utility::StringLexer &type) {
+  StreamString buffer;
+  while (type.HasAtLeast(1) && type.Peek() != '"')
+    buffer.Printf("%c", type.Next());
+  StringLexer::Character next = type.Next();
+  UNUSED_IF_ASSERT_DISABLED(next);
+  assert(next == '"');
+  return buffer.GetString();
 }
 
 uint32_t
-AppleObjCTypeEncodingParser::ReadNumber (lldb_utility::StringLexer& type)
-{
-    uint32_t total = 0;
-    while (type.HasAtLeast(1) && isdigit(type.Peek()))
-           total = 10*total + (type.Next() - '0');
-    return total;
+AppleObjCTypeEncodingParser::ReadNumber(lldb_utility::StringLexer &type) {
+  uint32_t total = 0;
+  while (type.HasAtLeast(1) && isdigit(type.Peek()))
+    total = 10 * total + (type.Next() - '0');
+  return total;
 }
 
-// as an extension to the published grammar recent runtimes emit structs like this:
+// as an extension to the published grammar recent runtimes emit structs like
+// this:
 // "{CGRect=\"origin\"{CGPoint=\"x\"d\"y\"d}\"size\"{CGSize=\"width\"d\"height\"d}}"
 
-AppleObjCTypeEncodingParser::StructElement::StructElement() :
-name(""),
-type(clang::QualType()),
-bitfield(0)
-{}
+AppleObjCTypeEncodingParser::StructElement::StructElement()
+    : name(""), type(clang::QualType()), bitfield(0) {}
 
 AppleObjCTypeEncodingParser::StructElement
-AppleObjCTypeEncodingParser::ReadStructElement (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression)
-{
-    StructElement retval;
-    if (type.NextIf('"'))
-        retval.name = ReadQuotedString(type);
-    if (!type.NextIf('"'))
-        return retval;
-    uint32_t bitfield_size = 0;
-    retval.type = BuildType(ast_ctx, type, for_expression, &bitfield_size);
-    retval.bitfield = bitfield_size;
+AppleObjCTypeEncodingParser::ReadStructElement(clang::ASTContext &ast_ctx,
+                                               lldb_utility::StringLexer &type,
+                                               bool for_expression) {
+  StructElement retval;
+  if (type.NextIf('"'))
+    retval.name = ReadQuotedString(type);
+  if (!type.NextIf('"'))
     return retval;
+  uint32_t bitfield_size = 0;
+  retval.type = BuildType(ast_ctx, type, for_expression, &bitfield_size);
+  retval.bitfield = bitfield_size;
+  return retval;
 }
 
 clang::QualType
-AppleObjCTypeEncodingParser::BuildStruct (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression)
-{
-    return BuildAggregate(ast_ctx, type, for_expression, '{', '}', clang::TTK_Struct);
+AppleObjCTypeEncodingParser::BuildStruct(clang::ASTContext &ast_ctx,
+                                         lldb_utility::StringLexer &type,
+                                         bool for_expression) {
+  return BuildAggregate(ast_ctx, type, for_expression, '{', '}',
+                        clang::TTK_Struct);
 }
 
 clang::QualType
-AppleObjCTypeEncodingParser::BuildUnion (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression)
-{
-    return BuildAggregate(ast_ctx, type, for_expression, '(', ')', clang::TTK_Union);
-}
-
-clang::QualType
-AppleObjCTypeEncodingParser::BuildAggregate (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression, char opener, char closer, uint32_t kind)
-{
-    if (!type.NextIf(opener))
-        return clang::QualType();
-    std::string name(ReadStructName(type));
-    
-    // We do not handle templated classes/structs at the moment.
-    // If the name has a < in it, we are going to abandon this.
-    // We're still obliged to parse it, so we just set a flag that
-    // means "Don't actually build anything."
-    
-    const bool is_templated = name.find('<') != std::string::npos;
-    
-    if (!type.NextIf('='))
-        return clang::QualType();
-    bool in_union = true;
-    std::vector<StructElement> elements;
-    while (in_union && type.HasAtLeast(1))
-    {
-        if (type.NextIf(closer))
-        {
-            in_union = false;
-            break;
-        }
-        else
-        {
-            auto element = ReadStructElement(ast_ctx, type, for_expression);
-            if (element.type.isNull())
-                break;
-            else
-                elements.push_back(element);
-        }
+AppleObjCTypeEncodingParser::BuildUnion(clang::ASTContext &ast_ctx,
+                                        lldb_utility::StringLexer &type,
+                                        bool for_expression) {
+  return BuildAggregate(ast_ctx, type, for_expression, '(', ')',
+                        clang::TTK_Union);
+}
+
+clang::QualType AppleObjCTypeEncodingParser::BuildAggregate(
+    clang::ASTContext &ast_ctx, lldb_utility::StringLexer &type,
+    bool for_expression, char opener, char closer, uint32_t kind) {
+  if (!type.NextIf(opener))
+    return clang::QualType();
+  std::string name(ReadStructName(type));
+
+  // We do not handle templated classes/structs at the moment.
+  // If the name has a < in it, we are going to abandon this.
+  // We're still obliged to parse it, so we just set a flag that
+  // means "Don't actually build anything."
+
+  const bool is_templated = name.find('<') != std::string::npos;
+
+  if (!type.NextIf('='))
+    return clang::QualType();
+  bool in_union = true;
+  std::vector<StructElement> elements;
+  while (in_union && type.HasAtLeast(1)) {
+    if (type.NextIf(closer)) {
+      in_union = false;
+      break;
+    } else {
+      auto element = ReadStructElement(ast_ctx, type, for_expression);
+      if (element.type.isNull())
+        break;
+      else
+        elements.push_back(element);
     }
-    if (in_union)
-        return clang::QualType();
-    
-    if (is_templated)
-        return clang::QualType(); // This is where we bail out.  Sorry!
-    
-    ClangASTContext *lldb_ctx = ClangASTContext::GetASTContext(&ast_ctx);
-    if (!lldb_ctx)
-        return clang::QualType();
-    CompilerType union_type(lldb_ctx->CreateRecordType(nullptr, lldb::eAccessPublic, name.c_str(), kind, lldb::eLanguageTypeC));
-    if (union_type)
-    {
-        ClangASTContext::StartTagDeclarationDefinition(union_type);
-        
-        unsigned int count = 0;
-        for (auto element: elements)
-        {
-            if (element.name.empty())
-            {
-                StreamString elem_name;
-                elem_name.Printf("__unnamed_%u",count);
-                element.name = std::string(elem_name.GetData());
-            }
-            ClangASTContext::AddFieldToRecordType(union_type, element.name.c_str(), CompilerType(&ast_ctx, element.type), lldb::eAccessPublic, element.bitfield);
-            ++count;
-        }
-        ClangASTContext::CompleteTagDeclarationDefinition(union_type);
+  }
+  if (in_union)
+    return clang::QualType();
+
+  if (is_templated)
+    return clang::QualType(); // This is where we bail out.  Sorry!
+
+  ClangASTContext *lldb_ctx = ClangASTContext::GetASTContext(&ast_ctx);
+  if (!lldb_ctx)
+    return clang::QualType();
+  CompilerType union_type(lldb_ctx->CreateRecordType(
+      nullptr, lldb::eAccessPublic, name.c_str(), kind, lldb::eLanguageTypeC));
+  if (union_type) {
+    ClangASTContext::StartTagDeclarationDefinition(union_type);
+
+    unsigned int count = 0;
+    for (auto element : elements) {
+      if (element.name.empty()) {
+        StreamString elem_name;
+        elem_name.Printf("__unnamed_%u", count);
+        element.name = std::string(elem_name.GetData());
+      }
+      ClangASTContext::AddFieldToRecordType(
+          union_type, element.name.c_str(),
+          CompilerType(&ast_ctx, element.type), lldb::eAccessPublic,
+          element.bitfield);
+      ++count;
     }
-    return ClangUtil::GetQualType(union_type);
+    ClangASTContext::CompleteTagDeclarationDefinition(union_type);
+  }
+  return ClangUtil::GetQualType(union_type);
 }
 
 clang::QualType
-AppleObjCTypeEncodingParser::BuildArray (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression)
-{
-    if (!type.NextIf('['))
-        return clang::QualType();
-    uint32_t size = ReadNumber(type);
-    clang::QualType element_type(BuildType(ast_ctx, type, for_expression));
-    if (!type.NextIf(']'))
-        return clang::QualType();
-    ClangASTContext *lldb_ctx = ClangASTContext::GetASTContext(&ast_ctx);
-    if (!lldb_ctx)
-        return clang::QualType();
-    CompilerType array_type(lldb_ctx->CreateArrayType(CompilerType(&ast_ctx, element_type), size, false));
-    return ClangUtil::GetQualType(array_type);
+AppleObjCTypeEncodingParser::BuildArray(clang::ASTContext &ast_ctx,
+                                        lldb_utility::StringLexer &type,
+                                        bool for_expression) {
+  if (!type.NextIf('['))
+    return clang::QualType();
+  uint32_t size = ReadNumber(type);
+  clang::QualType element_type(BuildType(ast_ctx, type, for_expression));
+  if (!type.NextIf(']'))
+    return clang::QualType();
+  ClangASTContext *lldb_ctx = ClangASTContext::GetASTContext(&ast_ctx);
+  if (!lldb_ctx)
+    return clang::QualType();
+  CompilerType array_type(lldb_ctx->CreateArrayType(
+      CompilerType(&ast_ctx, element_type), size, false));
+  return ClangUtil::GetQualType(array_type);
 }
 
 // the runtime can emit these in the form of @"SomeType", giving more specifics
-// this would be interesting for expression parser interop, but since we actually try
-// to avoid exposing the ivar info to the expression evaluator, consume but ignore the type info
-// and always return an 'id'; if anything, dynamic typing will resolve things for us anyway
-clang::QualType
-AppleObjCTypeEncodingParser::BuildObjCObjectPointerType (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression)
-{
-    if (!type.NextIf('@'))
-        return clang::QualType();
-    
-    std::string name;
-    
-    if (type.NextIf('"'))
-    {
-        // We have to be careful here.  We're used to seeing
-        //   @"NSString"
-        // but in records it is possible that the string following an @ is the name of the next field and @ means "id".
-        // This is the case if anything unquoted except for "}", the end of the type, or another name follows the quoted string.
-        //
-        // E.g.
-        // - @"NSString"@ means "id, followed by a field named NSString of type id"
-        // - @"NSString"} means "a pointer to NSString and the end of the struct"
-        // - @"NSString""nextField" means "a pointer to NSString and a field named nextField"
-        // - @"NSString" followed by the end of the string means "a pointer to NSString"
-        //
-        // As a result, the rule is: If we see @ followed by a quoted string, we peek.
-        // - If we see }, ), ], the end of the string, or a quote ("), the quoted string is a class name.
-        // - If we see anything else, the quoted string is a field name and we push it back onto type.
-
-        name = ReadQuotedString(type);
-        
-        if (type.HasAtLeast(1))
-        {
-            switch (type.Peek())
-            {
-            default:
-                // roll back
-                type.PutBack(name.length() + 2); // undo our consumption of the string and of the quotes
-                name.clear();
-                break;
-            case '}':
-            case ')':
-            case ']':
-            case '"':
-                // the quoted string is a class name – see the rule
-                break;
-            }
-        }
-        else
-        {
-            // the quoted string is a class name – see the rule
-        }
+// this would be interesting for expression parser interop, but since we
+// actually try
+// to avoid exposing the ivar info to the expression evaluator, consume but
+// ignore the type info
+// and always return an 'id'; if anything, dynamic typing will resolve things
+// for us anyway
+clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType(
+    clang::ASTContext &ast_ctx, lldb_utility::StringLexer &type,
+    bool for_expression) {
+  if (!type.NextIf('@'))
+    return clang::QualType();
+
+  std::string name;
+
+  if (type.NextIf('"')) {
+    // We have to be careful here.  We're used to seeing
+    //   @"NSString"
+    // but in records it is possible that the string following an @ is the name
+    // of the next field and @ means "id".
+    // This is the case if anything unquoted except for "}", the end of the
+    // type, or another name follows the quoted string.
+    //
+    // E.g.
+    // - @"NSString"@ means "id, followed by a field named NSString of type id"
+    // - @"NSString"} means "a pointer to NSString and the end of the struct"
+    // - @"NSString""nextField" means "a pointer to NSString and a field named
+    // nextField"
+    // - @"NSString" followed by the end of the string means "a pointer to
+    // NSString"
+    //
+    // As a result, the rule is: If we see @ followed by a quoted string, we
+    // peek.
+    // - If we see }, ), ], the end of the string, or a quote ("), the quoted
+    // string is a class name.
+    // - If we see anything else, the quoted string is a field name and we push
+    // it back onto type.
+
+    name = ReadQuotedString(type);
+
+    if (type.HasAtLeast(1)) {
+      switch (type.Peek()) {
+      default:
+        // roll back
+        type.PutBack(name.length() +
+                     2); // undo our consumption of the string and of the quotes
+        name.clear();
+        break;
+      case '}':
+      case ')':
+      case ']':
+      case '"':
+        // the quoted string is a class name – see the rule
+        break;
+      }
+    } else {
+      // the quoted string is a class name – see the rule
     }
-    
-    if (for_expression && !name.empty())
-    {
-        size_t less_than_pos = name.find('<');
-        
-        if (less_than_pos != std::string::npos)
-        {
-            if (less_than_pos == 0)
-                return ast_ctx.getObjCIdType();
-            else
-                name.erase(less_than_pos);
-        }
-        
-        DeclVendor *decl_vendor = m_runtime.GetDeclVendor();
-        
-        assert (decl_vendor); // how are we parsing type encodings for expressions if a type vendor isn't in play?
-        
-        const bool append = false;
-        const uint32_t max_matches = 1;
-        std::vector<clang::NamedDecl *> decls;
-        
-        uint32_t num_types = decl_vendor->FindDecls(ConstString(name),
-                                                    append,
-                                                    max_matches,
-                                                    decls);
+  }
+
+  if (for_expression && !name.empty()) {
+    size_t less_than_pos = name.find('<');
 
-        // The user can forward-declare something that has no definition.  The runtime doesn't prohibit this at all.
-        // This is a rare and very weird case.  We keep this assert in debug builds so we catch other weird cases.
+    if (less_than_pos != std::string::npos) {
+      if (less_than_pos == 0)
+        return ast_ctx.getObjCIdType();
+      else
+        name.erase(less_than_pos);
+    }
+
+    DeclVendor *decl_vendor = m_runtime.GetDeclVendor();
+
+    assert(decl_vendor); // how are we parsing type encodings for expressions if
+                         // a type vendor isn't in play?
+
+    const bool append = false;
+    const uint32_t max_matches = 1;
+    std::vector<clang::NamedDecl *> decls;
+
+    uint32_t num_types =
+        decl_vendor->FindDecls(ConstString(name), append, max_matches, decls);
+
+// The user can forward-declare something that has no definition.  The runtime
+// doesn't prohibit this at all.
+// This is a rare and very weird case.  We keep this assert in debug builds so
+// we catch other weird cases.
 #ifdef LLDB_CONFIGURATION_DEBUG
-        assert(num_types);
+    assert(num_types);
 #else
-        if (!num_types)
-            return ast_ctx.getObjCIdType();
+    if (!num_types)
+      return ast_ctx.getObjCIdType();
 #endif
 
-        return ClangUtil::GetQualType(ClangASTContext::GetTypeForDecl(decls[0]).GetPointerType());
-    }
-    else
-    {
-        // We're going to resolve this dynamically anyway, so just smile and wave.
-        return ast_ctx.getObjCIdType();
-    }
+    return ClangUtil::GetQualType(
+        ClangASTContext::GetTypeForDecl(decls[0]).GetPointerType());
+  } else {
+    // We're going to resolve this dynamically anyway, so just smile and wave.
+    return ast_ctx.getObjCIdType();
+  }
 }
 
 clang::QualType
-AppleObjCTypeEncodingParser::BuildType (clang::ASTContext &ast_ctx, StringLexer& type, bool for_expression, uint32_t *bitfield_bit_size)
-{
-    if (!type.HasAtLeast(1))
-        return clang::QualType();
-    
-    switch (type.Peek())
-    {
-    default:
-        break;
-    case '{':
-        return BuildStruct(ast_ctx, type, for_expression);
-    case '[':
-        return BuildArray(ast_ctx, type, for_expression);
-    case '(':
-        return BuildUnion(ast_ctx, type, for_expression);
-    case '@':
-        return BuildObjCObjectPointerType(ast_ctx, type, for_expression);
-    }
-    
-    switch (type.Next())
-    {
-    default:
-        type.PutBack(1);
+AppleObjCTypeEncodingParser::BuildType(clang::ASTContext &ast_ctx,
+                                       StringLexer &type, bool for_expression,
+                                       uint32_t *bitfield_bit_size) {
+  if (!type.HasAtLeast(1))
+    return clang::QualType();
+
+  switch (type.Peek()) {
+  default:
+    break;
+  case '{':
+    return BuildStruct(ast_ctx, type, for_expression);
+  case '[':
+    return BuildArray(ast_ctx, type, for_expression);
+  case '(':
+    return BuildUnion(ast_ctx, type, for_expression);
+  case '@':
+    return BuildObjCObjectPointerType(ast_ctx, type, for_expression);
+  }
+
+  switch (type.Next()) {
+  default:
+    type.PutBack(1);
+    return clang::QualType();
+  case 'c':
+    return ast_ctx.CharTy;
+  case 'i':
+    return ast_ctx.IntTy;
+  case 's':
+    return ast_ctx.ShortTy;
+  case 'l':
+    return ast_ctx.getIntTypeForBitwidth(32, true);
+  // this used to be done like this:
+  //   ClangASTContext *lldb_ctx = ClangASTContext::GetASTContext(&ast_ctx);
+  //   if (!lldb_ctx)
+  //      return clang::QualType();
+  //   return lldb_ctx->GetIntTypeFromBitSize(32, true).GetQualType();
+  // which uses one of the constants if one is available, but we don't think all
+  // this work is necessary.
+  case 'q':
+    return ast_ctx.LongLongTy;
+  case 'C':
+    return ast_ctx.UnsignedCharTy;
+  case 'I':
+    return ast_ctx.UnsignedIntTy;
+  case 'S':
+    return ast_ctx.UnsignedShortTy;
+  case 'L':
+    return ast_ctx.getIntTypeForBitwidth(32, false);
+  // see note for 'l'
+  case 'Q':
+    return ast_ctx.UnsignedLongLongTy;
+  case 'f':
+    return ast_ctx.FloatTy;
+  case 'd':
+    return ast_ctx.DoubleTy;
+  case 'B':
+    return ast_ctx.BoolTy;
+  case 'v':
+    return ast_ctx.VoidTy;
+  case '*':
+    return ast_ctx.getPointerType(ast_ctx.CharTy);
+  case '#':
+    return ast_ctx.getObjCClassType();
+  case ':':
+    return ast_ctx.getObjCSelType();
+  case 'b': {
+    uint32_t size = ReadNumber(type);
+    if (bitfield_bit_size) {
+      *bitfield_bit_size = size;
+      return ast_ctx.UnsignedIntTy; // FIXME: the spec is fairly vague here.
+    } else
+      return clang::QualType();
+  }
+  case 'r': {
+    clang::QualType target_type = BuildType(ast_ctx, type, for_expression);
+    if (target_type.isNull())
+      return clang::QualType();
+    else if (target_type == ast_ctx.UnknownAnyTy)
+      return ast_ctx.UnknownAnyTy;
+    else
+      return ast_ctx.getConstType(target_type);
+  }
+  case '^': {
+    if (!for_expression && type.NextIf('?')) {
+      // if we are not supporting the concept of unknownAny, but what is being
+      // created here is an unknownAny*, then
+      // we can just get away with a void*
+      // this is theoretically wrong (in the same sense as 'theoretically
+      // nothing exists') but is way better than outright failure
+      // in many practical cases
+      return ast_ctx.VoidPtrTy;
+    } else {
+      clang::QualType target_type = BuildType(ast_ctx, type, for_expression);
+      if (target_type.isNull())
         return clang::QualType();
-    case 'c':
-        return ast_ctx.CharTy;
-    case 'i':
-        return ast_ctx.IntTy;
-    case 's':
-        return ast_ctx.ShortTy;
-    case 'l':
-        return ast_ctx.getIntTypeForBitwidth(32, true);
-        // this used to be done like this:
-        //   ClangASTContext *lldb_ctx = ClangASTContext::GetASTContext(&ast_ctx);
-        //   if (!lldb_ctx)
-        //      return clang::QualType();
-        //   return lldb_ctx->GetIntTypeFromBitSize(32, true).GetQualType();
-        // which uses one of the constants if one is available, but we don't think all this work is necessary.
-    case 'q':
-        return ast_ctx.LongLongTy;
-    case 'C':
-        return ast_ctx.UnsignedCharTy;
-    case 'I':
-        return ast_ctx.UnsignedIntTy;
-    case 'S':
-        return ast_ctx.UnsignedShortTy;
-    case 'L':
-        return ast_ctx.getIntTypeForBitwidth(32, false);
-        // see note for 'l'
-    case 'Q':
-        return ast_ctx.UnsignedLongLongTy;
-    case 'f':
-        return ast_ctx.FloatTy;
-    case 'd':
-        return ast_ctx.DoubleTy;
-    case 'B':
-        return ast_ctx.BoolTy;
-    case 'v':
-        return ast_ctx.VoidTy;
-    case '*':
-        return ast_ctx.getPointerType(ast_ctx.CharTy);
-    case '#':
-        return ast_ctx.getObjCClassType();
-    case ':':
-        return ast_ctx.getObjCSelType();
-    case 'b':
-        {
-            uint32_t size = ReadNumber(type);
-            if (bitfield_bit_size)
-            {
-                *bitfield_bit_size = size;
-                return ast_ctx.UnsignedIntTy; // FIXME: the spec is fairly vague here.
-            }
-            else
-                return clang::QualType();
-        }
-    case 'r':
-        {
-            clang::QualType target_type = BuildType(ast_ctx, type, for_expression);
-            if (target_type.isNull())
-                return clang::QualType();
-            else if (target_type == ast_ctx.UnknownAnyTy)
-                return ast_ctx.UnknownAnyTy;
-            else
-                return ast_ctx.getConstType(target_type);
-        }
-    case '^':
-        {
-            if (!for_expression && type.NextIf('?'))
-            {
-                // if we are not supporting the concept of unknownAny, but what is being created here is an unknownAny*, then
-                // we can just get away with a void*
-                // this is theoretically wrong (in the same sense as 'theoretically nothing exists') but is way better than outright failure
-                // in many practical cases
-                return ast_ctx.VoidPtrTy;
-            }
-            else
-            {
-                clang::QualType target_type = BuildType(ast_ctx, type, for_expression);
-                if (target_type.isNull())
-                    return clang::QualType();
-                else if (target_type == ast_ctx.UnknownAnyTy)
-                    return ast_ctx.UnknownAnyTy;
-                else
-                    return ast_ctx.getPointerType(target_type);
-            }
-        }
-    case '?':
-        return for_expression ? ast_ctx.UnknownAnyTy : clang::QualType();
+      else if (target_type == ast_ctx.UnknownAnyTy)
+        return ast_ctx.UnknownAnyTy;
+      else
+        return ast_ctx.getPointerType(target_type);
     }
+  }
+  case '?':
+    return for_expression ? ast_ctx.UnknownAnyTy : clang::QualType();
+  }
 }
 
-CompilerType
-AppleObjCTypeEncodingParser::RealizeType (clang::ASTContext &ast_ctx, const char* name, bool for_expression)
-{
-    if (name && name[0])
-    {
-        StringLexer lexer(name);
-        clang::QualType qual_type = BuildType(ast_ctx, lexer, for_expression);
-        return CompilerType(&ast_ctx, qual_type);
-    }
-    return CompilerType();
+CompilerType AppleObjCTypeEncodingParser::RealizeType(
+    clang::ASTContext &ast_ctx, const char *name, bool for_expression) {
+  if (name && name[0]) {
+    StringLexer lexer(name);
+    clang::QualType qual_type = BuildType(ast_ctx, lexer, for_expression);
+    return CompilerType(&ast_ctx, qual_type);
+  }
+  return CompilerType();
 }
-

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h Tue Sep  6 15:57:50 2016
@@ -16,66 +16,72 @@
 #include "clang/AST/ASTContext.h"
 
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/lldb-private.h"
 
 namespace lldb_utility {
-    class StringLexer;
+class StringLexer;
 }
 
 namespace lldb_private {
 
-    class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType
-    {
-    public:
-        AppleObjCTypeEncodingParser (ObjCLanguageRuntime& runtime);
-        ~AppleObjCTypeEncodingParser() override = default;
-        
-        CompilerType RealizeType(clang::ASTContext &ast_ctx, const char* name, bool for_expression) override;
-
-    private:
-        struct StructElement {
-            std::string name;
-            clang::QualType type;
-            uint32_t bitfield;
-            
-            StructElement ();
-            ~StructElement () = default;
-        };
-        
-        clang::QualType
-        BuildType (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression, uint32_t *bitfield_bit_size = nullptr);
-
-        clang::QualType
-        BuildStruct (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
-        
-        clang::QualType
-        BuildAggregate (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression, char opener, char closer, uint32_t kind);
-        
-        clang::QualType
-        BuildUnion (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
-        
-        clang::QualType
-        BuildArray (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
-        
-        std::string
-        ReadStructName(lldb_utility::StringLexer& type);
-        
-        StructElement
-        ReadStructElement (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
-        
-        clang::QualType
-        BuildObjCObjectPointerType (clang::ASTContext &ast_ctx, lldb_utility::StringLexer& type, bool for_expression);
-        
-        uint32_t
-        ReadNumber (lldb_utility::StringLexer& type);
-        
-        std::string
-        ReadQuotedString(lldb_utility::StringLexer& type);
-        
-        ObjCLanguageRuntime& m_runtime;
-    };
-    
+class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType {
+public:
+  AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime);
+  ~AppleObjCTypeEncodingParser() override = default;
+
+  CompilerType RealizeType(clang::ASTContext &ast_ctx, const char *name,
+                           bool for_expression) override;
+
+private:
+  struct StructElement {
+    std::string name;
+    clang::QualType type;
+    uint32_t bitfield;
+
+    StructElement();
+    ~StructElement() = default;
+  };
+
+  clang::QualType BuildType(clang::ASTContext &ast_ctx,
+                            lldb_utility::StringLexer &type,
+                            bool for_expression,
+                            uint32_t *bitfield_bit_size = nullptr);
+
+  clang::QualType BuildStruct(clang::ASTContext &ast_ctx,
+                              lldb_utility::StringLexer &type,
+                              bool for_expression);
+
+  clang::QualType BuildAggregate(clang::ASTContext &ast_ctx,
+                                 lldb_utility::StringLexer &type,
+                                 bool for_expression, char opener, char closer,
+                                 uint32_t kind);
+
+  clang::QualType BuildUnion(clang::ASTContext &ast_ctx,
+                             lldb_utility::StringLexer &type,
+                             bool for_expression);
+
+  clang::QualType BuildArray(clang::ASTContext &ast_ctx,
+                             lldb_utility::StringLexer &type,
+                             bool for_expression);
+
+  std::string ReadStructName(lldb_utility::StringLexer &type);
+
+  StructElement ReadStructElement(clang::ASTContext &ast_ctx,
+                                  lldb_utility::StringLexer &type,
+                                  bool for_expression);
+
+  clang::QualType BuildObjCObjectPointerType(clang::ASTContext &ast_ctx,
+                                             lldb_utility::StringLexer &type,
+                                             bool for_expression);
+
+  uint32_t ReadNumber(lldb_utility::StringLexer &type);
+
+  std::string ReadQuotedString(lldb_utility::StringLexer &type);
+
+  ObjCLanguageRuntime &m_runtime;
+};
+
 } // namespace lldb_private
 
 #endif // liblldb_AppleObjCTypeEncodingParser_h_




More information about the lldb-commits mailing list