[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/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Sep  6 15:57:50 2016
@@ -41,9 +41,9 @@
 
 #include "lldb/Interpreter/CommandInterpreter.h"
 
-#include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Symbol/CompileUnit.h"
+#include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/Type.h"
 
 #include "lldb/Target/ExecutionContext.h"
@@ -65,2050 +65,1687 @@ static user_id_t g_value_obj_uid = 0;
 //----------------------------------------------------------------------
 // ValueObject constructor
 //----------------------------------------------------------------------
-ValueObject::ValueObject (ValueObject &parent) :
-    UserID (++g_value_obj_uid), // Unique identifier for every value object
-    m_parent (&parent),
-    m_root (NULL),
-    m_update_point (parent.GetUpdatePoint ()),
-    m_name (),
-    m_data (),
-    m_value (),
-    m_error (),
-    m_value_str (),
-    m_old_value_str (),
-    m_location_str (),
-    m_summary_str (),
-    m_object_desc_str (),
-    m_validation_result(),
-    m_manager(parent.GetManager()),
-    m_children (),
-    m_synthetic_children (),
-    m_dynamic_value (NULL),
-    m_synthetic_value(NULL),
-    m_deref_valobj(NULL),
-    m_format (eFormatDefault),
-    m_last_format (eFormatDefault),
-    m_last_format_mgr_revision(0),
-    m_type_summary_sp(),
-    m_type_format_sp(),
-    m_synthetic_children_sp(),
-    m_type_validator_sp(),
-    m_user_id_of_forced_summary(),
-    m_address_type_of_ptr_or_ref_children(eAddressTypeInvalid),
-    m_value_checksum(),
-    m_preferred_display_language(lldb::eLanguageTypeUnknown),
-    m_language_flags(0),
-    m_value_is_valid (false),
-    m_value_did_change (false),
-    m_children_count_valid (false),
-    m_old_value_valid (false),
-    m_is_deref_of_parent (false),
-    m_is_array_item_for_pointer(false),
-    m_is_bitfield_for_scalar(false),
-    m_is_child_at_offset(false),
-    m_is_getting_summary(false),
-    m_did_calculate_complete_objc_class_type(false),
-    m_is_synthetic_children_generated(parent.m_is_synthetic_children_generated)
-{
-    m_manager->ManageObject(this);
+ValueObject::ValueObject(ValueObject &parent)
+    : UserID(++g_value_obj_uid), // Unique identifier for every value object
+      m_parent(&parent), m_root(NULL), m_update_point(parent.GetUpdatePoint()),
+      m_name(), m_data(), m_value(), m_error(), m_value_str(),
+      m_old_value_str(), m_location_str(), m_summary_str(), m_object_desc_str(),
+      m_validation_result(), m_manager(parent.GetManager()), m_children(),
+      m_synthetic_children(), m_dynamic_value(NULL), m_synthetic_value(NULL),
+      m_deref_valobj(NULL), m_format(eFormatDefault),
+      m_last_format(eFormatDefault), m_last_format_mgr_revision(0),
+      m_type_summary_sp(), m_type_format_sp(), m_synthetic_children_sp(),
+      m_type_validator_sp(), m_user_id_of_forced_summary(),
+      m_address_type_of_ptr_or_ref_children(eAddressTypeInvalid),
+      m_value_checksum(),
+      m_preferred_display_language(lldb::eLanguageTypeUnknown),
+      m_language_flags(0), m_value_is_valid(false), m_value_did_change(false),
+      m_children_count_valid(false), m_old_value_valid(false),
+      m_is_deref_of_parent(false), m_is_array_item_for_pointer(false),
+      m_is_bitfield_for_scalar(false), m_is_child_at_offset(false),
+      m_is_getting_summary(false),
+      m_did_calculate_complete_objc_class_type(false),
+      m_is_synthetic_children_generated(
+          parent.m_is_synthetic_children_generated) {
+  m_manager->ManageObject(this);
 }
 
 //----------------------------------------------------------------------
 // ValueObject constructor
 //----------------------------------------------------------------------
-ValueObject::ValueObject (ExecutionContextScope *exe_scope,
-                          AddressType child_ptr_or_ref_addr_type) :
-    UserID (++g_value_obj_uid), // Unique identifier for every value object
-    m_parent (NULL),
-    m_root (NULL),
-    m_update_point (exe_scope),
-    m_name (),
-    m_data (),
-    m_value (),
-    m_error (),
-    m_value_str (),
-    m_old_value_str (),
-    m_location_str (),
-    m_summary_str (),
-    m_object_desc_str (),
-    m_validation_result(),
-    m_manager(),
-    m_children (),
-    m_synthetic_children (),
-    m_dynamic_value (NULL),
-    m_synthetic_value(NULL),
-    m_deref_valobj(NULL),
-    m_format (eFormatDefault),
-    m_last_format (eFormatDefault),
-    m_last_format_mgr_revision(0),
-    m_type_summary_sp(),
-    m_type_format_sp(),
-    m_synthetic_children_sp(),
-    m_type_validator_sp(),
-    m_user_id_of_forced_summary(),
-    m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type),
-    m_value_checksum(),
-    m_preferred_display_language(lldb::eLanguageTypeUnknown),
-    m_language_flags(0),
-    m_value_is_valid (false),
-    m_value_did_change (false),
-    m_children_count_valid (false),
-    m_old_value_valid (false),
-    m_is_deref_of_parent (false),
-    m_is_array_item_for_pointer(false),
-    m_is_bitfield_for_scalar(false),
-    m_is_child_at_offset(false),
-    m_is_getting_summary(false),
-    m_did_calculate_complete_objc_class_type(false),
-    m_is_synthetic_children_generated(false)
-{
-    m_manager = new ValueObjectManager();
-    m_manager->ManageObject (this);
+ValueObject::ValueObject(ExecutionContextScope *exe_scope,
+                         AddressType child_ptr_or_ref_addr_type)
+    : UserID(++g_value_obj_uid), // Unique identifier for every value object
+      m_parent(NULL), m_root(NULL), m_update_point(exe_scope), m_name(),
+      m_data(), m_value(), m_error(), m_value_str(), m_old_value_str(),
+      m_location_str(), m_summary_str(), m_object_desc_str(),
+      m_validation_result(), m_manager(), m_children(), m_synthetic_children(),
+      m_dynamic_value(NULL), m_synthetic_value(NULL), m_deref_valobj(NULL),
+      m_format(eFormatDefault), m_last_format(eFormatDefault),
+      m_last_format_mgr_revision(0), m_type_summary_sp(), m_type_format_sp(),
+      m_synthetic_children_sp(), m_type_validator_sp(),
+      m_user_id_of_forced_summary(),
+      m_address_type_of_ptr_or_ref_children(child_ptr_or_ref_addr_type),
+      m_value_checksum(),
+      m_preferred_display_language(lldb::eLanguageTypeUnknown),
+      m_language_flags(0), m_value_is_valid(false), m_value_did_change(false),
+      m_children_count_valid(false), m_old_value_valid(false),
+      m_is_deref_of_parent(false), m_is_array_item_for_pointer(false),
+      m_is_bitfield_for_scalar(false), m_is_child_at_offset(false),
+      m_is_getting_summary(false),
+      m_did_calculate_complete_objc_class_type(false),
+      m_is_synthetic_children_generated(false) {
+  m_manager = new ValueObjectManager();
+  m_manager->ManageObject(this);
 }
 
 //----------------------------------------------------------------------
 // Destructor
 //----------------------------------------------------------------------
-ValueObject::~ValueObject ()
-{
-}
+ValueObject::~ValueObject() {}
 
-bool
-ValueObject::UpdateValueIfNeeded (bool update_format)
-{
-    
-    bool did_change_formats = false;
-    
-    if (update_format)
-        did_change_formats = UpdateFormatsIfNeeded();
-    
-    // If this is a constant value, then our success is predicated on whether
-    // we have an error or not
-    if (GetIsConstant())
-    {
-        // if you are constant, things might still have changed behind your back
-        // (e.g. you are a frozen object and things have changed deeper than you cared to freeze-dry yourself)
-        // in this case, your value has not changed, but "computed" entries might have, so you might now have
-        // a different summary, or a different object description. clear these so we will recompute them
-        if (update_format && !did_change_formats)
-            ClearUserVisibleData(eClearUserVisibleDataItemsSummary | eClearUserVisibleDataItemsDescription);
-        return m_error.Success();
-    }
+bool ValueObject::UpdateValueIfNeeded(bool update_format) {
 
-    bool first_update = IsChecksumEmpty();
-    
-    if (NeedsUpdating())
-    {
-        m_update_point.SetUpdated();
-        
-        // Save the old value using swap to avoid a string copy which
-        // also will clear our m_value_str
-        if (m_value_str.empty())
-        {
-            m_old_value_valid = false;
-        }
-        else
-        {
-            m_old_value_valid = true;
-            m_old_value_str.swap (m_value_str);
-            ClearUserVisibleData(eClearUserVisibleDataItemsValue);
-        }
+  bool did_change_formats = false;
 
-        ClearUserVisibleData();
-        
-        if (IsInScope())
-        {
-            const bool value_was_valid = GetValueIsValid();
-            SetValueDidChange (false);
-            
-            m_error.Clear();
-
-            // Call the pure virtual function to update the value
-            
-            bool need_compare_checksums = false;
-            llvm::SmallVector<uint8_t, 16> old_checksum;
-            
-            if (!first_update && CanProvideValue())
-            {
-                need_compare_checksums = true;
-                old_checksum.resize(m_value_checksum.size());
-                std::copy(m_value_checksum.begin(), m_value_checksum.end(), old_checksum.begin());
-            }
-            
-            bool success = UpdateValue ();
-            
-            SetValueIsValid (success);
-            
-            if (success)
-            {
-                const uint64_t max_checksum_size = 128;
-                m_data.Checksum(m_value_checksum,
-                                max_checksum_size);
-            }
-            else
-            {
-                need_compare_checksums = false;
-                m_value_checksum.clear();
-            }
-            
-            assert (!need_compare_checksums || (!old_checksum.empty() && !m_value_checksum.empty()));
+  if (update_format)
+    did_change_formats = UpdateFormatsIfNeeded();
 
-            if (first_update)
-                SetValueDidChange (false);
-            else if (!m_value_did_change && success == false)
-            {
-                // The value wasn't gotten successfully, so we mark this
-                // as changed if the value used to be valid and now isn't
-                SetValueDidChange (value_was_valid);
-            }
-            else if (need_compare_checksums)
-            {
-                SetValueDidChange(memcmp(&old_checksum[0], &m_value_checksum[0], m_value_checksum.size()));
-            }
-            
-        }
-        else
-        {
-            m_error.SetErrorString("out of scope");
-        }
-    }
+  // If this is a constant value, then our success is predicated on whether
+  // we have an error or not
+  if (GetIsConstant()) {
+    // if you are constant, things might still have changed behind your back
+    // (e.g. you are a frozen object and things have changed deeper than you
+    // cared to freeze-dry yourself)
+    // in this case, your value has not changed, but "computed" entries might
+    // have, so you might now have
+    // a different summary, or a different object description. clear these so we
+    // will recompute them
+    if (update_format && !did_change_formats)
+      ClearUserVisibleData(eClearUserVisibleDataItemsSummary |
+                           eClearUserVisibleDataItemsDescription);
     return m_error.Success();
-}
+  }
 
-bool
-ValueObject::UpdateFormatsIfNeeded()
-{
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    if (log)
-        log->Printf("[%s %p] checking for FormatManager revisions. ValueObject rev: %d - Global rev: %d",
-                    GetName().GetCString(), static_cast<void*>(this),
-                    m_last_format_mgr_revision,
-                    DataVisualization::GetCurrentRevision());
+  bool first_update = IsChecksumEmpty();
 
-    bool any_change = false;
+  if (NeedsUpdating()) {
+    m_update_point.SetUpdated();
 
-    if ( (m_last_format_mgr_revision != DataVisualization::GetCurrentRevision()))
-    {
-        m_last_format_mgr_revision = DataVisualization::GetCurrentRevision();
-        any_change = true;
-        
-        SetValueFormat(DataVisualization::GetFormat (*this, eNoDynamicValues));
-        SetSummaryFormat(DataVisualization::GetSummaryFormat (*this, GetDynamicValueType()));
+    // Save the old value using swap to avoid a string copy which
+    // also will clear our m_value_str
+    if (m_value_str.empty()) {
+      m_old_value_valid = false;
+    } else {
+      m_old_value_valid = true;
+      m_old_value_str.swap(m_value_str);
+      ClearUserVisibleData(eClearUserVisibleDataItemsValue);
+    }
+
+    ClearUserVisibleData();
+
+    if (IsInScope()) {
+      const bool value_was_valid = GetValueIsValid();
+      SetValueDidChange(false);
+
+      m_error.Clear();
+
+      // Call the pure virtual function to update the value
+
+      bool need_compare_checksums = false;
+      llvm::SmallVector<uint8_t, 16> old_checksum;
+
+      if (!first_update && CanProvideValue()) {
+        need_compare_checksums = true;
+        old_checksum.resize(m_value_checksum.size());
+        std::copy(m_value_checksum.begin(), m_value_checksum.end(),
+                  old_checksum.begin());
+      }
+
+      bool success = UpdateValue();
+
+      SetValueIsValid(success);
+
+      if (success) {
+        const uint64_t max_checksum_size = 128;
+        m_data.Checksum(m_value_checksum, max_checksum_size);
+      } else {
+        need_compare_checksums = false;
+        m_value_checksum.clear();
+      }
+
+      assert(!need_compare_checksums ||
+             (!old_checksum.empty() && !m_value_checksum.empty()));
+
+      if (first_update)
+        SetValueDidChange(false);
+      else if (!m_value_did_change && success == false) {
+        // The value wasn't gotten successfully, so we mark this
+        // as changed if the value used to be valid and now isn't
+        SetValueDidChange(value_was_valid);
+      } else if (need_compare_checksums) {
+        SetValueDidChange(memcmp(&old_checksum[0], &m_value_checksum[0],
+                                 m_value_checksum.size()));
+      }
+
+    } else {
+      m_error.SetErrorString("out of scope");
+    }
+  }
+  return m_error.Success();
+}
+
+bool ValueObject::UpdateFormatsIfNeeded() {
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+  if (log)
+    log->Printf("[%s %p] checking for FormatManager revisions. ValueObject "
+                "rev: %d - Global rev: %d",
+                GetName().GetCString(), static_cast<void *>(this),
+                m_last_format_mgr_revision,
+                DataVisualization::GetCurrentRevision());
+
+  bool any_change = false;
+
+  if ((m_last_format_mgr_revision != DataVisualization::GetCurrentRevision())) {
+    m_last_format_mgr_revision = DataVisualization::GetCurrentRevision();
+    any_change = true;
+
+    SetValueFormat(DataVisualization::GetFormat(*this, eNoDynamicValues));
+    SetSummaryFormat(
+        DataVisualization::GetSummaryFormat(*this, GetDynamicValueType()));
 #ifndef LLDB_DISABLE_PYTHON
-        SetSyntheticChildren(DataVisualization::GetSyntheticChildren (*this, GetDynamicValueType()));
+    SetSyntheticChildren(
+        DataVisualization::GetSyntheticChildren(*this, GetDynamicValueType()));
 #endif
-        SetValidator(DataVisualization::GetValidator(*this, GetDynamicValueType()));
-    }
+    SetValidator(DataVisualization::GetValidator(*this, GetDynamicValueType()));
+  }
 
-    return any_change;
+  return any_change;
 }
 
-void
-ValueObject::SetNeedsUpdate ()
-{
-    m_update_point.SetNeedsUpdate();
-    // We have to clear the value string here so ConstResult children will notice if their values are
-    // changed by hand (i.e. with SetValueAsCString).
-    ClearUserVisibleData(eClearUserVisibleDataItemsValue);
-}
-
-void
-ValueObject::ClearDynamicTypeInformation ()
-{
-    m_children_count_valid = false;
-    m_did_calculate_complete_objc_class_type = false;
-    m_last_format_mgr_revision = 0;
-    m_override_type = CompilerType();
-    SetValueFormat(lldb::TypeFormatImplSP());
-    SetSummaryFormat(lldb::TypeSummaryImplSP());
-    SetSyntheticChildren(lldb::SyntheticChildrenSP());
-}
-
-CompilerType
-ValueObject::MaybeCalculateCompleteType ()
-{
-    CompilerType compiler_type(GetCompilerTypeImpl());
-        
-    if (m_did_calculate_complete_objc_class_type)
-    {
-        if (m_override_type.IsValid())
-            return m_override_type;
-        else
-            return compiler_type;
-    }
-    
-    CompilerType class_type;
-    bool is_pointer_type = false;
-    
-    if (ClangASTContext::IsObjCObjectPointerType(compiler_type, &class_type))
-    {
-        is_pointer_type = true;
-    }
-    else if (ClangASTContext::IsObjCObjectOrInterfaceType(compiler_type))
-    {
-        class_type = compiler_type;
-    }
-    else
-    {
-        return compiler_type;
-    }
-    
-    m_did_calculate_complete_objc_class_type = true;
-    
-    if (class_type)
-    {
-        ConstString class_name (class_type.GetConstTypeName());
-        
-        if (class_name)
-        {
-            ProcessSP process_sp(GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
-            
-            if (process_sp)
-            {
-                ObjCLanguageRuntime *objc_language_runtime(process_sp->GetObjCLanguageRuntime());
-                
-                if (objc_language_runtime)
-                {
-                    TypeSP complete_objc_class_type_sp = objc_language_runtime->LookupInCompleteClassCache(class_name);
-                    
-                    if (complete_objc_class_type_sp)
-                    {
-                        CompilerType complete_class(complete_objc_class_type_sp->GetFullCompilerType ());
-                        
-                        if (complete_class.GetCompleteType())
-                        {
-                            if (is_pointer_type)
-                            {
-                                m_override_type = complete_class.GetPointerType();
-                            }
-                            else
-                            {
-                                m_override_type = complete_class;
-                            }
-                            
-                            if (m_override_type.IsValid())
-                                return m_override_type;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    return compiler_type;
+void ValueObject::SetNeedsUpdate() {
+  m_update_point.SetNeedsUpdate();
+  // We have to clear the value string here so ConstResult children will notice
+  // if their values are
+  // changed by hand (i.e. with SetValueAsCString).
+  ClearUserVisibleData(eClearUserVisibleDataItemsValue);
 }
 
-CompilerType
-ValueObject::GetCompilerType ()
-{
-    return MaybeCalculateCompleteType();
+void ValueObject::ClearDynamicTypeInformation() {
+  m_children_count_valid = false;
+  m_did_calculate_complete_objc_class_type = false;
+  m_last_format_mgr_revision = 0;
+  m_override_type = CompilerType();
+  SetValueFormat(lldb::TypeFormatImplSP());
+  SetSummaryFormat(lldb::TypeSummaryImplSP());
+  SetSyntheticChildren(lldb::SyntheticChildrenSP());
 }
 
-TypeImpl
-ValueObject::GetTypeImpl ()
-{
-    return TypeImpl(GetCompilerType());
-}
+CompilerType ValueObject::MaybeCalculateCompleteType() {
+  CompilerType compiler_type(GetCompilerTypeImpl());
 
-DataExtractor &
-ValueObject::GetDataExtractor ()
-{
-    UpdateValueIfNeeded(false);
-    return m_data;
-}
+  if (m_did_calculate_complete_objc_class_type) {
+    if (m_override_type.IsValid())
+      return m_override_type;
+    else
+      return compiler_type;
+  }
 
-const Error &
-ValueObject::GetError()
-{
-    UpdateValueIfNeeded(false);
-    return m_error;
-}
+  CompilerType class_type;
+  bool is_pointer_type = false;
 
-const ConstString &
-ValueObject::GetName() const
-{
-    return m_name;
-}
+  if (ClangASTContext::IsObjCObjectPointerType(compiler_type, &class_type)) {
+    is_pointer_type = true;
+  } else if (ClangASTContext::IsObjCObjectOrInterfaceType(compiler_type)) {
+    class_type = compiler_type;
+  } else {
+    return compiler_type;
+  }
 
-const char *
-ValueObject::GetLocationAsCString ()
-{
-    return GetLocationAsCStringImpl(m_value,
-                                    m_data);
-}
+  m_did_calculate_complete_objc_class_type = true;
 
-const char *
-ValueObject::GetLocationAsCStringImpl (const Value& value,
-                                       const DataExtractor& data)
-{
-    if (UpdateValueIfNeeded(false))
-    {
-        if (m_location_str.empty())
-        {
-            StreamString sstr;
-            
-            Value::ValueType value_type = value.GetValueType();
-            
-            switch (value_type)
-            {
-            case Value::eValueTypeScalar:
-            case Value::eValueTypeVector:
-                if (value.GetContextType() == Value::eContextTypeRegisterInfo)
-                {
-                    RegisterInfo *reg_info = value.GetRegisterInfo();
-                    if (reg_info)
-                    {
-                        if (reg_info->name)
-                            m_location_str = reg_info->name;
-                        else if (reg_info->alt_name)
-                            m_location_str = reg_info->alt_name;
-                        if (m_location_str.empty())
-                            m_location_str = (reg_info->encoding == lldb::eEncodingVector) ? "vector" : "scalar";
-                    }
-                }
-                if (m_location_str.empty())
-                    m_location_str = (value_type == Value::eValueTypeVector) ? "vector" : "scalar";
-                break;
-
-            case Value::eValueTypeLoadAddress:
-            case Value::eValueTypeFileAddress:
-            case Value::eValueTypeHostAddress:
-                {
-                    uint32_t addr_nibble_size = data.GetAddressByteSize() * 2;
-                    sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size, value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS));
-                    m_location_str.swap(sstr.GetString());
-                }
-                break;
+  if (class_type) {
+    ConstString class_name(class_type.GetConstTypeName());
+
+    if (class_name) {
+      ProcessSP process_sp(
+          GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
+
+      if (process_sp) {
+        ObjCLanguageRuntime *objc_language_runtime(
+            process_sp->GetObjCLanguageRuntime());
+
+        if (objc_language_runtime) {
+          TypeSP complete_objc_class_type_sp =
+              objc_language_runtime->LookupInCompleteClassCache(class_name);
+
+          if (complete_objc_class_type_sp) {
+            CompilerType complete_class(
+                complete_objc_class_type_sp->GetFullCompilerType());
+
+            if (complete_class.GetCompleteType()) {
+              if (is_pointer_type) {
+                m_override_type = complete_class.GetPointerType();
+              } else {
+                m_override_type = complete_class;
+              }
+
+              if (m_override_type.IsValid())
+                return m_override_type;
             }
+          }
         }
+      }
     }
-    return m_location_str.c_str();
+  }
+  return compiler_type;
 }
 
-Value &
-ValueObject::GetValue()
-{
-    return m_value;
+CompilerType ValueObject::GetCompilerType() {
+  return MaybeCalculateCompleteType();
 }
 
-const Value &
-ValueObject::GetValue() const
-{
-    return m_value;
+TypeImpl ValueObject::GetTypeImpl() { return TypeImpl(GetCompilerType()); }
+
+DataExtractor &ValueObject::GetDataExtractor() {
+  UpdateValueIfNeeded(false);
+  return m_data;
 }
 
-bool
-ValueObject::ResolveValue (Scalar &scalar)
-{
-    if (UpdateValueIfNeeded(false)) // make sure that you are up to date before returning anything
-    {
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        Value tmp_value(m_value);
-        scalar = tmp_value.ResolveValue(&exe_ctx);
-        if (scalar.IsValid())
-        {
-            const uint32_t bitfield_bit_size = GetBitfieldBitSize();
-            if (bitfield_bit_size)
-                return scalar.ExtractBitfield (bitfield_bit_size, GetBitfieldBitOffset());
-            return true;
-        }
-    }
-    return false;
+const Error &ValueObject::GetError() {
+  UpdateValueIfNeeded(false);
+  return m_error;
 }
 
-bool
-ValueObject::IsLogicalTrue (Error& error)
-{
-    if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage()))
-    {
-        LazyBool is_logical_true = language->IsLogicalTrue(*this, error);
-        switch (is_logical_true)
-        {
-            case eLazyBoolYes:
-            case eLazyBoolNo:
-                return (is_logical_true == true);
-            case eLazyBoolCalculate:
-                break;
+const ConstString &ValueObject::GetName() const { return m_name; }
+
+const char *ValueObject::GetLocationAsCString() {
+  return GetLocationAsCStringImpl(m_value, m_data);
+}
+
+const char *ValueObject::GetLocationAsCStringImpl(const Value &value,
+                                                  const DataExtractor &data) {
+  if (UpdateValueIfNeeded(false)) {
+    if (m_location_str.empty()) {
+      StreamString sstr;
+
+      Value::ValueType value_type = value.GetValueType();
+
+      switch (value_type) {
+      case Value::eValueTypeScalar:
+      case Value::eValueTypeVector:
+        if (value.GetContextType() == Value::eContextTypeRegisterInfo) {
+          RegisterInfo *reg_info = value.GetRegisterInfo();
+          if (reg_info) {
+            if (reg_info->name)
+              m_location_str = reg_info->name;
+            else if (reg_info->alt_name)
+              m_location_str = reg_info->alt_name;
+            if (m_location_str.empty())
+              m_location_str = (reg_info->encoding == lldb::eEncodingVector)
+                                   ? "vector"
+                                   : "scalar";
+          }
         }
+        if (m_location_str.empty())
+          m_location_str =
+              (value_type == Value::eValueTypeVector) ? "vector" : "scalar";
+        break;
+
+      case Value::eValueTypeLoadAddress:
+      case Value::eValueTypeFileAddress:
+      case Value::eValueTypeHostAddress: {
+        uint32_t addr_nibble_size = data.GetAddressByteSize() * 2;
+        sstr.Printf("0x%*.*llx", addr_nibble_size, addr_nibble_size,
+                    value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS));
+        m_location_str.swap(sstr.GetString());
+      } break;
+      }
+    }
+  }
+  return m_location_str.c_str();
+}
+
+Value &ValueObject::GetValue() { return m_value; }
+
+const Value &ValueObject::GetValue() const { return m_value; }
+
+bool ValueObject::ResolveValue(Scalar &scalar) {
+  if (UpdateValueIfNeeded(
+          false)) // make sure that you are up to date before returning anything
+  {
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    Value tmp_value(m_value);
+    scalar = tmp_value.ResolveValue(&exe_ctx);
+    if (scalar.IsValid()) {
+      const uint32_t bitfield_bit_size = GetBitfieldBitSize();
+      if (bitfield_bit_size)
+        return scalar.ExtractBitfield(bitfield_bit_size,
+                                      GetBitfieldBitOffset());
+      return true;
+    }
+  }
+  return false;
+}
+
+bool ValueObject::IsLogicalTrue(Error &error) {
+  if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage())) {
+    LazyBool is_logical_true = language->IsLogicalTrue(*this, error);
+    switch (is_logical_true) {
+    case eLazyBoolYes:
+    case eLazyBoolNo:
+      return (is_logical_true == true);
+    case eLazyBoolCalculate:
+      break;
     }
-    
-    Scalar scalar_value;
-    
-    if (!ResolveValue (scalar_value))
-    {
-        error.SetErrorString("failed to get a scalar result");
-        return false;
-    }
-    
-    bool ret;
-    if (scalar_value.ULongLong(1) == 0)
-        ret = false;
-    else
-        ret = true;
-    error.Clear();
-    return ret;
-}
+  }
 
-bool
-ValueObject::GetValueIsValid () const
-{
-    return m_value_is_valid;
-}
+  Scalar scalar_value;
 
+  if (!ResolveValue(scalar_value)) {
+    error.SetErrorString("failed to get a scalar result");
+    return false;
+  }
 
-void
-ValueObject::SetValueIsValid (bool b)
-{
-    m_value_is_valid = b;
+  bool ret;
+  if (scalar_value.ULongLong(1) == 0)
+    ret = false;
+  else
+    ret = true;
+  error.Clear();
+  return ret;
 }
 
-bool
-ValueObject::GetValueDidChange ()
-{
-    return m_value_did_change;
-}
+bool ValueObject::GetValueIsValid() const { return m_value_is_valid; }
 
-void
-ValueObject::SetValueDidChange (bool value_changed)
-{
-    m_value_did_change = value_changed;
+void ValueObject::SetValueIsValid(bool b) { m_value_is_valid = b; }
+
+bool ValueObject::GetValueDidChange() { return m_value_did_change; }
+
+void ValueObject::SetValueDidChange(bool value_changed) {
+  m_value_did_change = value_changed;
 }
 
-ValueObjectSP
-ValueObject::GetChildAtIndex (size_t idx, bool can_create)
-{
-    ValueObjectSP child_sp;
-    // We may need to update our value if we are dynamic
-    if (IsPossibleDynamicType ())
-        UpdateValueIfNeeded(false);
-    if (idx < GetNumChildren())
-    {
-        // Check if we have already made the child value object?
-        if (can_create && !m_children.HasChildAtIndex(idx))
-        {
-            // No we haven't created the child at this index, so lets have our
-            // subclass do it and cache the result for quick future access.
-            m_children.SetChildAtIndex(idx,CreateChildAtIndex (idx, false, 0));
-        }
-        
-        ValueObject* child = m_children.GetChildAtIndex(idx);
-        if (child != NULL)
-            return child->GetSP();
+ValueObjectSP ValueObject::GetChildAtIndex(size_t idx, bool can_create) {
+  ValueObjectSP child_sp;
+  // We may need to update our value if we are dynamic
+  if (IsPossibleDynamicType())
+    UpdateValueIfNeeded(false);
+  if (idx < GetNumChildren()) {
+    // Check if we have already made the child value object?
+    if (can_create && !m_children.HasChildAtIndex(idx)) {
+      // No we haven't created the child at this index, so lets have our
+      // subclass do it and cache the result for quick future access.
+      m_children.SetChildAtIndex(idx, CreateChildAtIndex(idx, false, 0));
     }
-    return child_sp;
+
+    ValueObject *child = m_children.GetChildAtIndex(idx);
+    if (child != NULL)
+      return child->GetSP();
+  }
+  return child_sp;
 }
 
 ValueObjectSP
-ValueObject::GetChildAtIndexPath (const std::initializer_list<size_t>& idxs,
-                                  size_t* index_of_error)
-{
-    return GetChildAtIndexPath( std::vector<size_t>(idxs),
-                               index_of_error );
+ValueObject::GetChildAtIndexPath(const std::initializer_list<size_t> &idxs,
+                                 size_t *index_of_error) {
+  return GetChildAtIndexPath(std::vector<size_t>(idxs), index_of_error);
 }
 
-ValueObjectSP
-ValueObject::GetChildAtIndexPath (const std::initializer_list< std::pair<size_t, bool> >& idxs,
-                                  size_t* index_of_error)
-{
-    return GetChildAtIndexPath( std::vector<std::pair<size_t,bool>>(idxs),
-                               index_of_error );
+ValueObjectSP ValueObject::GetChildAtIndexPath(
+    const std::initializer_list<std::pair<size_t, bool>> &idxs,
+    size_t *index_of_error) {
+  return GetChildAtIndexPath(std::vector<std::pair<size_t, bool>>(idxs),
+                             index_of_error);
 }
 
 lldb::ValueObjectSP
-ValueObject::GetChildAtIndexPath (const std::vector<size_t> &idxs,
-                                  size_t* index_of_error)
-{
-    if (idxs.size() == 0)
-        return GetSP();
-    ValueObjectSP root(GetSP());
-    for (size_t idx : idxs)
-    {
-        root = root->GetChildAtIndex(idx, true);
-        if (!root)
-        {
-            if (index_of_error)
-                *index_of_error = idx;
-            return root;
-        }
-    }
-    return root;
+ValueObject::GetChildAtIndexPath(const std::vector<size_t> &idxs,
+                                 size_t *index_of_error) {
+  if (idxs.size() == 0)
+    return GetSP();
+  ValueObjectSP root(GetSP());
+  for (size_t idx : idxs) {
+    root = root->GetChildAtIndex(idx, true);
+    if (!root) {
+      if (index_of_error)
+        *index_of_error = idx;
+      return root;
+    }
+  }
+  return root;
 }
 
-lldb::ValueObjectSP
-ValueObject::GetChildAtIndexPath (const std::vector< std::pair<size_t, bool> > &idxs,
-                                  size_t* index_of_error)
-{
-    if (idxs.size() == 0)
-        return GetSP();
-    ValueObjectSP root(GetSP());
-    for (std::pair<size_t, bool> idx : idxs)
-    {
-        root = root->GetChildAtIndex(idx.first, idx.second);
-        if (!root)
-        {
-            if (index_of_error)
-                *index_of_error = idx.first;
-            return root;
-        }
+lldb::ValueObjectSP ValueObject::GetChildAtIndexPath(
+    const std::vector<std::pair<size_t, bool>> &idxs, size_t *index_of_error) {
+  if (idxs.size() == 0)
+    return GetSP();
+  ValueObjectSP root(GetSP());
+  for (std::pair<size_t, bool> idx : idxs) {
+    root = root->GetChildAtIndex(idx.first, idx.second);
+    if (!root) {
+      if (index_of_error)
+        *index_of_error = idx.first;
+      return root;
     }
-    return root;
+  }
+  return root;
 }
 
 lldb::ValueObjectSP
-ValueObject::GetChildAtNamePath (const std::initializer_list<ConstString> &names,
-                                 ConstString* name_of_error)
-{
-    return GetChildAtNamePath( std::vector<ConstString>(names),
-                              name_of_error );
+ValueObject::GetChildAtNamePath(const std::initializer_list<ConstString> &names,
+                                ConstString *name_of_error) {
+  return GetChildAtNamePath(std::vector<ConstString>(names), name_of_error);
 }
 
-lldb::ValueObjectSP
-ValueObject::GetChildAtNamePath (const std::initializer_list< std::pair<ConstString, bool> > &names,
-                                 ConstString* name_of_error)
-{
-    return GetChildAtNamePath( std::vector<std::pair<ConstString,bool>>(names),
-                              name_of_error );
+lldb::ValueObjectSP ValueObject::GetChildAtNamePath(
+    const std::initializer_list<std::pair<ConstString, bool>> &names,
+    ConstString *name_of_error) {
+  return GetChildAtNamePath(std::vector<std::pair<ConstString, bool>>(names),
+                            name_of_error);
 }
 
 lldb::ValueObjectSP
-ValueObject::GetChildAtNamePath (const std::vector<ConstString> &names,
-                                 ConstString* name_of_error)
-{
-    if (names.size() == 0)
-        return GetSP();
-    ValueObjectSP root(GetSP());
-    for (ConstString name : names)
-    {
-        root = root->GetChildMemberWithName(name, true);
-        if (!root)
-        {
-            if (name_of_error)
-                *name_of_error = name;
-            return root;
-        }
-    }
-    return root;
+ValueObject::GetChildAtNamePath(const std::vector<ConstString> &names,
+                                ConstString *name_of_error) {
+  if (names.size() == 0)
+    return GetSP();
+  ValueObjectSP root(GetSP());
+  for (ConstString name : names) {
+    root = root->GetChildMemberWithName(name, true);
+    if (!root) {
+      if (name_of_error)
+        *name_of_error = name;
+      return root;
+    }
+  }
+  return root;
+}
+
+lldb::ValueObjectSP ValueObject::GetChildAtNamePath(
+    const std::vector<std::pair<ConstString, bool>> &names,
+    ConstString *name_of_error) {
+  if (names.size() == 0)
+    return GetSP();
+  ValueObjectSP root(GetSP());
+  for (std::pair<ConstString, bool> name : names) {
+    root = root->GetChildMemberWithName(name.first, name.second);
+    if (!root) {
+      if (name_of_error)
+        *name_of_error = name.first;
+      return root;
+    }
+  }
+  return root;
+}
+
+size_t ValueObject::GetIndexOfChildWithName(const ConstString &name) {
+  bool omit_empty_base_classes = true;
+  return GetCompilerType().GetIndexOfChildWithName(name.GetCString(),
+                                                   omit_empty_base_classes);
+}
+
+ValueObjectSP ValueObject::GetChildMemberWithName(const ConstString &name,
+                                                  bool can_create) {
+  // when getting a child by name, it could be buried inside some base
+  // classes (which really aren't part of the expression path), so we
+  // need a vector of indexes that can get us down to the correct child
+  ValueObjectSP child_sp;
+
+  // We may need to update our value if we are dynamic
+  if (IsPossibleDynamicType())
+    UpdateValueIfNeeded(false);
+
+  std::vector<uint32_t> child_indexes;
+  bool omit_empty_base_classes = true;
+  const size_t num_child_indexes =
+      GetCompilerType().GetIndexOfChildMemberWithName(
+          name.GetCString(), omit_empty_base_classes, child_indexes);
+  if (num_child_indexes > 0) {
+    std::vector<uint32_t>::const_iterator pos = child_indexes.begin();
+    std::vector<uint32_t>::const_iterator end = child_indexes.end();
+
+    child_sp = GetChildAtIndex(*pos, can_create);
+    for (++pos; pos != end; ++pos) {
+      if (child_sp) {
+        ValueObjectSP new_child_sp(child_sp->GetChildAtIndex(*pos, can_create));
+        child_sp = new_child_sp;
+      } else {
+        child_sp.reset();
+      }
+    }
+  }
+  return child_sp;
+}
+
+size_t ValueObject::GetNumChildren(uint32_t max) {
+  UpdateValueIfNeeded();
+
+  if (max < UINT32_MAX) {
+    if (m_children_count_valid) {
+      size_t children_count = m_children.GetChildrenCount();
+      return children_count <= max ? children_count : max;
+    } else
+      return CalculateNumChildren(max);
+  }
+
+  if (!m_children_count_valid) {
+    SetNumChildren(CalculateNumChildren());
+  }
+  return m_children.GetChildrenCount();
+}
+
+bool ValueObject::MightHaveChildren() {
+  bool has_children = false;
+  const uint32_t type_info = GetTypeInfo();
+  if (type_info) {
+    if (type_info & (eTypeHasChildren | eTypeIsPointer | eTypeIsReference))
+      has_children = true;
+  } else {
+    has_children = GetNumChildren() > 0;
+  }
+  return has_children;
 }
 
-lldb::ValueObjectSP
-ValueObject::GetChildAtNamePath (const std::vector< std::pair<ConstString, bool> > &names,
-                                 ConstString* name_of_error)
-{
-    if (names.size() == 0)
-        return GetSP();
-    ValueObjectSP root(GetSP());
-    for (std::pair<ConstString, bool> name : names)
-    {
-        root = root->GetChildMemberWithName(name.first, name.second);
-        if (!root)
-        {
-            if (name_of_error)
-                *name_of_error = name.first;
-                return root;
-        }
-    }
-    return root;
+// Should only be called by ValueObject::GetNumChildren()
+void ValueObject::SetNumChildren(size_t num_children) {
+  m_children_count_valid = true;
+  m_children.SetChildrenCount(num_children);
+}
+
+void ValueObject::SetName(const ConstString &name) { m_name = name; }
+
+ValueObject *ValueObject::CreateChildAtIndex(size_t idx,
+                                             bool synthetic_array_member,
+                                             int32_t synthetic_index) {
+  ValueObject *valobj = NULL;
+
+  bool omit_empty_base_classes = true;
+  bool ignore_array_bounds = synthetic_array_member;
+  std::string child_name_str;
+  uint32_t child_byte_size = 0;
+  int32_t child_byte_offset = 0;
+  uint32_t child_bitfield_bit_size = 0;
+  uint32_t child_bitfield_bit_offset = 0;
+  bool child_is_base_class = false;
+  bool child_is_deref_of_parent = false;
+  uint64_t language_flags = 0;
+
+  const bool transparent_pointers = synthetic_array_member == false;
+  CompilerType child_compiler_type;
+
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+
+  child_compiler_type = GetCompilerType().GetChildCompilerTypeAtIndex(
+      &exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
+      ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
+      child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
+      child_is_deref_of_parent, this, language_flags);
+  if (child_compiler_type) {
+    if (synthetic_index)
+      child_byte_offset += child_byte_size * synthetic_index;
+
+    ConstString child_name;
+    if (!child_name_str.empty())
+      child_name.SetCString(child_name_str.c_str());
+
+    valobj = new ValueObjectChild(
+        *this, child_compiler_type, child_name, child_byte_size,
+        child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
+        child_is_base_class, child_is_deref_of_parent, eAddressTypeInvalid,
+        language_flags);
+    // if (valobj)
+    //    valobj->SetAddressTypeOfChildren(eAddressTypeInvalid);
+  }
+
+  return valobj;
+}
+
+bool ValueObject::GetSummaryAsCString(TypeSummaryImpl *summary_ptr,
+                                      std::string &destination,
+                                      lldb::LanguageType lang) {
+  return GetSummaryAsCString(summary_ptr, destination,
+                             TypeSummaryOptions().SetLanguage(lang));
+}
+
+bool ValueObject::GetSummaryAsCString(TypeSummaryImpl *summary_ptr,
+                                      std::string &destination,
+                                      const TypeSummaryOptions &options) {
+  destination.clear();
+
+  // ideally we would like to bail out if passing NULL, but if we do so
+  // we end up not providing the summary for function pointers anymore
+  if (/*summary_ptr == NULL ||*/ m_is_getting_summary)
+    return false;
+
+  m_is_getting_summary = true;
+
+  TypeSummaryOptions actual_options(options);
+
+  if (actual_options.GetLanguage() == lldb::eLanguageTypeUnknown)
+    actual_options.SetLanguage(GetPreferredDisplayLanguage());
+
+  // this is a hot path in code and we prefer to avoid setting this string all
+  // too often also clearing out other
+  // information that we might care to see in a crash log. might be useful in
+  // very specific situations though.
+  /*Host::SetCrashDescriptionWithFormat("Trying to fetch a summary for %s %s.
+   Summary provider's description is %s",
+   GetTypeName().GetCString(),
+   GetName().GetCString(),
+   summary_ptr->GetDescription().c_str());*/
+
+  if (UpdateValueIfNeeded(false) && summary_ptr) {
+    if (HasSyntheticValue())
+      m_synthetic_value->UpdateValueIfNeeded(); // the summary might depend on
+                                                // the synthetic children being
+                                                // up-to-date (e.g. ${svar%#})
+    summary_ptr->FormatObject(this, destination, actual_options);
+  }
+  m_is_getting_summary = false;
+  return !destination.empty();
+}
+
+const char *ValueObject::GetSummaryAsCString(lldb::LanguageType lang) {
+  if (UpdateValueIfNeeded(true) && m_summary_str.empty()) {
+    TypeSummaryOptions summary_options;
+    summary_options.SetLanguage(lang);
+    GetSummaryAsCString(GetSummaryFormat().get(), m_summary_str,
+                        summary_options);
+  }
+  if (m_summary_str.empty())
+    return NULL;
+  return m_summary_str.c_str();
 }
 
-size_t
-ValueObject::GetIndexOfChildWithName (const ConstString &name)
-{
-    bool omit_empty_base_classes = true;
-    return GetCompilerType().GetIndexOfChildWithName (name.GetCString(), omit_empty_base_classes);
+bool ValueObject::GetSummaryAsCString(std::string &destination,
+                                      const TypeSummaryOptions &options) {
+  return GetSummaryAsCString(GetSummaryFormat().get(), destination, options);
 }
 
-ValueObjectSP
-ValueObject::GetChildMemberWithName (const ConstString &name, bool can_create)
-{
-    // when getting a child by name, it could be buried inside some base
-    // classes (which really aren't part of the expression path), so we
-    // need a vector of indexes that can get us down to the correct child
-    ValueObjectSP child_sp;
-
-    // We may need to update our value if we are dynamic
-    if (IsPossibleDynamicType ())
-        UpdateValueIfNeeded(false);
+bool ValueObject::IsCStringContainer(bool check_pointer) {
+  CompilerType pointee_or_element_compiler_type;
+  const Flags type_flags(GetTypeInfo(&pointee_or_element_compiler_type));
+  bool is_char_arr_ptr(type_flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
+                       pointee_or_element_compiler_type.IsCharType());
+  if (!is_char_arr_ptr)
+    return false;
+  if (!check_pointer)
+    return true;
+  if (type_flags.Test(eTypeIsArray))
+    return true;
+  addr_t cstr_address = LLDB_INVALID_ADDRESS;
+  AddressType cstr_address_type = eAddressTypeInvalid;
+  cstr_address = GetAddressOf(true, &cstr_address_type);
+  return (cstr_address != LLDB_INVALID_ADDRESS);
+}
 
-    std::vector<uint32_t> child_indexes;
-    bool omit_empty_base_classes = true;
-    const size_t num_child_indexes =  GetCompilerType().GetIndexOfChildMemberWithName (name.GetCString(),
-                                                                                    omit_empty_base_classes,
-                                                                                    child_indexes);
-    if (num_child_indexes > 0)
-    {
-        std::vector<uint32_t>::const_iterator pos = child_indexes.begin ();
-        std::vector<uint32_t>::const_iterator end = child_indexes.end ();
+size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx,
+                                   uint32_t item_count) {
+  CompilerType pointee_or_element_compiler_type;
+  const uint32_t type_info = GetTypeInfo(&pointee_or_element_compiler_type);
+  const bool is_pointer_type = type_info & eTypeIsPointer;
+  const bool is_array_type = type_info & eTypeIsArray;
+  if (!(is_pointer_type || is_array_type))
+    return 0;
 
-        child_sp = GetChildAtIndex(*pos, can_create);
-        for (++pos; pos != end; ++pos)
-        {
-            if (child_sp)
-            {
-                ValueObjectSP new_child_sp(child_sp->GetChildAtIndex (*pos, can_create));
-                child_sp = new_child_sp;
-            }
-            else
-            {
-                child_sp.reset();
-            }
+  if (item_count == 0)
+    return 0;
 
-        }
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+
+  const uint64_t item_type_size = pointee_or_element_compiler_type.GetByteSize(
+      exe_ctx.GetBestExecutionContextScope());
+  const uint64_t bytes = item_count * item_type_size;
+  const uint64_t offset = item_idx * item_type_size;
+
+  if (item_idx == 0 && item_count == 1) // simply a deref
+  {
+    if (is_pointer_type) {
+      Error error;
+      ValueObjectSP pointee_sp = Dereference(error);
+      if (error.Fail() || pointee_sp.get() == NULL)
+        return 0;
+      return pointee_sp->GetData(data, error);
+    } else {
+      ValueObjectSP child_sp = GetChildAtIndex(0, true);
+      if (child_sp.get() == NULL)
+        return 0;
+      Error error;
+      return child_sp->GetData(data, error);
     }
-    return child_sp;
-}
+    return true;
+  } else /* (items > 1) */
+  {
+    Error error;
+    lldb_private::DataBufferHeap *heap_buf_ptr = NULL;
+    lldb::DataBufferSP data_sp(heap_buf_ptr =
+                                   new lldb_private::DataBufferHeap());
+
+    AddressType addr_type;
+    lldb::addr_t addr = is_pointer_type ? GetPointerValue(&addr_type)
+                                        : GetAddressOf(true, &addr_type);
+
+    switch (addr_type) {
+    case eAddressTypeFile: {
+      ModuleSP module_sp(GetModule());
+      if (module_sp) {
+        addr = addr + offset;
+        Address so_addr;
+        module_sp->ResolveFileAddress(addr, so_addr);
+        ExecutionContext exe_ctx(GetExecutionContextRef());
+        Target *target = exe_ctx.GetTargetPtr();
+        if (target) {
+          heap_buf_ptr->SetByteSize(bytes);
+          size_t bytes_read = target->ReadMemory(
+              so_addr, false, heap_buf_ptr->GetBytes(), bytes, error);
+          if (error.Success()) {
+            data.SetData(data_sp);
+            return bytes_read;
+          }
+        }
+      }
+    } break;
+    case eAddressTypeLoad: {
+      ExecutionContext exe_ctx(GetExecutionContextRef());
+      Process *process = exe_ctx.GetProcessPtr();
+      if (process) {
+        heap_buf_ptr->SetByteSize(bytes);
+        size_t bytes_read = process->ReadMemory(
+            addr + offset, heap_buf_ptr->GetBytes(), bytes, error);
+        if (error.Success() || bytes_read > 0) {
+          data.SetData(data_sp);
+          return bytes_read;
+        }
+      }
+    } break;
+    case eAddressTypeHost: {
+      const uint64_t max_bytes =
+          GetCompilerType().GetByteSize(exe_ctx.GetBestExecutionContextScope());
+      if (max_bytes > offset) {
+        size_t bytes_read = std::min<uint64_t>(max_bytes - offset, bytes);
+        addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+        if (addr == 0 || addr == LLDB_INVALID_ADDRESS)
+          break;
+        heap_buf_ptr->CopyData((uint8_t *)(addr + offset), bytes_read);
+        data.SetData(data_sp);
+        return bytes_read;
+      }
+    } break;
+    case eAddressTypeInvalid:
+      break;
+    }
+  }
+  return 0;
+}
+
+uint64_t ValueObject::GetData(DataExtractor &data, Error &error) {
+  UpdateValueIfNeeded(false);
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  error = m_value.GetValueAsData(&exe_ctx, data, 0, GetModule().get());
+  if (error.Fail()) {
+    if (m_data.GetByteSize()) {
+      data = m_data;
+      error.Clear();
+      return data.GetByteSize();
+    } else {
+      return 0;
+    }
+  }
+  data.SetAddressByteSize(m_data.GetAddressByteSize());
+  data.SetByteOrder(m_data.GetByteOrder());
+  return data.GetByteSize();
+}
+
+bool ValueObject::SetData(DataExtractor &data, Error &error) {
+  error.Clear();
+  // Make sure our value is up to date first so that our location and location
+  // type is valid.
+  if (!UpdateValueIfNeeded(false)) {
+    error.SetErrorString("unable to read value");
+    return false;
+  }
 
+  uint64_t count = 0;
+  const Encoding encoding = GetCompilerType().GetEncoding(count);
 
-size_t
-ValueObject::GetNumChildren (uint32_t max)
-{
-    UpdateValueIfNeeded();
+  const size_t byte_size = GetByteSize();
 
-    if (max < UINT32_MAX)
-    {
-        if (m_children_count_valid)
-        {
-            size_t children_count = m_children.GetChildrenCount();
-            return children_count <= max ? children_count : max;
-        }
-        else
-            return CalculateNumChildren(max);
-    }
+  Value::ValueType value_type = m_value.GetValueType();
 
-    if (!m_children_count_valid)
-    {
-        SetNumChildren (CalculateNumChildren());
+  switch (value_type) {
+  case Value::eValueTypeScalar: {
+    Error set_error =
+        m_value.GetScalar().SetValueFromData(data, encoding, byte_size);
+
+    if (!set_error.Success()) {
+      error.SetErrorStringWithFormat("unable to set scalar value: %s",
+                                     set_error.AsCString());
+      return false;
+    }
+  } break;
+  case Value::eValueTypeLoadAddress: {
+    // If it is a load address, then the scalar value is the storage location
+    // of the data, and we have to shove this value down to that load location.
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    Process *process = exe_ctx.GetProcessPtr();
+    if (process) {
+      addr_t target_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+      size_t bytes_written = process->WriteMemory(
+          target_addr, data.GetDataStart(), byte_size, error);
+      if (!error.Success())
+        return false;
+      if (bytes_written != byte_size) {
+        error.SetErrorString("unable to write value to memory");
+        return false;
+      }
     }
-    return m_children.GetChildrenCount();
-}
+  } break;
+  case Value::eValueTypeHostAddress: {
+    // If it is a host address, then we stuff the scalar as a DataBuffer into
+    // the Value's data.
+    DataBufferSP buffer_sp(new DataBufferHeap(byte_size, 0));
+    m_data.SetData(buffer_sp, 0);
+    data.CopyByteOrderedData(0, byte_size,
+                             const_cast<uint8_t *>(m_data.GetDataStart()),
+                             byte_size, m_data.GetByteOrder());
+    m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
+  } break;
+  case Value::eValueTypeFileAddress:
+  case Value::eValueTypeVector:
+    break;
+  }
+
+  // If we have reached this point, then we have successfully changed the value.
+  SetNeedsUpdate();
+  return true;
+}
+
+static bool CopyStringDataToBufferSP(const StreamString &source,
+                                     lldb::DataBufferSP &destination) {
+  destination.reset(new DataBufferHeap(source.GetSize() + 1, 0));
+  memcpy(destination->GetBytes(), source.GetString().c_str(), source.GetSize());
+  return true;
+}
+
+std::pair<size_t, bool>
+ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Error &error,
+                               uint32_t max_length, bool honor_array,
+                               Format item_format) {
+  bool was_capped = false;
+  StreamString s;
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  Target *target = exe_ctx.GetTargetPtr();
+
+  if (!target) {
+    s << "<no target to read from>";
+    error.SetErrorString("no target to read from");
+    CopyStringDataToBufferSP(s, buffer_sp);
+    return {0, was_capped};
+  }
 
-bool
-ValueObject::MightHaveChildren()
-{
-    bool has_children = false;
-    const uint32_t type_info = GetTypeInfo();
-    if (type_info)
-    {
-        if (type_info & (eTypeHasChildren |
-                         eTypeIsPointer |
-                         eTypeIsReference))
-            has_children = true;
-    }
-    else
-    {
-        has_children = GetNumChildren () > 0;
+  if (max_length == 0)
+    max_length = target->GetMaximumSizeOfStringSummary();
+
+  size_t bytes_read = 0;
+  size_t total_bytes_read = 0;
+
+  CompilerType compiler_type = GetCompilerType();
+  CompilerType elem_or_pointee_compiler_type;
+  const Flags type_flags(GetTypeInfo(&elem_or_pointee_compiler_type));
+  if (type_flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
+      elem_or_pointee_compiler_type.IsCharType()) {
+    addr_t cstr_address = LLDB_INVALID_ADDRESS;
+    AddressType cstr_address_type = eAddressTypeInvalid;
+
+    size_t cstr_len = 0;
+    bool capped_data = false;
+    const bool is_array = type_flags.Test(eTypeIsArray);
+    if (is_array) {
+      // We have an array
+      uint64_t array_size = 0;
+      if (compiler_type.IsArrayType(NULL, &array_size, NULL)) {
+        cstr_len = array_size;
+        if (cstr_len > max_length) {
+          capped_data = true;
+          cstr_len = max_length;
+        }
+      }
+      cstr_address = GetAddressOf(true, &cstr_address_type);
+    } else {
+      // We have a pointer
+      cstr_address = GetPointerValue(&cstr_address_type);
+    }
+
+    if (cstr_address == 0 || cstr_address == LLDB_INVALID_ADDRESS) {
+      if (cstr_address_type == eAddressTypeHost && is_array) {
+        const char *cstr = GetDataExtractor().PeekCStr(0);
+        if (cstr == nullptr) {
+          s << "<invalid address>";
+          error.SetErrorString("invalid address");
+          CopyStringDataToBufferSP(s, buffer_sp);
+          return {0, was_capped};
+        }
+        buffer_sp.reset(new DataBufferHeap(cstr_len, 0));
+        memcpy(buffer_sp->GetBytes(), cstr, cstr_len);
+        return {cstr_len, was_capped};
+      } else {
+        s << "<invalid address>";
+        error.SetErrorString("invalid address");
+        CopyStringDataToBufferSP(s, buffer_sp);
+        return {0, was_capped};
+      }
     }
-    return has_children;
-}
 
-// Should only be called by ValueObject::GetNumChildren()
-void
-ValueObject::SetNumChildren (size_t num_children)
-{
-    m_children_count_valid = true;
-    m_children.SetChildrenCount(num_children);
-}
+    Address cstr_so_addr(cstr_address);
+    DataExtractor data;
+    if (cstr_len > 0 && honor_array) {
+      // I am using GetPointeeData() here to abstract the fact that some
+      // ValueObjects are actually frozen pointers in the host
+      // but the pointed-to data lives in the debuggee, and GetPointeeData()
+      // automatically takes care of this
+      GetPointeeData(data, 0, cstr_len);
+
+      if ((bytes_read = data.GetByteSize()) > 0) {
+        total_bytes_read = bytes_read;
+        for (size_t offset = 0; offset < bytes_read; offset++)
+          s.Printf("%c", *data.PeekData(offset, 1));
+        if (capped_data)
+          was_capped = true;
+      }
+    } else {
+      cstr_len = max_length;
+      const size_t k_max_buf_size = 64;
+
+      size_t offset = 0;
+
+      int cstr_len_displayed = -1;
+      bool capped_cstr = false;
+      // I am using GetPointeeData() here to abstract the fact that some
+      // ValueObjects are actually frozen pointers in the host
+      // but the pointed-to data lives in the debuggee, and GetPointeeData()
+      // automatically takes care of this
+      while ((bytes_read = GetPointeeData(data, offset, k_max_buf_size)) > 0) {
+        total_bytes_read += bytes_read;
+        const char *cstr = data.PeekCStr(0);
+        size_t len = strnlen(cstr, k_max_buf_size);
+        if (cstr_len_displayed < 0)
+          cstr_len_displayed = len;
+
+        if (len == 0)
+          break;
+        cstr_len_displayed += len;
+        if (len > bytes_read)
+          len = bytes_read;
+        if (len > cstr_len)
+          len = cstr_len;
+
+        for (size_t offset = 0; offset < bytes_read; offset++)
+          s.Printf("%c", *data.PeekData(offset, 1));
+
+        if (len < k_max_buf_size)
+          break;
+
+        if (len >= cstr_len) {
+          capped_cstr = true;
+          break;
+        }
+
+        cstr_len -= len;
+        offset += len;
+      }
+
+      if (cstr_len_displayed >= 0) {
+        if (capped_cstr)
+          was_capped = true;
+      }
+    }
+  } else {
+    error.SetErrorString("not a string object");
+    s << "<not a string object>";
+  }
+  CopyStringDataToBufferSP(s, buffer_sp);
+  return {total_bytes_read, was_capped};
+}
+
+std::pair<TypeValidatorResult, std::string> ValueObject::GetValidationStatus() {
+  if (!UpdateValueIfNeeded(true))
+    return {TypeValidatorResult::Success,
+            ""}; // not the validator's job to discuss update problems
+
+  if (m_validation_result.hasValue())
+    return m_validation_result.getValue();
+
+  if (!m_type_validator_sp)
+    return {TypeValidatorResult::Success, ""}; // no validator no failure
+
+  auto outcome = m_type_validator_sp->FormatObject(this);
 
-void
-ValueObject::SetName (const ConstString &name)
-{
-    m_name = name;
+  return (m_validation_result = {outcome.m_result, outcome.m_message})
+      .getValue();
 }
 
-ValueObject *
-ValueObject::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index)
-{
-    ValueObject *valobj = NULL;
-    
-    bool omit_empty_base_classes = true;
-    bool ignore_array_bounds = synthetic_array_member;
-    std::string child_name_str;
-    uint32_t child_byte_size = 0;
-    int32_t child_byte_offset = 0;
-    uint32_t child_bitfield_bit_size = 0;
-    uint32_t child_bitfield_bit_offset = 0;
-    bool child_is_base_class = false;
-    bool child_is_deref_of_parent = false;
-    uint64_t language_flags = 0;
+const char *ValueObject::GetObjectDescription() {
 
-    const bool transparent_pointers = synthetic_array_member == false;
-    CompilerType child_compiler_type;
-    
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    
-    child_compiler_type = GetCompilerType().GetChildCompilerTypeAtIndex(&exe_ctx,
-                                                                        idx,
-                                                                        transparent_pointers,
-                                                                        omit_empty_base_classes,
-                                                                        ignore_array_bounds,
-                                                                        child_name_str,
-                                                                        child_byte_size,
-                                                                        child_byte_offset,
-                                                                        child_bitfield_bit_size,
-                                                                        child_bitfield_bit_offset,
-                                                                        child_is_base_class,
-                                                                        child_is_deref_of_parent,
-                                                                        this,
-                                                                        language_flags);
-    if (child_compiler_type)
-    {
-        if (synthetic_index)
-            child_byte_offset += child_byte_size * synthetic_index;
+  if (!UpdateValueIfNeeded(true))
+    return NULL;
 
-        ConstString child_name;
-        if (!child_name_str.empty())
-            child_name.SetCString (child_name_str.c_str());
-
-        valobj = new ValueObjectChild (*this,
-                                       child_compiler_type,
-                                       child_name,
-                                       child_byte_size,
-                                       child_byte_offset,
-                                       child_bitfield_bit_size,
-                                       child_bitfield_bit_offset,
-                                       child_is_base_class,
-                                       child_is_deref_of_parent,
-                                       eAddressTypeInvalid,
-                                       language_flags);
-        //if (valobj)
-        //    valobj->SetAddressTypeOfChildren(eAddressTypeInvalid);
-   }
-    
-    return valobj;
-}
-
-bool
-ValueObject::GetSummaryAsCString (TypeSummaryImpl* summary_ptr,
-                                  std::string& destination,
-                                  lldb::LanguageType lang)
-{
-    return GetSummaryAsCString(summary_ptr, destination, TypeSummaryOptions().SetLanguage(lang));
-}
-
-bool
-ValueObject::GetSummaryAsCString (TypeSummaryImpl* summary_ptr,
-                                  std::string& destination,
-                                  const TypeSummaryOptions& options)
-{
-    destination.clear();
-    
-    // ideally we would like to bail out if passing NULL, but if we do so
-    // we end up not providing the summary for function pointers anymore
-    if (/*summary_ptr == NULL ||*/ m_is_getting_summary)
-        return false;
-    
-    m_is_getting_summary = true;
-    
-    TypeSummaryOptions actual_options(options);
-    
-    if (actual_options.GetLanguage() == lldb::eLanguageTypeUnknown)
-        actual_options.SetLanguage(GetPreferredDisplayLanguage());
-    
-    // this is a hot path in code and we prefer to avoid setting this string all too often also clearing out other
-    // information that we might care to see in a crash log. might be useful in very specific situations though.
-    /*Host::SetCrashDescriptionWithFormat("Trying to fetch a summary for %s %s. Summary provider's description is %s",
-     GetTypeName().GetCString(),
-     GetName().GetCString(),
-     summary_ptr->GetDescription().c_str());*/
-    
-    if (UpdateValueIfNeeded (false) && summary_ptr)
-    {
-        if (HasSyntheticValue())
-            m_synthetic_value->UpdateValueIfNeeded(); // the summary might depend on the synthetic children being up-to-date (e.g. ${svar%#})
-        summary_ptr->FormatObject(this, destination, actual_options);
-    }
-    m_is_getting_summary = false;
-    return !destination.empty();
+  if (!m_object_desc_str.empty())
+    return m_object_desc_str.c_str();
+
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  Process *process = exe_ctx.GetProcessPtr();
+  if (process == NULL)
+    return NULL;
+
+  StreamString s;
+
+  LanguageType language = GetObjectRuntimeLanguage();
+  LanguageRuntime *runtime = process->GetLanguageRuntime(language);
+
+  if (runtime == NULL) {
+    // Aw, hell, if the things a pointer, or even just an integer, let's try
+    // ObjC anyway...
+    CompilerType compiler_type = GetCompilerType();
+    if (compiler_type) {
+      bool is_signed;
+      if (compiler_type.IsIntegerType(is_signed) ||
+          compiler_type.IsPointerType()) {
+        runtime = process->GetLanguageRuntime(eLanguageTypeObjC);
+      }
+    }
+  }
+
+  if (runtime && runtime->GetObjectDescription(s, *this)) {
+    m_object_desc_str.append(s.GetData());
+  }
+
+  if (m_object_desc_str.empty())
+    return NULL;
+  else
+    return m_object_desc_str.c_str();
 }
 
-const char *
-ValueObject::GetSummaryAsCString (lldb::LanguageType lang)
-{
-    if (UpdateValueIfNeeded(true) && m_summary_str.empty())
-    {
-        TypeSummaryOptions summary_options;
-        summary_options.SetLanguage(lang);
-        GetSummaryAsCString(GetSummaryFormat().get(),
-                            m_summary_str,
-                            summary_options);
-    }
-    if (m_summary_str.empty())
-        return NULL;
-    return m_summary_str.c_str();
-}
-
-bool
-ValueObject::GetSummaryAsCString (std::string& destination,
-                                  const TypeSummaryOptions& options)
-{
-    return GetSummaryAsCString(GetSummaryFormat().get(),
-                               destination,
-                               options);
-}
-
-bool
-ValueObject::IsCStringContainer(bool check_pointer)
-{
-    CompilerType pointee_or_element_compiler_type;
-    const Flags type_flags (GetTypeInfo (&pointee_or_element_compiler_type));
-    bool is_char_arr_ptr (type_flags.AnySet (eTypeIsArray | eTypeIsPointer) &&
-                          pointee_or_element_compiler_type.IsCharType ());
-    if (!is_char_arr_ptr)
-        return false;
-    if (!check_pointer)
-        return true;
-    if (type_flags.Test(eTypeIsArray))
-        return true;
-    addr_t cstr_address = LLDB_INVALID_ADDRESS;
-    AddressType cstr_address_type = eAddressTypeInvalid;
-    cstr_address = GetAddressOf (true, &cstr_address_type);
-    return (cstr_address != LLDB_INVALID_ADDRESS);
+bool ValueObject::GetValueAsCString(const lldb_private::TypeFormatImpl &format,
+                                    std::string &destination) {
+  if (UpdateValueIfNeeded(false))
+    return format.FormatObject(this, destination);
+  else
+    return false;
 }
 
-size_t
-ValueObject::GetPointeeData (DataExtractor& data,
-                             uint32_t item_idx,
-                             uint32_t item_count)
-{
-    CompilerType pointee_or_element_compiler_type;
-    const uint32_t type_info = GetTypeInfo (&pointee_or_element_compiler_type);
-    const bool is_pointer_type = type_info & eTypeIsPointer;
-    const bool is_array_type = type_info & eTypeIsArray;
-    if (!(is_pointer_type || is_array_type))
-        return 0;
-    
-    if (item_count == 0)
-        return 0;
-    
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    
-    const uint64_t item_type_size = pointee_or_element_compiler_type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
-    const uint64_t bytes = item_count * item_type_size;
-    const uint64_t offset = item_idx * item_type_size;
-    
-    if (item_idx == 0 && item_count == 1) // simply a deref
-    {
-        if (is_pointer_type)
-        {
-            Error error;
-            ValueObjectSP pointee_sp = Dereference(error);
-            if (error.Fail() || pointee_sp.get() == NULL)
-                return 0;
-            return pointee_sp->GetData(data, error);
-        }
-        else
-        {
-            ValueObjectSP child_sp = GetChildAtIndex(0, true);
-            if (child_sp.get() == NULL)
-                return 0;
-            Error error;
-            return child_sp->GetData(data, error);
-        }
-        return true;
-    }
-    else /* (items > 1) */
-    {
-        Error error;
-        lldb_private::DataBufferHeap* heap_buf_ptr = NULL;
-        lldb::DataBufferSP data_sp(heap_buf_ptr = new lldb_private::DataBufferHeap());
-        
-        AddressType addr_type;
-        lldb::addr_t addr = is_pointer_type ? GetPointerValue(&addr_type) : GetAddressOf(true, &addr_type);
-        
-        switch (addr_type)
-        {
-            case eAddressTypeFile:
-                {
-                    ModuleSP module_sp (GetModule());
-                    if (module_sp)
-                    {
-                        addr = addr + offset;
-                        Address so_addr;
-                        module_sp->ResolveFileAddress(addr, so_addr);
-                        ExecutionContext exe_ctx (GetExecutionContextRef());
-                        Target* target = exe_ctx.GetTargetPtr();
-                        if (target)
-                        {
-                            heap_buf_ptr->SetByteSize(bytes);
-                            size_t bytes_read = target->ReadMemory(so_addr, false, heap_buf_ptr->GetBytes(), bytes, error);
-                            if (error.Success())
-                            {
-                                data.SetData(data_sp);
-                                return bytes_read;
-                            }
-                        }
-                    }
-                }
-                break;
-            case eAddressTypeLoad:
-                {
-                    ExecutionContext exe_ctx (GetExecutionContextRef());
-                    Process *process = exe_ctx.GetProcessPtr();
-                    if (process)
-                    {
-                        heap_buf_ptr->SetByteSize(bytes);
-                        size_t bytes_read = process->ReadMemory(addr + offset, heap_buf_ptr->GetBytes(), bytes, error);
-                        if (error.Success() || bytes_read > 0)
-                        {
-                            data.SetData(data_sp);
-                            return bytes_read;
-                        }
-                    }
-                }
-                break;
-            case eAddressTypeHost:
-                {
-                    const uint64_t max_bytes = GetCompilerType().GetByteSize(exe_ctx.GetBestExecutionContextScope());
-                    if (max_bytes > offset)
-                    {
-                        size_t bytes_read = std::min<uint64_t>(max_bytes - offset, bytes);
-                        addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-                        if (addr == 0 || addr == LLDB_INVALID_ADDRESS)
-                            break;
-                        heap_buf_ptr->CopyData((uint8_t*)(addr + offset), bytes_read);
-                        data.SetData(data_sp);
-                        return bytes_read;
-                    }
-                }
-                break;
-            case eAddressTypeInvalid:
-                break;
+bool ValueObject::GetValueAsCString(lldb::Format format,
+                                    std::string &destination) {
+  return GetValueAsCString(TypeFormatImpl_Format(format), destination);
+}
+
+const char *ValueObject::GetValueAsCString() {
+  if (UpdateValueIfNeeded(true)) {
+    lldb::TypeFormatImplSP format_sp;
+    lldb::Format my_format = GetFormat();
+    if (my_format == lldb::eFormatDefault) {
+      if (m_type_format_sp)
+        format_sp = m_type_format_sp;
+      else {
+        if (m_is_bitfield_for_scalar)
+          my_format = eFormatUnsigned;
+        else {
+          if (m_value.GetContextType() == Value::eContextTypeRegisterInfo) {
+            const RegisterInfo *reg_info = m_value.GetRegisterInfo();
+            if (reg_info)
+              my_format = reg_info->format;
+          } else {
+            my_format = GetValue().GetCompilerType().GetFormat();
+          }
+        }
+      }
+    }
+    if (my_format != m_last_format || m_value_str.empty()) {
+      m_last_format = my_format;
+      if (!format_sp)
+        format_sp.reset(new TypeFormatImpl_Format(my_format));
+      if (GetValueAsCString(*format_sp.get(), m_value_str)) {
+        if (!m_value_did_change && m_old_value_valid) {
+          // The value was gotten successfully, so we consider the
+          // value as changed if the value string differs
+          SetValueDidChange(m_old_value_str != m_value_str);
         }
+      }
     }
-    return 0;
+  }
+  if (m_value_str.empty())
+    return NULL;
+  return m_value_str.c_str();
 }
 
-uint64_t
-ValueObject::GetData (DataExtractor& data, Error &error)
-{
-    UpdateValueIfNeeded(false);
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    error = m_value.GetValueAsData(&exe_ctx, data, 0, GetModule().get());
-    if (error.Fail())
-    {
-        if (m_data.GetByteSize())
-        {
-            data = m_data;
-            error.Clear();
-            return data.GetByteSize();
-        }
-        else
-        {
-            return 0;
-        }
+// if > 8bytes, 0 is returned. this method should mostly be used
+// to read address values out of pointers
+uint64_t ValueObject::GetValueAsUnsigned(uint64_t fail_value, bool *success) {
+  // If our byte size is zero this is an aggregate type that has children
+  if (CanProvideValue()) {
+    Scalar scalar;
+    if (ResolveValue(scalar)) {
+      if (success)
+        *success = true;
+      return scalar.ULongLong(fail_value);
+    }
+    // fallthrough, otherwise...
+  }
+
+  if (success)
+    *success = false;
+  return fail_value;
+}
+
+int64_t ValueObject::GetValueAsSigned(int64_t fail_value, bool *success) {
+  // If our byte size is zero this is an aggregate type that has children
+  if (CanProvideValue()) {
+    Scalar scalar;
+    if (ResolveValue(scalar)) {
+      if (success)
+        *success = true;
+      return scalar.SLongLong(fail_value);
+    }
+    // fallthrough, otherwise...
+  }
+
+  if (success)
+    *success = false;
+  return fail_value;
+}
+
+// if any more "special cases" are added to
+// ValueObject::DumpPrintableRepresentation() please keep
+// this call up to date by returning true for your new special cases. We will
+// eventually move
+// to checking this call result before trying to display special cases
+bool ValueObject::HasSpecialPrintableRepresentation(
+    ValueObjectRepresentationStyle val_obj_display, Format custom_format) {
+  Flags flags(GetTypeInfo());
+  if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
+      val_obj_display == ValueObject::eValueObjectRepresentationStyleValue) {
+    if (IsCStringContainer(true) &&
+        (custom_format == eFormatCString || custom_format == eFormatCharArray ||
+         custom_format == eFormatChar || custom_format == eFormatVectorOfChar))
+      return true;
+
+    if (flags.Test(eTypeIsArray)) {
+      if ((custom_format == eFormatBytes) ||
+          (custom_format == eFormatBytesWithASCII))
+        return true;
+
+      if ((custom_format == eFormatVectorOfChar) ||
+          (custom_format == eFormatVectorOfFloat32) ||
+          (custom_format == eFormatVectorOfFloat64) ||
+          (custom_format == eFormatVectorOfSInt16) ||
+          (custom_format == eFormatVectorOfSInt32) ||
+          (custom_format == eFormatVectorOfSInt64) ||
+          (custom_format == eFormatVectorOfSInt8) ||
+          (custom_format == eFormatVectorOfUInt128) ||
+          (custom_format == eFormatVectorOfUInt16) ||
+          (custom_format == eFormatVectorOfUInt32) ||
+          (custom_format == eFormatVectorOfUInt64) ||
+          (custom_format == eFormatVectorOfUInt8))
+        return true;
     }
-    data.SetAddressByteSize(m_data.GetAddressByteSize());
-    data.SetByteOrder(m_data.GetByteOrder());
-    return data.GetByteSize();
+  }
+  return false;
 }
 
-bool
-ValueObject::SetData (DataExtractor &data, Error &error)
-{
-    error.Clear();
-    // Make sure our value is up to date first so that our location and location
-    // type is valid.
-    if (!UpdateValueIfNeeded(false))
-    {
-        error.SetErrorString("unable to read value");
+bool ValueObject::DumpPrintableRepresentation(
+    Stream &s, ValueObjectRepresentationStyle val_obj_display,
+    Format custom_format, PrintableRepresentationSpecialCases special,
+    bool do_dump_error) {
+
+  Flags flags(GetTypeInfo());
+
+  bool allow_special = ((special & ePrintableRepresentationSpecialCasesAllow) ==
+                        ePrintableRepresentationSpecialCasesAllow);
+  bool only_special = ((special & ePrintableRepresentationSpecialCasesOnly) ==
+                       ePrintableRepresentationSpecialCasesOnly);
+
+  if (allow_special) {
+    if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
+        val_obj_display == ValueObject::eValueObjectRepresentationStyleValue) {
+      // when being asked to get a printable display an array or pointer type
+      // directly,
+      // try to "do the right thing"
+
+      if (IsCStringContainer(true) &&
+          (custom_format == eFormatCString ||
+           custom_format == eFormatCharArray || custom_format == eFormatChar ||
+           custom_format ==
+               eFormatVectorOfChar)) // print char[] & char* directly
+      {
+        Error error;
+        lldb::DataBufferSP buffer_sp;
+        std::pair<size_t, bool> read_string = ReadPointedString(
+            buffer_sp, error, 0, (custom_format == eFormatVectorOfChar) ||
+                                     (custom_format == eFormatCharArray));
+        lldb_private::formatters::StringPrinter::
+            ReadBufferAndDumpToStreamOptions options(*this);
+        options.SetData(DataExtractor(
+            buffer_sp, lldb::eByteOrderInvalid,
+            8)); // none of this matters for a string - pass some defaults
+        options.SetStream(&s);
+        options.SetPrefixToken(0);
+        options.SetQuote('"');
+        options.SetSourceSize(buffer_sp->GetByteSize());
+        options.SetIsTruncated(read_string.second);
+        formatters::StringPrinter::ReadBufferAndDumpToStream<
+            lldb_private::formatters::StringPrinter::StringElementType::ASCII>(
+            options);
+        return !error.Fail();
+      }
+
+      if (custom_format == eFormatEnum)
+        return false;
+
+      // this only works for arrays, because I have no way to know when
+      // the pointed memory ends, and no special \0 end of data marker
+      if (flags.Test(eTypeIsArray)) {
+        if ((custom_format == eFormatBytes) ||
+            (custom_format == eFormatBytesWithASCII)) {
+          const size_t count = GetNumChildren();
+
+          s << '[';
+          for (size_t low = 0; low < count; low++) {
+
+            if (low)
+              s << ',';
+
+            ValueObjectSP child = GetChildAtIndex(low, true);
+            if (!child.get()) {
+              s << "<invalid child>";
+              continue;
+            }
+            child->DumpPrintableRepresentation(
+                s, ValueObject::eValueObjectRepresentationStyleValue,
+                custom_format);
+          }
+
+          s << ']';
+
+          return true;
+        }
+
+        if ((custom_format == eFormatVectorOfChar) ||
+            (custom_format == eFormatVectorOfFloat32) ||
+            (custom_format == eFormatVectorOfFloat64) ||
+            (custom_format == eFormatVectorOfSInt16) ||
+            (custom_format == eFormatVectorOfSInt32) ||
+            (custom_format == eFormatVectorOfSInt64) ||
+            (custom_format == eFormatVectorOfSInt8) ||
+            (custom_format == eFormatVectorOfUInt128) ||
+            (custom_format == eFormatVectorOfUInt16) ||
+            (custom_format == eFormatVectorOfUInt32) ||
+            (custom_format == eFormatVectorOfUInt64) ||
+            (custom_format == eFormatVectorOfUInt8)) // arrays of bytes, bytes
+                                                     // with ASCII or any vector
+                                                     // format should be printed
+                                                     // directly
+        {
+          const size_t count = GetNumChildren();
+
+          Format format = FormatManager::GetSingleItemFormat(custom_format);
+
+          s << '[';
+          for (size_t low = 0; low < count; low++) {
+
+            if (low)
+              s << ',';
+
+            ValueObjectSP child = GetChildAtIndex(low, true);
+            if (!child.get()) {
+              s << "<invalid child>";
+              continue;
+            }
+            child->DumpPrintableRepresentation(
+                s, ValueObject::eValueObjectRepresentationStyleValue, format);
+          }
+
+          s << ']';
+
+          return true;
+        }
+      }
+
+      if ((custom_format == eFormatBoolean) ||
+          (custom_format == eFormatBinary) || (custom_format == eFormatChar) ||
+          (custom_format == eFormatCharPrintable) ||
+          (custom_format == eFormatComplexFloat) ||
+          (custom_format == eFormatDecimal) || (custom_format == eFormatHex) ||
+          (custom_format == eFormatHexUppercase) ||
+          (custom_format == eFormatFloat) || (custom_format == eFormatOctal) ||
+          (custom_format == eFormatOSType) ||
+          (custom_format == eFormatUnicode16) ||
+          (custom_format == eFormatUnicode32) ||
+          (custom_format == eFormatUnsigned) ||
+          (custom_format == eFormatPointer) ||
+          (custom_format == eFormatComplexInteger) ||
+          (custom_format == eFormatComplex) ||
+          (custom_format == eFormatDefault)) // use the [] operator
         return false;
     }
-    
-    uint64_t count = 0;
-    const Encoding encoding = GetCompilerType().GetEncoding(count);
-    
-    const size_t byte_size = GetByteSize();
-    
-    Value::ValueType value_type = m_value.GetValueType();
-    
-    switch (value_type)
-    {
-    case Value::eValueTypeScalar:
-        {
-            Error set_error = m_value.GetScalar().SetValueFromData(data, encoding, byte_size);
-            
-            if (!set_error.Success())
-            {
-                error.SetErrorStringWithFormat("unable to set scalar value: %s", set_error.AsCString());
-                return false;
-            }
-        }
-        break;
-    case Value::eValueTypeLoadAddress:
-        {
-            // If it is a load address, then the scalar value is the storage location
-            // of the data, and we have to shove this value down to that load location.
-            ExecutionContext exe_ctx (GetExecutionContextRef());
-            Process *process = exe_ctx.GetProcessPtr();
-            if (process)
-            {
-                addr_t target_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-                size_t bytes_written = process->WriteMemory(target_addr,
-                                                            data.GetDataStart(),
-                                                            byte_size,
-                                                            error);
-                if (!error.Success())
-                    return false;
-                if (bytes_written != byte_size)
-                {
-                    error.SetErrorString("unable to write value to memory");
-                    return false;
-                }
-            }
-        }
-        break;
-    case Value::eValueTypeHostAddress:
-        {
-            // If it is a host address, then we stuff the scalar as a DataBuffer into the Value's data.            
-            DataBufferSP buffer_sp (new DataBufferHeap(byte_size, 0));
-            m_data.SetData(buffer_sp, 0);
-            data.CopyByteOrderedData (0,
-                                      byte_size,
-                                      const_cast<uint8_t *>(m_data.GetDataStart()),
-                                      byte_size,
-                                      m_data.GetByteOrder());
-            m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
-        }
-        break;
-    case Value::eValueTypeFileAddress:
-    case Value::eValueTypeVector:
-        break;
-    }
-    
-    // If we have reached this point, then we have successfully changed the value.
-    SetNeedsUpdate();
-    return true;
-}
+  }
 
-static bool
-CopyStringDataToBufferSP(const StreamString& source,
-                         lldb::DataBufferSP& destination)
-{
-    destination.reset(new DataBufferHeap(source.GetSize()+1,0));
-    memcpy(destination->GetBytes(), source.GetString().c_str(), source.GetSize());
-    return true;
-}
-
-std::pair<size_t,bool>
-ValueObject::ReadPointedString (lldb::DataBufferSP& buffer_sp,
-                                Error& error,
-                                uint32_t max_length,
-                                bool honor_array,
-                                Format item_format)
-{
-    bool was_capped = false;
-    StreamString s;
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    Target* target = exe_ctx.GetTargetPtr();
-    
-    if (!target)
-    {
-        s << "<no target to read from>";
-        error.SetErrorString("no target to read from");
-        CopyStringDataToBufferSP(s, buffer_sp);
-        return {0,was_capped};
-    }
-    
-    if (max_length == 0)
-        max_length = target->GetMaximumSizeOfStringSummary();
-    
-    size_t bytes_read = 0;
-    size_t total_bytes_read = 0;
-    
-    CompilerType compiler_type = GetCompilerType();
-    CompilerType elem_or_pointee_compiler_type;
-    const Flags type_flags (GetTypeInfo (&elem_or_pointee_compiler_type));
-    if (type_flags.AnySet (eTypeIsArray | eTypeIsPointer) &&
-        elem_or_pointee_compiler_type.IsCharType ())
-    {
-        addr_t cstr_address = LLDB_INVALID_ADDRESS;
-        AddressType cstr_address_type = eAddressTypeInvalid;
-        
-        size_t cstr_len = 0;
-        bool capped_data = false;
-        const bool is_array = type_flags.Test (eTypeIsArray);
-        if (is_array)
-        {
-            // We have an array
-            uint64_t array_size = 0;
-            if (compiler_type.IsArrayType(NULL, &array_size, NULL))
-            {
-                cstr_len = array_size;
-                if (cstr_len > max_length)
-                {
-                    capped_data = true;
-                    cstr_len = max_length;
-                }
-            }
-            cstr_address = GetAddressOf (true, &cstr_address_type);
-        }
-        else
-        {
-            // We have a pointer
-            cstr_address = GetPointerValue (&cstr_address_type);
-        }
-        
-        if (cstr_address == 0 || cstr_address == LLDB_INVALID_ADDRESS)
-        {
-            if (cstr_address_type == eAddressTypeHost && is_array)
-            {
-                const char* cstr = GetDataExtractor().PeekCStr(0);
-                if (cstr == nullptr)
-                {
-                    s << "<invalid address>";
-                    error.SetErrorString("invalid address");
-                    CopyStringDataToBufferSP(s, buffer_sp);
-                    return {0,was_capped};
-                }
-                buffer_sp.reset(new DataBufferHeap(cstr_len, 0));
-                memcpy(buffer_sp->GetBytes(), cstr, cstr_len);
-                return {cstr_len,was_capped};
-            }
-            else
-            {
-                s << "<invalid address>";
-                error.SetErrorString("invalid address");
-                CopyStringDataToBufferSP(s, buffer_sp);
-                return {0,was_capped};
-            }
-        }
-        
-        Address cstr_so_addr (cstr_address);
-        DataExtractor data;
-        if (cstr_len > 0 && honor_array)
-        {
-            // I am using GetPointeeData() here to abstract the fact that some ValueObjects are actually frozen pointers in the host
-            // but the pointed-to data lives in the debuggee, and GetPointeeData() automatically takes care of this
-            GetPointeeData(data, 0, cstr_len);
-            
-            if ((bytes_read = data.GetByteSize()) > 0)
-            {
-                total_bytes_read = bytes_read;
-                for (size_t offset = 0; offset < bytes_read; offset++)
-                    s.Printf("%c", *data.PeekData(offset, 1));
-                if (capped_data)
-                    was_capped = true;
-            }
-        }
-        else
-        {
-            cstr_len = max_length;
-            const size_t k_max_buf_size = 64;
-            
-            size_t offset = 0;
-            
-            int cstr_len_displayed = -1;
-            bool capped_cstr = false;
-            // I am using GetPointeeData() here to abstract the fact that some ValueObjects are actually frozen pointers in the host
-            // but the pointed-to data lives in the debuggee, and GetPointeeData() automatically takes care of this
-            while ((bytes_read = GetPointeeData(data, offset, k_max_buf_size)) > 0)
-            {
-                total_bytes_read += bytes_read;
-                const char *cstr = data.PeekCStr(0);
-                size_t len = strnlen (cstr, k_max_buf_size);
-                if (cstr_len_displayed < 0)
-                    cstr_len_displayed = len;
-                
-                if (len == 0)
-                    break;
-                cstr_len_displayed += len;
-                if (len > bytes_read)
-                    len = bytes_read;
-                if (len > cstr_len)
-                    len = cstr_len;
-                
-                for (size_t offset = 0; offset < bytes_read; offset++)
-                    s.Printf("%c", *data.PeekData(offset, 1));
-                
-                if (len < k_max_buf_size)
-                    break;
-                
-                if (len >= cstr_len)
-                {
-                    capped_cstr = true;
-                    break;
-                }
-                
-                cstr_len -= len;
-                offset += len;
-            }
-            
-            if (cstr_len_displayed >= 0)
-            {
-                if (capped_cstr)
-                    was_capped = true;
-            }
-        }
-    }
-    else
-    {
-        error.SetErrorString("not a string object");
-        s << "<not a string object>";
-    }
-    CopyStringDataToBufferSP(s, buffer_sp);
-    return {total_bytes_read,was_capped};
-}
-
-std::pair<TypeValidatorResult, std::string>
-ValueObject::GetValidationStatus ()
-{
-    if (!UpdateValueIfNeeded(true))
-        return {TypeValidatorResult::Success,""}; // not the validator's job to discuss update problems
-    
-    if (m_validation_result.hasValue())
-        return m_validation_result.getValue();
-    
-    if (!m_type_validator_sp)
-        return {TypeValidatorResult::Success,""}; // no validator no failure
-    
-    auto outcome = m_type_validator_sp->FormatObject(this);
-    
-    return (m_validation_result = {outcome.m_result,outcome.m_message}).getValue();
-}
-
-const char *
-ValueObject::GetObjectDescription ()
-{
-    
-    if (!UpdateValueIfNeeded (true))
-        return NULL;
-
-    if (!m_object_desc_str.empty())
-        return m_object_desc_str.c_str();
-
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    Process *process = exe_ctx.GetProcessPtr();
-    if (process == NULL)
-        return NULL;
-        
-    StreamString s;
-    
-    LanguageType language = GetObjectRuntimeLanguage();
-    LanguageRuntime *runtime = process->GetLanguageRuntime(language);
-    
-    if (runtime == NULL)
-    {
-        // Aw, hell, if the things a pointer, or even just an integer, let's try ObjC anyway...
-        CompilerType compiler_type = GetCompilerType();
-        if (compiler_type)
-        {
-            bool is_signed;
-            if (compiler_type.IsIntegerType (is_signed) || compiler_type.IsPointerType ())
-            {
-                runtime = process->GetLanguageRuntime(eLanguageTypeObjC);
-            }
-        }
-    }
-    
-    if (runtime && runtime->GetObjectDescription(s, *this))
-    {
-        m_object_desc_str.append (s.GetData());
-    }
-    
-    if (m_object_desc_str.empty())
-        return NULL;
-    else
-        return m_object_desc_str.c_str();
-}
-
-bool
-ValueObject::GetValueAsCString (const lldb_private::TypeFormatImpl& format,
-                                std::string& destination)
-{
-    if (UpdateValueIfNeeded(false))
-        return format.FormatObject(this,destination);
-    else
-        return false;
-}
-
-bool
-ValueObject::GetValueAsCString (lldb::Format format,
-                                std::string& destination)
-{
-    return GetValueAsCString(TypeFormatImpl_Format(format),destination);
-}
-
-const char *
-ValueObject::GetValueAsCString ()
-{
-    if (UpdateValueIfNeeded(true))
-    {
-        lldb::TypeFormatImplSP format_sp;
-        lldb::Format my_format = GetFormat();
-        if (my_format == lldb::eFormatDefault)
-        {
-            if (m_type_format_sp)
-                format_sp = m_type_format_sp;
-            else
-            {
-                if (m_is_bitfield_for_scalar)
-                    my_format = eFormatUnsigned;
-                else
-                {
-                    if (m_value.GetContextType() == Value::eContextTypeRegisterInfo)
-                    {
-                        const RegisterInfo *reg_info = m_value.GetRegisterInfo();
-                        if (reg_info)
-                            my_format = reg_info->format;
-                    }
-                    else
-                    {
-                        my_format = GetValue().GetCompilerType().GetFormat();
-                    }
-                }
-            }
-        }
-        if (my_format != m_last_format || m_value_str.empty())
-        {
-            m_last_format = my_format;
-            if (!format_sp)
-                format_sp.reset(new TypeFormatImpl_Format(my_format));
-            if (GetValueAsCString(*format_sp.get(), m_value_str))
-            {
-                if (!m_value_did_change && m_old_value_valid)
-                {
-                    // The value was gotten successfully, so we consider the
-                    // value as changed if the value string differs
-                    SetValueDidChange (m_old_value_str != m_value_str);
-                }
-            }
-        }
-    }
-    if (m_value_str.empty())
-        return NULL;
-    return m_value_str.c_str();
-}
-
-// if > 8bytes, 0 is returned. this method should mostly be used
-// to read address values out of pointers
-uint64_t
-ValueObject::GetValueAsUnsigned (uint64_t fail_value, bool *success)
-{
-    // If our byte size is zero this is an aggregate type that has children
-    if (CanProvideValue())
-    {
-        Scalar scalar;
-        if (ResolveValue (scalar))
-        {
-            if (success)
-                *success = true;
-            return scalar.ULongLong(fail_value);
-        }
-        // fallthrough, otherwise...
-    }
+  if (only_special)
+    return false;
 
-    if (success)
-        *success = false;
-    return fail_value;
-}
+  bool var_success = false;
 
-int64_t
-ValueObject::GetValueAsSigned (int64_t fail_value, bool *success)
-{
-    // If our byte size is zero this is an aggregate type that has children
-    if (CanProvideValue())
-    {
-        Scalar scalar;
-        if (ResolveValue (scalar))
-        {
-            if (success)
-                *success = true;
-            return scalar.SLongLong(fail_value);
-        }
-        // fallthrough, otherwise...
-    }
-    
-    if (success)
-        *success = false;
-    return fail_value;
-}
+  {
+    const char *cstr = NULL;
 
-// if any more "special cases" are added to ValueObject::DumpPrintableRepresentation() please keep
-// this call up to date by returning true for your new special cases. We will eventually move
-// to checking this call result before trying to display special cases
-bool
-ValueObject::HasSpecialPrintableRepresentation(ValueObjectRepresentationStyle val_obj_display,
-                                               Format custom_format)
-{
-    Flags flags(GetTypeInfo());
-    if (flags.AnySet(eTypeIsArray | eTypeIsPointer)
-        && val_obj_display == ValueObject::eValueObjectRepresentationStyleValue)
-    {        
-        if (IsCStringContainer(true) && 
-            (custom_format == eFormatCString ||
-             custom_format == eFormatCharArray ||
-             custom_format == eFormatChar ||
-             custom_format == eFormatVectorOfChar))
-            return true;
+    // this is a local stream that we are using to ensure that the data pointed
+    // to by cstr survives
+    // long enough for us to copy it to its destination - it is necessary to
+    // have this temporary storage
+    // area for cases where our desired output is not backed by some other
+    // longer-term storage
+    StreamString strm;
+
+    if (custom_format != eFormatInvalid)
+      SetFormat(custom_format);
+
+    switch (val_obj_display) {
+    case eValueObjectRepresentationStyleValue:
+      cstr = GetValueAsCString();
+      break;
+
+    case eValueObjectRepresentationStyleSummary:
+      cstr = GetSummaryAsCString();
+      break;
+
+    case eValueObjectRepresentationStyleLanguageSpecific:
+      cstr = GetObjectDescription();
+      break;
+
+    case eValueObjectRepresentationStyleLocation:
+      cstr = GetLocationAsCString();
+      break;
+
+    case eValueObjectRepresentationStyleChildrenCount:
+      strm.Printf("%" PRIu64 "", (uint64_t)GetNumChildren());
+      cstr = strm.GetString().c_str();
+      break;
+
+    case eValueObjectRepresentationStyleType:
+      cstr = GetTypeName().AsCString();
+      break;
+
+    case eValueObjectRepresentationStyleName:
+      cstr = GetName().AsCString();
+      break;
+
+    case eValueObjectRepresentationStyleExpressionPath:
+      GetExpressionPath(strm, false);
+      cstr = strm.GetString().c_str();
+      break;
+    }
+
+    if (!cstr) {
+      if (val_obj_display == eValueObjectRepresentationStyleValue)
+        cstr = GetSummaryAsCString();
+      else if (val_obj_display == eValueObjectRepresentationStyleSummary) {
+        if (!CanProvideValue()) {
+          strm.Printf("%s @ %s", GetTypeName().AsCString(),
+                      GetLocationAsCString());
+          cstr = strm.GetString().c_str();
+        } else
+          cstr = GetValueAsCString();
+      }
+    }
+
+    if (cstr)
+      s.PutCString(cstr);
+    else {
+      if (m_error.Fail()) {
+        if (do_dump_error)
+          s.Printf("<%s>", m_error.AsCString());
+        else
+          return false;
+      } else if (val_obj_display == eValueObjectRepresentationStyleSummary)
+        s.PutCString("<no summary available>");
+      else if (val_obj_display == eValueObjectRepresentationStyleValue)
+        s.PutCString("<no value available>");
+      else if (val_obj_display ==
+               eValueObjectRepresentationStyleLanguageSpecific)
+        s.PutCString("<not a valid Objective-C object>"); // edit this if we
+                                                          // have other runtimes
+                                                          // that support a
+                                                          // description
+      else
+        s.PutCString("<no printable representation>");
+    }
+
+    // we should only return false here if we could not do *anything*
+    // even if we have an error message as output, that's a success
+    // from our callers' perspective, so return true
+    var_success = true;
+
+    if (custom_format != eFormatInvalid)
+      SetFormat(eFormatDefault);
+  }
+
+  return var_success;
+}
+
+addr_t ValueObject::GetAddressOf(bool scalar_is_load_address,
+                                 AddressType *address_type) {
+  // Can't take address of a bitfield
+  if (IsBitfield())
+    return LLDB_INVALID_ADDRESS;
 
-        if (flags.Test(eTypeIsArray))
-        {
-            if ((custom_format == eFormatBytes) ||
-                (custom_format == eFormatBytesWithASCII))
-                return true;
-            
-            if ((custom_format == eFormatVectorOfChar) ||
-                (custom_format == eFormatVectorOfFloat32) ||
-                (custom_format == eFormatVectorOfFloat64) ||
-                (custom_format == eFormatVectorOfSInt16) ||
-                (custom_format == eFormatVectorOfSInt32) ||
-                (custom_format == eFormatVectorOfSInt64) ||
-                (custom_format == eFormatVectorOfSInt8) ||
-                (custom_format == eFormatVectorOfUInt128) ||
-                (custom_format == eFormatVectorOfUInt16) ||
-                (custom_format == eFormatVectorOfUInt32) ||
-                (custom_format == eFormatVectorOfUInt64) ||
-                (custom_format == eFormatVectorOfUInt8))
-                return true;
-        }
-    }
-    return false;
-}
+  if (!UpdateValueIfNeeded(false))
+    return LLDB_INVALID_ADDRESS;
 
-bool
-ValueObject::DumpPrintableRepresentation(Stream& s,
-                                         ValueObjectRepresentationStyle val_obj_display,
-                                         Format custom_format,
-                                         PrintableRepresentationSpecialCases special,
-                                         bool do_dump_error)
-{
-
-    Flags flags(GetTypeInfo());
-    
-    bool allow_special = ((special & ePrintableRepresentationSpecialCasesAllow) == ePrintableRepresentationSpecialCasesAllow);
-    bool only_special = ((special & ePrintableRepresentationSpecialCasesOnly) == ePrintableRepresentationSpecialCasesOnly);
-    
-    if (allow_special)
-    {
-        if (flags.AnySet(eTypeIsArray | eTypeIsPointer)
-             && val_obj_display == ValueObject::eValueObjectRepresentationStyleValue)
-        {
-            // when being asked to get a printable display an array or pointer type directly, 
-            // try to "do the right thing"
-            
-            if (IsCStringContainer(true) && 
-                (custom_format == eFormatCString ||
-                 custom_format == eFormatCharArray ||
-                 custom_format == eFormatChar ||
-                 custom_format == eFormatVectorOfChar)) // print char[] & char* directly
-            {
-                Error error;
-                lldb::DataBufferSP buffer_sp;
-                std::pair<size_t, bool> read_string = ReadPointedString(buffer_sp,
-                                                                        error,
-                                                                        0,
-                                                                        (custom_format == eFormatVectorOfChar) ||
-                                                                        (custom_format == eFormatCharArray));
-                lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStreamOptions options(*this);
-                options.SetData(DataExtractor(buffer_sp, lldb::eByteOrderInvalid, 8)); // none of this matters for a string - pass some defaults
-                options.SetStream(&s);
-                options.SetPrefixToken(0);
-                options.SetQuote('"');
-                options.SetSourceSize(buffer_sp->GetByteSize());
-                options.SetIsTruncated(read_string.second);
-                formatters::StringPrinter::ReadBufferAndDumpToStream<lldb_private::formatters::StringPrinter::StringElementType::ASCII>(options);
-                return !error.Fail();
-            }
-            
-            if (custom_format == eFormatEnum)
-                return false;
-            
-            // this only works for arrays, because I have no way to know when
-            // the pointed memory ends, and no special \0 end of data marker
-            if (flags.Test(eTypeIsArray))
-            {
-                if ((custom_format == eFormatBytes) ||
-                    (custom_format == eFormatBytesWithASCII))
-                {
-                    const size_t count = GetNumChildren();
-                                    
-                    s << '[';
-                    for (size_t low = 0; low < count; low++)
-                    {
-                        
-                        if (low)
-                            s << ',';
-                        
-                        ValueObjectSP child = GetChildAtIndex(low,true);
-                        if (!child.get())
-                        {
-                            s << "<invalid child>";
-                            continue;
-                        }
-                        child->DumpPrintableRepresentation(s, ValueObject::eValueObjectRepresentationStyleValue, custom_format);
-                    }                
-                    
-                    s << ']';
-                    
-                    return true;
-                }
-                
-                if ((custom_format == eFormatVectorOfChar) ||
-                    (custom_format == eFormatVectorOfFloat32) ||
-                    (custom_format == eFormatVectorOfFloat64) ||
-                    (custom_format == eFormatVectorOfSInt16) ||
-                    (custom_format == eFormatVectorOfSInt32) ||
-                    (custom_format == eFormatVectorOfSInt64) ||
-                    (custom_format == eFormatVectorOfSInt8) ||
-                    (custom_format == eFormatVectorOfUInt128) ||
-                    (custom_format == eFormatVectorOfUInt16) ||
-                    (custom_format == eFormatVectorOfUInt32) ||
-                    (custom_format == eFormatVectorOfUInt64) ||
-                    (custom_format == eFormatVectorOfUInt8)) // arrays of bytes, bytes with ASCII or any vector format should be printed directly
-                {
-                    const size_t count = GetNumChildren();
-
-                    Format format = FormatManager::GetSingleItemFormat(custom_format);
-                    
-                    s << '[';
-                    for (size_t low = 0; low < count; low++)
-                    {
-                        
-                        if (low)
-                            s << ',';
-                        
-                        ValueObjectSP child = GetChildAtIndex(low,true);
-                        if (!child.get())
-                        {
-                            s << "<invalid child>";
-                            continue;
-                        }
-                        child->DumpPrintableRepresentation(s, ValueObject::eValueObjectRepresentationStyleValue, format);
-                    }                
-                    
-                    s << ']';
-                    
-                    return true;
-                }
-            }
-            
-            if ((custom_format == eFormatBoolean) ||
-                (custom_format == eFormatBinary) ||
-                (custom_format == eFormatChar) ||
-                (custom_format == eFormatCharPrintable) ||
-                (custom_format == eFormatComplexFloat) ||
-                (custom_format == eFormatDecimal) ||
-                (custom_format == eFormatHex) ||
-                (custom_format == eFormatHexUppercase) ||
-                (custom_format == eFormatFloat) ||
-                (custom_format == eFormatOctal) ||
-                (custom_format == eFormatOSType) ||
-                (custom_format == eFormatUnicode16) ||
-                (custom_format == eFormatUnicode32) ||
-                (custom_format == eFormatUnsigned) ||
-                (custom_format == eFormatPointer) ||
-                (custom_format == eFormatComplexInteger) ||
-                (custom_format == eFormatComplex) ||
-                (custom_format == eFormatDefault)) // use the [] operator
-                return false;
-        }
+  switch (m_value.GetValueType()) {
+  case Value::eValueTypeScalar:
+  case Value::eValueTypeVector:
+    if (scalar_is_load_address) {
+      if (address_type)
+        *address_type = eAddressTypeLoad;
+      return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
     }
-    
-    if (only_special)
-        return false;
-    
-    bool var_success = false;
-    
-    {
-        const char *cstr = NULL;
-        
-         // this is a local stream that we are using to ensure that the data pointed to by cstr survives
-        // long enough for us to copy it to its destination - it is necessary to have this temporary storage
-        // area for cases where our desired output is not backed by some other longer-term storage
-        StreamString strm;
-
-        if (custom_format != eFormatInvalid)
-            SetFormat(custom_format);
-        
-        switch(val_obj_display)
-        {
-            case eValueObjectRepresentationStyleValue:
-                cstr = GetValueAsCString();
-                break;
-                
-            case eValueObjectRepresentationStyleSummary:
-                cstr = GetSummaryAsCString();
-                break;
-                
-            case eValueObjectRepresentationStyleLanguageSpecific:
-                cstr = GetObjectDescription();
-                break;
-                
-            case eValueObjectRepresentationStyleLocation:
-                cstr = GetLocationAsCString();
-                break;
-                
-            case eValueObjectRepresentationStyleChildrenCount:
-                strm.Printf("%" PRIu64 "", (uint64_t)GetNumChildren());
-                cstr = strm.GetString().c_str();
-                break;
-                
-            case eValueObjectRepresentationStyleType:
-                cstr = GetTypeName().AsCString();
-                break;
-                
-            case eValueObjectRepresentationStyleName:
-                cstr = GetName().AsCString();
-                break;
-                
-            case eValueObjectRepresentationStyleExpressionPath:
-                GetExpressionPath(strm, false);
-                cstr = strm.GetString().c_str();
-                break;
-        }
-        
-        if (!cstr)
-        {
-            if (val_obj_display == eValueObjectRepresentationStyleValue)
-                cstr = GetSummaryAsCString();
-            else if (val_obj_display == eValueObjectRepresentationStyleSummary)
-            {
-                if (!CanProvideValue())
-                {
-                    strm.Printf("%s @ %s", GetTypeName().AsCString(), GetLocationAsCString());
-                    cstr = strm.GetString().c_str();
-                }
-                else
-                    cstr = GetValueAsCString();
-            }
-        }
-        
-        if (cstr)
-            s.PutCString(cstr);
-        else
-        {
-            if (m_error.Fail())
-            {
-                if (do_dump_error)
-                    s.Printf("<%s>", m_error.AsCString());
-                else
-                    return false;
-            }
-            else if (val_obj_display == eValueObjectRepresentationStyleSummary)
-                s.PutCString("<no summary available>");
-            else if (val_obj_display == eValueObjectRepresentationStyleValue)
-                s.PutCString("<no value available>");
-            else if (val_obj_display == eValueObjectRepresentationStyleLanguageSpecific)
-                s.PutCString("<not a valid Objective-C object>"); // edit this if we have other runtimes that support a description
-            else
-                s.PutCString("<no printable representation>");
-        }
-        
-        // we should only return false here if we could not do *anything*
-        // even if we have an error message as output, that's a success
-        // from our callers' perspective, so return true
-        var_success = true;
-        
-        if (custom_format != eFormatInvalid)
-            SetFormat(eFormatDefault);
-    }
-    
-    return var_success;
-}
-
-addr_t
-ValueObject::GetAddressOf (bool scalar_is_load_address, AddressType *address_type)
-{
-    // Can't take address of a bitfield
-    if (IsBitfield())
-        return LLDB_INVALID_ADDRESS;
-
-    if (!UpdateValueIfNeeded(false))
-        return LLDB_INVALID_ADDRESS;
-        
-    switch (m_value.GetValueType())
-    {
-    case Value::eValueTypeScalar:
-    case Value::eValueTypeVector:
-        if (scalar_is_load_address)
-        {
-            if(address_type)
-                *address_type = eAddressTypeLoad;
-            return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-        }
-        break;
+    break;
 
-    case Value::eValueTypeLoadAddress: 
-    case Value::eValueTypeFileAddress:
-        {
-            if(address_type)
-                *address_type = m_value.GetValueAddressType ();
-            return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-        }
-        break;
-    case Value::eValueTypeHostAddress:
-        {
-            if(address_type)
-                *address_type = m_value.GetValueAddressType ();
-            return LLDB_INVALID_ADDRESS;
-        }
-        break;
-    }
+  case Value::eValueTypeLoadAddress:
+  case Value::eValueTypeFileAddress: {
     if (address_type)
-        *address_type = eAddressTypeInvalid;
+      *address_type = m_value.GetValueAddressType();
+    return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+  } break;
+  case Value::eValueTypeHostAddress: {
+    if (address_type)
+      *address_type = m_value.GetValueAddressType();
     return LLDB_INVALID_ADDRESS;
+  } break;
+  }
+  if (address_type)
+    *address_type = eAddressTypeInvalid;
+  return LLDB_INVALID_ADDRESS;
 }
 
-addr_t
-ValueObject::GetPointerValue (AddressType *address_type)
-{
-    addr_t address = LLDB_INVALID_ADDRESS;
-    if(address_type)
-        *address_type = eAddressTypeInvalid;
-    
-    if (!UpdateValueIfNeeded(false))
-        return address;
-        
-    switch (m_value.GetValueType())
-    {
-    case Value::eValueTypeScalar:
-    case Value::eValueTypeVector:
-        address = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-        break;
-
-    case Value::eValueTypeHostAddress:
-    case Value::eValueTypeLoadAddress:
-    case Value::eValueTypeFileAddress:
-        {
-            lldb::offset_t data_offset = 0;
-            address = m_data.GetPointer(&data_offset);
-        }
-        break;
-    }
-
-    if (address_type)
-        *address_type = GetAddressTypeOfChildren();
+addr_t ValueObject::GetPointerValue(AddressType *address_type) {
+  addr_t address = LLDB_INVALID_ADDRESS;
+  if (address_type)
+    *address_type = eAddressTypeInvalid;
 
+  if (!UpdateValueIfNeeded(false))
     return address;
-}
 
-bool
-ValueObject::SetValueFromCString (const char *value_str, Error& error)
-{
-    error.Clear();
-    // Make sure our value is up to date first so that our location and location
-    // type is valid.
-    if (!UpdateValueIfNeeded(false))
-    {
-        error.SetErrorString("unable to read value");
-        return false;
-    }
+  switch (m_value.GetValueType()) {
+  case Value::eValueTypeScalar:
+  case Value::eValueTypeVector:
+    address = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+    break;
+
+  case Value::eValueTypeHostAddress:
+  case Value::eValueTypeLoadAddress:
+  case Value::eValueTypeFileAddress: {
+    lldb::offset_t data_offset = 0;
+    address = m_data.GetPointer(&data_offset);
+  } break;
+  }
+
+  if (address_type)
+    *address_type = GetAddressTypeOfChildren();
+
+  return address;
+}
+
+bool ValueObject::SetValueFromCString(const char *value_str, Error &error) {
+  error.Clear();
+  // Make sure our value is up to date first so that our location and location
+  // type is valid.
+  if (!UpdateValueIfNeeded(false)) {
+    error.SetErrorString("unable to read value");
+    return false;
+  }
 
-    uint64_t count = 0;
-    const Encoding encoding = GetCompilerType().GetEncoding (count);
+  uint64_t count = 0;
+  const Encoding encoding = GetCompilerType().GetEncoding(count);
 
-    const size_t byte_size = GetByteSize();
+  const size_t byte_size = GetByteSize();
 
-    Value::ValueType value_type = m_value.GetValueType();
-    
-    if (value_type == Value::eValueTypeScalar)
-    {
-        // If the value is already a scalar, then let the scalar change itself:
-        m_value.GetScalar().SetValueFromCString (value_str, encoding, byte_size);
-    }
-    else if (byte_size <= 16)
-    {
-        // If the value fits in a scalar, then make a new scalar and again let the
-        // scalar code do the conversion, then figure out where to put the new value.
-        Scalar new_scalar;
-        error = new_scalar.SetValueFromCString (value_str, encoding, byte_size);
-        if (error.Success())
-        {
-            switch (value_type)
-            {
-            case Value::eValueTypeLoadAddress:
-                {
-                    // If it is a load address, then the scalar value is the storage location
-                    // of the data, and we have to shove this value down to that load location.
-                    ExecutionContext exe_ctx (GetExecutionContextRef());
-                    Process *process = exe_ctx.GetProcessPtr();
-                    if (process)
-                    {
-                        addr_t target_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-                        size_t bytes_written = process->WriteScalarToMemory (target_addr, 
-                                                                             new_scalar, 
-                                                                             byte_size, 
-                                                                             error);
-                        if (!error.Success())
-                            return false;
-                        if (bytes_written != byte_size)
-                        {
-                            error.SetErrorString("unable to write value to memory");
-                            return false;
-                        }
-                    }
-                }
-                break;
-            case Value::eValueTypeHostAddress:
-                {
-                    // If it is a host address, then we stuff the scalar as a DataBuffer into the Value's data.
-                    DataExtractor new_data;
-                    new_data.SetByteOrder (m_data.GetByteOrder());
-                    
-                    DataBufferSP buffer_sp (new DataBufferHeap(byte_size, 0));
-                    m_data.SetData(buffer_sp, 0);
-                    bool success = new_scalar.GetData(new_data);
-                    if (success)
-                    {
-                        new_data.CopyByteOrderedData (0, 
-                                                      byte_size, 
-                                                      const_cast<uint8_t *>(m_data.GetDataStart()), 
-                                                      byte_size, 
-                                                      m_data.GetByteOrder());
-                    }
-                    m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
-                    
-                }
-                break;
-            case Value::eValueTypeFileAddress:
-            case Value::eValueTypeScalar:
-            case Value::eValueTypeVector:
-                break;
-            }
-        }
-        else
-        {
+  Value::ValueType value_type = m_value.GetValueType();
+
+  if (value_type == Value::eValueTypeScalar) {
+    // If the value is already a scalar, then let the scalar change itself:
+    m_value.GetScalar().SetValueFromCString(value_str, encoding, byte_size);
+  } else if (byte_size <= 16) {
+    // If the value fits in a scalar, then make a new scalar and again let the
+    // scalar code do the conversion, then figure out where to put the new
+    // value.
+    Scalar new_scalar;
+    error = new_scalar.SetValueFromCString(value_str, encoding, byte_size);
+    if (error.Success()) {
+      switch (value_type) {
+      case Value::eValueTypeLoadAddress: {
+        // If it is a load address, then the scalar value is the storage
+        // location
+        // of the data, and we have to shove this value down to that load
+        // location.
+        ExecutionContext exe_ctx(GetExecutionContextRef());
+        Process *process = exe_ctx.GetProcessPtr();
+        if (process) {
+          addr_t target_addr =
+              m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+          size_t bytes_written = process->WriteScalarToMemory(
+              target_addr, new_scalar, byte_size, error);
+          if (!error.Success())
             return false;
+          if (bytes_written != byte_size) {
+            error.SetErrorString("unable to write value to memory");
+            return false;
+          }
         }
-    }
-    else
-    {
-        // We don't support setting things bigger than a scalar at present.
-        error.SetErrorString("unable to write aggregate data type");
-        return false;
-    }
-    
-    // If we have reached this point, then we have successfully changed the value.
-    SetNeedsUpdate();
-    return true;
-}
-
-bool
-ValueObject::GetDeclaration (Declaration &decl)
-{
-    decl.Clear();
+      } break;
+      case Value::eValueTypeHostAddress: {
+        // If it is a host address, then we stuff the scalar as a DataBuffer
+        // into the Value's data.
+        DataExtractor new_data;
+        new_data.SetByteOrder(m_data.GetByteOrder());
+
+        DataBufferSP buffer_sp(new DataBufferHeap(byte_size, 0));
+        m_data.SetData(buffer_sp, 0);
+        bool success = new_scalar.GetData(new_data);
+        if (success) {
+          new_data.CopyByteOrderedData(
+              0, byte_size, const_cast<uint8_t *>(m_data.GetDataStart()),
+              byte_size, m_data.GetByteOrder());
+        }
+        m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
+
+      } break;
+      case Value::eValueTypeFileAddress:
+      case Value::eValueTypeScalar:
+      case Value::eValueTypeVector:
+        break;
+      }
+    } else {
+      return false;
+    }
+  } else {
+    // We don't support setting things bigger than a scalar at present.
+    error.SetErrorString("unable to write aggregate data type");
     return false;
-}
+  }
 
-ConstString
-ValueObject::GetTypeName()
-{
-    return GetCompilerType().GetConstTypeName();
+  // If we have reached this point, then we have successfully changed the value.
+  SetNeedsUpdate();
+  return true;
 }
 
-ConstString
-ValueObject::GetDisplayTypeName()
-{
-    return GetTypeName();
+bool ValueObject::GetDeclaration(Declaration &decl) {
+  decl.Clear();
+  return false;
 }
 
-ConstString
-ValueObject::GetQualifiedTypeName()
-{
-    return GetCompilerType().GetConstQualifiedTypeName();
+ConstString ValueObject::GetTypeName() {
+  return GetCompilerType().GetConstTypeName();
 }
 
+ConstString ValueObject::GetDisplayTypeName() { return GetTypeName(); }
 
-LanguageType
-ValueObject::GetObjectRuntimeLanguage ()
-{
-    return GetCompilerType().GetMinimumLanguage ();
+ConstString ValueObject::GetQualifiedTypeName() {
+  return GetCompilerType().GetConstQualifiedTypeName();
 }
 
-void
-ValueObject::AddSyntheticChild (const ConstString &key, ValueObject *valobj)
-{
-    m_synthetic_children[key] = valobj;
+LanguageType ValueObject::GetObjectRuntimeLanguage() {
+  return GetCompilerType().GetMinimumLanguage();
 }
 
-ValueObjectSP
-ValueObject::GetSyntheticChild (const ConstString &key) const
-{
-    ValueObjectSP synthetic_child_sp;
-    std::map<ConstString, ValueObject *>::const_iterator pos = m_synthetic_children.find (key);
-    if (pos != m_synthetic_children.end())
-        synthetic_child_sp = pos->second->GetSP();
-    return synthetic_child_sp;
+void ValueObject::AddSyntheticChild(const ConstString &key,
+                                    ValueObject *valobj) {
+  m_synthetic_children[key] = valobj;
 }
 
-uint32_t
-ValueObject::GetTypeInfo (CompilerType *pointee_or_element_compiler_type)
-{
-    return GetCompilerType().GetTypeInfo (pointee_or_element_compiler_type);
+ValueObjectSP ValueObject::GetSyntheticChild(const ConstString &key) const {
+  ValueObjectSP synthetic_child_sp;
+  std::map<ConstString, ValueObject *>::const_iterator pos =
+      m_synthetic_children.find(key);
+  if (pos != m_synthetic_children.end())
+    synthetic_child_sp = pos->second->GetSP();
+  return synthetic_child_sp;
 }
 
-bool
-ValueObject::IsPointerType ()
-{
-    return GetCompilerType().IsPointerType();
+uint32_t
+ValueObject::GetTypeInfo(CompilerType *pointee_or_element_compiler_type) {
+  return GetCompilerType().GetTypeInfo(pointee_or_element_compiler_type);
 }
 
-bool
-ValueObject::IsArrayType ()
-{
-    return GetCompilerType().IsArrayType (NULL, NULL, NULL);
-}
+bool ValueObject::IsPointerType() { return GetCompilerType().IsPointerType(); }
 
-bool
-ValueObject::IsScalarType ()
-{
-    return GetCompilerType().IsScalarType ();
+bool ValueObject::IsArrayType() {
+  return GetCompilerType().IsArrayType(NULL, NULL, NULL);
 }
 
-bool
-ValueObject::IsIntegerType (bool &is_signed)
-{
-    return GetCompilerType().IsIntegerType (is_signed);
+bool ValueObject::IsScalarType() { return GetCompilerType().IsScalarType(); }
+
+bool ValueObject::IsIntegerType(bool &is_signed) {
+  return GetCompilerType().IsIntegerType(is_signed);
 }
 
-bool
-ValueObject::IsPointerOrReferenceType ()
-{
-    return GetCompilerType().IsPointerOrReferenceType ();
+bool ValueObject::IsPointerOrReferenceType() {
+  return GetCompilerType().IsPointerOrReferenceType();
 }
 
-bool
-ValueObject::IsPossibleDynamicType ()
-{
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    Process *process = exe_ctx.GetProcessPtr();
-    if (process)
-        return process->IsPossibleDynamicValue(*this);
-    else
-        return GetCompilerType().IsPossibleDynamicType (NULL, true, true);
+bool ValueObject::IsPossibleDynamicType() {
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  Process *process = exe_ctx.GetProcessPtr();
+  if (process)
+    return process->IsPossibleDynamicValue(*this);
+  else
+    return GetCompilerType().IsPossibleDynamicType(NULL, true, true);
 }
 
-bool
-ValueObject::IsRuntimeSupportValue ()
-{
-    Process *process(GetProcessSP().get());
-    if (process)
-    {
-        LanguageRuntime *runtime = process->GetLanguageRuntime(GetObjectRuntimeLanguage());
-        if (!runtime)
-            runtime = process->GetObjCLanguageRuntime();
-        if (runtime)
-            return runtime->IsRuntimeSupportValue(*this);
-    }
-    return false;
+bool ValueObject::IsRuntimeSupportValue() {
+  Process *process(GetProcessSP().get());
+  if (process) {
+    LanguageRuntime *runtime =
+        process->GetLanguageRuntime(GetObjectRuntimeLanguage());
+    if (!runtime)
+      runtime = process->GetObjCLanguageRuntime();
+    if (runtime)
+      return runtime->IsRuntimeSupportValue(*this);
+  }
+  return false;
 }
 
-bool
-ValueObject::IsNilReference ()
-{
-    if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage()))
-    {
-        return language->IsNilReference(*this);
-    }
-    return false;
+bool ValueObject::IsNilReference() {
+  if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage())) {
+    return language->IsNilReference(*this);
+  }
+  return false;
 }
 
-bool
-ValueObject::IsUninitializedReference ()
-{
-    if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage()))
-    {
-        return language->IsUninitializedReference(*this);
-    }
-    return false;
+bool ValueObject::IsUninitializedReference() {
+  if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage())) {
+    return language->IsUninitializedReference(*this);
+  }
+  return false;
 }
 
 // This allows you to create an array member using and index
@@ -2122,2243 +1759,2047 @@ ValueObject::IsUninitializedReference ()
 // The size of the "item_array" is 1, but many times in practice
 // there are more items in "item_array".
 
-ValueObjectSP
-ValueObject::GetSyntheticArrayMember (size_t index, bool can_create)
-{
-    ValueObjectSP synthetic_child_sp;
-    if (IsPointerType () || IsArrayType())
-    {
-        char index_str[64];
-        snprintf(index_str, sizeof(index_str), "[%" PRIu64 "]", (uint64_t)index);
-        ConstString index_const_str(index_str);
-        // Check if we have already created a synthetic array member in this
-        // valid object. If we have we will re-use it.
-        synthetic_child_sp = GetSyntheticChild (index_const_str);
-        if (!synthetic_child_sp)
-        {
-            ValueObject *synthetic_child;
-            // We haven't made a synthetic array member for INDEX yet, so
-            // lets make one and cache it for any future reference.
-            synthetic_child = CreateChildAtIndex(0, true, index);
-
-            // Cache the value if we got one back...
-            if (synthetic_child)
-            {
-                AddSyntheticChild(index_const_str, synthetic_child);
-                synthetic_child_sp = synthetic_child->GetSP();
-                synthetic_child_sp->SetName(ConstString(index_str));
-                synthetic_child_sp->m_is_array_item_for_pointer = true;
-            }
-        }
-    }
-    return synthetic_child_sp;
-}
-
-ValueObjectSP
-ValueObject::GetSyntheticBitFieldChild (uint32_t from, uint32_t to, bool can_create)
-{
-    ValueObjectSP synthetic_child_sp;
-    if (IsScalarType ())
-    {
-        char index_str[64];
-        snprintf(index_str, sizeof(index_str), "[%i-%i]", from, to);
-        ConstString index_const_str(index_str);
-        // Check if we have already created a synthetic array member in this
-        // valid object. If we have we will re-use it.
-        synthetic_child_sp = GetSyntheticChild (index_const_str);
-        if (!synthetic_child_sp)
-        {
-            uint32_t bit_field_size = to - from + 1;
-            uint32_t bit_field_offset = from;
-            if (GetDataExtractor().GetByteOrder() == eByteOrderBig)
-                bit_field_offset = GetByteSize() * 8 - bit_field_size - bit_field_offset;
-            // We haven't made a synthetic array member for INDEX yet, so
-            // lets make one and cache it for any future reference.
-            ValueObjectChild *synthetic_child = new ValueObjectChild (*this,
-                                                                      GetCompilerType(),
-                                                                      index_const_str,
-                                                                      GetByteSize(),
-                                                                      0,
-                                                                      bit_field_size,
-                                                                      bit_field_offset,
-                                                                      false,
-                                                                      false,
-                                                                      eAddressTypeInvalid,
-                                                                      0);
-            
-            // Cache the value if we got one back...
-            if (synthetic_child)
-            {
-                AddSyntheticChild(index_const_str, synthetic_child);
-                synthetic_child_sp = synthetic_child->GetSP();
-                synthetic_child_sp->SetName(ConstString(index_str));
-                synthetic_child_sp->m_is_bitfield_for_scalar = true;
-            }
-        }
-    }
-    return synthetic_child_sp;
-}
-
-ValueObjectSP
-ValueObject::GetSyntheticChildAtOffset(uint32_t offset,
-                                       const CompilerType& type,
-                                       bool can_create,
-                                       ConstString name_const_str)
-{
-    
-    ValueObjectSP synthetic_child_sp;
-    
-    if (name_const_str.IsEmpty())
-    {
-        char name_str[64];
-        snprintf(name_str, sizeof(name_str), "@%i", offset);
-        name_const_str.SetCString(name_str);
-    }
-    
+ValueObjectSP ValueObject::GetSyntheticArrayMember(size_t index,
+                                                   bool can_create) {
+  ValueObjectSP synthetic_child_sp;
+  if (IsPointerType() || IsArrayType()) {
+    char index_str[64];
+    snprintf(index_str, sizeof(index_str), "[%" PRIu64 "]", (uint64_t)index);
+    ConstString index_const_str(index_str);
     // Check if we have already created a synthetic array member in this
     // valid object. If we have we will re-use it.
-    synthetic_child_sp = GetSyntheticChild (name_const_str);
-    
-    if (synthetic_child_sp.get())
-        return synthetic_child_sp;
-    
-    if (!can_create)
-        return ValueObjectSP();
-    
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    
-    ValueObjectChild *synthetic_child = new ValueObjectChild(*this,
-                                                             type,
-                                                             name_const_str,
-                                                             type.GetByteSize(exe_ctx.GetBestExecutionContextScope()),
-                                                             offset,
-                                                             0,
-                                                             0,
-                                                             false,
-                                                             false,
-                                                             eAddressTypeInvalid,
-                                                             0);
-    if (synthetic_child)
-    {
-        AddSyntheticChild(name_const_str, synthetic_child);
+    synthetic_child_sp = GetSyntheticChild(index_const_str);
+    if (!synthetic_child_sp) {
+      ValueObject *synthetic_child;
+      // We haven't made a synthetic array member for INDEX yet, so
+      // lets make one and cache it for any future reference.
+      synthetic_child = CreateChildAtIndex(0, true, index);
+
+      // Cache the value if we got one back...
+      if (synthetic_child) {
+        AddSyntheticChild(index_const_str, synthetic_child);
         synthetic_child_sp = synthetic_child->GetSP();
-        synthetic_child_sp->SetName(name_const_str);
-        synthetic_child_sp->m_is_child_at_offset = true;
-    }
-    return synthetic_child_sp;
+        synthetic_child_sp->SetName(ConstString(index_str));
+        synthetic_child_sp->m_is_array_item_for_pointer = true;
+      }
+    }
+  }
+  return synthetic_child_sp;
 }
 
-ValueObjectSP
-ValueObject::GetSyntheticBase (uint32_t offset,
-                               const CompilerType& type,
-                               bool can_create,
-                               ConstString name_const_str)
-{
-    ValueObjectSP synthetic_child_sp;
-    
-    if (name_const_str.IsEmpty())
-    {
-        char name_str[128];
-        snprintf(name_str, sizeof(name_str), "base%s@%i", type.GetTypeName().AsCString("<unknown>"), offset);
-        name_const_str.SetCString(name_str);
-    }
-    
+ValueObjectSP ValueObject::GetSyntheticBitFieldChild(uint32_t from, uint32_t to,
+                                                     bool can_create) {
+  ValueObjectSP synthetic_child_sp;
+  if (IsScalarType()) {
+    char index_str[64];
+    snprintf(index_str, sizeof(index_str), "[%i-%i]", from, to);
+    ConstString index_const_str(index_str);
     // Check if we have already created a synthetic array member in this
     // valid object. If we have we will re-use it.
-    synthetic_child_sp = GetSyntheticChild (name_const_str);
-    
-    if (synthetic_child_sp.get())
-        return synthetic_child_sp;
-    
-    if (!can_create)
-        return ValueObjectSP();
-    
-    const bool is_base_class = true;
-    
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    
-    ValueObjectChild *synthetic_child = new ValueObjectChild(*this,
-                                                             type,
-                                                             name_const_str,
-                                                             type.GetByteSize(exe_ctx.GetBestExecutionContextScope()),
-                                                             offset,
-                                                             0,
-                                                             0,
-                                                             is_base_class,
-                                                             false,
-                                                             eAddressTypeInvalid,
-                                                             0);
-    if (synthetic_child)
-    {
-        AddSyntheticChild(name_const_str, synthetic_child);
+    synthetic_child_sp = GetSyntheticChild(index_const_str);
+    if (!synthetic_child_sp) {
+      uint32_t bit_field_size = to - from + 1;
+      uint32_t bit_field_offset = from;
+      if (GetDataExtractor().GetByteOrder() == eByteOrderBig)
+        bit_field_offset =
+            GetByteSize() * 8 - bit_field_size - bit_field_offset;
+      // We haven't made a synthetic array member for INDEX yet, so
+      // lets make one and cache it for any future reference.
+      ValueObjectChild *synthetic_child = new ValueObjectChild(
+          *this, GetCompilerType(), index_const_str, GetByteSize(), 0,
+          bit_field_size, bit_field_offset, false, false, eAddressTypeInvalid,
+          0);
+
+      // Cache the value if we got one back...
+      if (synthetic_child) {
+        AddSyntheticChild(index_const_str, synthetic_child);
         synthetic_child_sp = synthetic_child->GetSP();
-        synthetic_child_sp->SetName(name_const_str);
+        synthetic_child_sp->SetName(ConstString(index_str));
+        synthetic_child_sp->m_is_bitfield_for_scalar = true;
+      }
     }
-    return synthetic_child_sp;
+  }
+  return synthetic_child_sp;
 }
 
+ValueObjectSP ValueObject::GetSyntheticChildAtOffset(
+    uint32_t offset, const CompilerType &type, bool can_create,
+    ConstString name_const_str) {
+
+  ValueObjectSP synthetic_child_sp;
+
+  if (name_const_str.IsEmpty()) {
+    char name_str[64];
+    snprintf(name_str, sizeof(name_str), "@%i", offset);
+    name_const_str.SetCString(name_str);
+  }
+
+  // Check if we have already created a synthetic array member in this
+  // valid object. If we have we will re-use it.
+  synthetic_child_sp = GetSyntheticChild(name_const_str);
+
+  if (synthetic_child_sp.get())
+    return synthetic_child_sp;
+
+  if (!can_create)
+    return ValueObjectSP();
+
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+
+  ValueObjectChild *synthetic_child = new ValueObjectChild(
+      *this, type, name_const_str,
+      type.GetByteSize(exe_ctx.GetBestExecutionContextScope()), offset, 0, 0,
+      false, false, eAddressTypeInvalid, 0);
+  if (synthetic_child) {
+    AddSyntheticChild(name_const_str, synthetic_child);
+    synthetic_child_sp = synthetic_child->GetSP();
+    synthetic_child_sp->SetName(name_const_str);
+    synthetic_child_sp->m_is_child_at_offset = true;
+  }
+  return synthetic_child_sp;
+}
+
+ValueObjectSP ValueObject::GetSyntheticBase(uint32_t offset,
+                                            const CompilerType &type,
+                                            bool can_create,
+                                            ConstString name_const_str) {
+  ValueObjectSP synthetic_child_sp;
+
+  if (name_const_str.IsEmpty()) {
+    char name_str[128];
+    snprintf(name_str, sizeof(name_str), "base%s@%i",
+             type.GetTypeName().AsCString("<unknown>"), offset);
+    name_const_str.SetCString(name_str);
+  }
+
+  // Check if we have already created a synthetic array member in this
+  // valid object. If we have we will re-use it.
+  synthetic_child_sp = GetSyntheticChild(name_const_str);
+
+  if (synthetic_child_sp.get())
+    return synthetic_child_sp;
+
+  if (!can_create)
+    return ValueObjectSP();
+
+  const bool is_base_class = true;
+
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+
+  ValueObjectChild *synthetic_child = new ValueObjectChild(
+      *this, type, name_const_str,
+      type.GetByteSize(exe_ctx.GetBestExecutionContextScope()), offset, 0, 0,
+      is_base_class, false, eAddressTypeInvalid, 0);
+  if (synthetic_child) {
+    AddSyntheticChild(name_const_str, synthetic_child);
+    synthetic_child_sp = synthetic_child->GetSP();
+    synthetic_child_sp->SetName(name_const_str);
+  }
+  return synthetic_child_sp;
+}
 
 // your expression path needs to have a leading . or ->
 // (unless it somehow "looks like" an array, in which case it has
 // a leading [ symbol). while the [ is meaningful and should be shown
 // to the user, . and -> are just parser design, but by no means
 // added information for the user.. strip them off
-static const char*
-SkipLeadingExpressionPathSeparators(const char* expression)
-{
-    if (!expression || !expression[0])
-        return expression;
-    if (expression[0] == '.')
-        return expression+1;
-    if (expression[0] == '-' && expression[1] == '>')
-        return expression+2;
+static const char *SkipLeadingExpressionPathSeparators(const char *expression) {
+  if (!expression || !expression[0])
     return expression;
-}
+  if (expression[0] == '.')
+    return expression + 1;
+  if (expression[0] == '-' && expression[1] == '>')
+    return expression + 2;
+  return expression;
+}
+
+ValueObjectSP
+ValueObject::GetSyntheticExpressionPathChild(const char *expression,
+                                             bool can_create) {
+  ValueObjectSP synthetic_child_sp;
+  ConstString name_const_string(expression);
+  // Check if we have already created a synthetic array member in this
+  // valid object. If we have we will re-use it.
+  synthetic_child_sp = GetSyntheticChild(name_const_string);
+  if (!synthetic_child_sp) {
+    // We haven't made a synthetic array member for expression yet, so
+    // lets make one and cache it for any future reference.
+    synthetic_child_sp = GetValueForExpressionPath(
+        expression, NULL, NULL, NULL,
+        GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
+            GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+                None));
+
+    // Cache the value if we got one back...
+    if (synthetic_child_sp.get()) {
+      // FIXME: this causes a "real" child to end up with its name changed to
+      // the contents of expression
+      AddSyntheticChild(name_const_string, synthetic_child_sp.get());
+      synthetic_child_sp->SetName(
+          ConstString(SkipLeadingExpressionPathSeparators(expression)));
+    }
+  }
+  return synthetic_child_sp;
+}
+
+void ValueObject::CalculateSyntheticValue(bool use_synthetic) {
+  if (use_synthetic == false)
+    return;
+
+  TargetSP target_sp(GetTargetSP());
+  if (target_sp && target_sp->GetEnableSyntheticValue() == false) {
+    m_synthetic_value = NULL;
+    return;
+  }
+
+  lldb::SyntheticChildrenSP current_synth_sp(m_synthetic_children_sp);
+
+  if (!UpdateFormatsIfNeeded() && m_synthetic_value)
+    return;
+
+  if (m_synthetic_children_sp.get() == NULL)
+    return;
+
+  if (current_synth_sp == m_synthetic_children_sp && m_synthetic_value)
+    return;
+
+  m_synthetic_value = new ValueObjectSynthetic(*this, m_synthetic_children_sp);
+}
+
+void ValueObject::CalculateDynamicValue(DynamicValueType use_dynamic) {
+  if (use_dynamic == eNoDynamicValues)
+    return;
 
-ValueObjectSP
-ValueObject::GetSyntheticExpressionPathChild(const char* expression, bool can_create)
-{
-    ValueObjectSP synthetic_child_sp;
-    ConstString name_const_string(expression);
-    // Check if we have already created a synthetic array member in this
-    // valid object. If we have we will re-use it.
-    synthetic_child_sp = GetSyntheticChild (name_const_string);
-    if (!synthetic_child_sp)
-    {
-        // We haven't made a synthetic array member for expression yet, so
-        // lets make one and cache it for any future reference.
-        synthetic_child_sp = GetValueForExpressionPath(expression,
-                                                       NULL, NULL, NULL,
-                                                       GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(GetValueForExpressionPathOptions::SyntheticChildrenTraversal::None));
-        
-        // Cache the value if we got one back...
-        if (synthetic_child_sp.get())
-        {
-            // FIXME: this causes a "real" child to end up with its name changed to the contents of expression
-            AddSyntheticChild(name_const_string, synthetic_child_sp.get());
-            synthetic_child_sp->SetName(ConstString(SkipLeadingExpressionPathSeparators(expression)));
-        }
+  if (!m_dynamic_value && !IsDynamic()) {
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    Process *process = exe_ctx.GetProcessPtr();
+    if (process && process->IsPossibleDynamicValue(*this)) {
+      ClearDynamicTypeInformation();
+      m_dynamic_value = new ValueObjectDynamicValue(*this, use_dynamic);
     }
-    return synthetic_child_sp;
+  }
 }
 
-void
-ValueObject::CalculateSyntheticValue (bool use_synthetic)
-{
-    if (use_synthetic == false)
-        return;
-    
-    TargetSP target_sp(GetTargetSP());
-    if (target_sp && target_sp->GetEnableSyntheticValue() == false)
-    {
-        m_synthetic_value = NULL;
-        return;
-    }
-    
-    lldb::SyntheticChildrenSP current_synth_sp(m_synthetic_children_sp);
-    
-    if (!UpdateFormatsIfNeeded() && m_synthetic_value)
-        return;
-    
-    if (m_synthetic_children_sp.get() == NULL)
-        return;
-    
-    if (current_synth_sp == m_synthetic_children_sp && m_synthetic_value)
-        return;
-    
-    m_synthetic_value = new ValueObjectSynthetic(*this, m_synthetic_children_sp);
-}
+ValueObjectSP ValueObject::GetDynamicValue(DynamicValueType use_dynamic) {
+  if (use_dynamic == eNoDynamicValues)
+    return ValueObjectSP();
 
-void
-ValueObject::CalculateDynamicValue (DynamicValueType use_dynamic)
-{
-    if (use_dynamic == eNoDynamicValues)
-        return;
-        
-    if (!m_dynamic_value && !IsDynamic())
-    {
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        Process *process = exe_ctx.GetProcessPtr();
-        if (process && process->IsPossibleDynamicValue(*this))
-        {
-            ClearDynamicTypeInformation ();
-            m_dynamic_value = new ValueObjectDynamicValue (*this, use_dynamic);
-        }
-    }
+  if (!IsDynamic() && m_dynamic_value == NULL) {
+    CalculateDynamicValue(use_dynamic);
+  }
+  if (m_dynamic_value)
+    return m_dynamic_value->GetSP();
+  else
+    return ValueObjectSP();
 }
 
-ValueObjectSP
-ValueObject::GetDynamicValue (DynamicValueType use_dynamic)
-{
-    if (use_dynamic == eNoDynamicValues)
-        return ValueObjectSP();
-        
-    if (!IsDynamic() && m_dynamic_value == NULL)
-    {
-        CalculateDynamicValue(use_dynamic);
-    }
-    if (m_dynamic_value)
-        return m_dynamic_value->GetSP();
-    else
-        return ValueObjectSP();
-}
+ValueObjectSP ValueObject::GetStaticValue() { return GetSP(); }
 
-ValueObjectSP
-ValueObject::GetStaticValue()
-{
-    return GetSP();
-}
+lldb::ValueObjectSP ValueObject::GetNonSyntheticValue() { return GetSP(); }
 
-lldb::ValueObjectSP
-ValueObject::GetNonSyntheticValue ()
-{
-    return GetSP();
-}
+ValueObjectSP ValueObject::GetSyntheticValue(bool use_synthetic) {
+  if (use_synthetic == false)
+    return ValueObjectSP();
 
-ValueObjectSP
-ValueObject::GetSyntheticValue (bool use_synthetic)
-{
-    if (use_synthetic == false)
-        return ValueObjectSP();
+  CalculateSyntheticValue(use_synthetic);
 
-    CalculateSyntheticValue(use_synthetic);
-    
-    if (m_synthetic_value)
-        return m_synthetic_value->GetSP();
-    else
-        return ValueObjectSP();
+  if (m_synthetic_value)
+    return m_synthetic_value->GetSP();
+  else
+    return ValueObjectSP();
 }
 
-bool
-ValueObject::HasSyntheticValue()
-{
-    UpdateFormatsIfNeeded();
-    
-    if (m_synthetic_children_sp.get() == NULL)
-        return false;
-    
-    CalculateSyntheticValue(true);
-    
-    if (m_synthetic_value)
-        return true;
-    else
-        return false;
-}
+bool ValueObject::HasSyntheticValue() {
+  UpdateFormatsIfNeeded();
 
-bool
-ValueObject::GetBaseClassPath (Stream &s)
-{
-    if (IsBaseClass())
-    {
-        bool parent_had_base_class = GetParent() && GetParent()->GetBaseClassPath (s);
-        CompilerType compiler_type = GetCompilerType();
-        std::string cxx_class_name;
-        bool this_had_base_class = ClangASTContext::GetCXXClassName (compiler_type, cxx_class_name);
-        if (this_had_base_class)
-        {
-            if (parent_had_base_class)
-                s.PutCString("::");
-            s.PutCString(cxx_class_name.c_str());
-        }
-        return parent_had_base_class || this_had_base_class;
-    }
+  if (m_synthetic_children_sp.get() == NULL)
     return false;
-}
 
+  CalculateSyntheticValue(true);
 
-ValueObject *
-ValueObject::GetNonBaseClassParent()
-{
-    if (GetParent())
-    {
-        if (GetParent()->IsBaseClass())
-            return GetParent()->GetNonBaseClassParent();
-        else
-            return GetParent();
-    }
-    return NULL;
+  if (m_synthetic_value)
+    return true;
+  else
+    return false;
 }
 
+bool ValueObject::GetBaseClassPath(Stream &s) {
+  if (IsBaseClass()) {
+    bool parent_had_base_class =
+        GetParent() && GetParent()->GetBaseClassPath(s);
+    CompilerType compiler_type = GetCompilerType();
+    std::string cxx_class_name;
+    bool this_had_base_class =
+        ClangASTContext::GetCXXClassName(compiler_type, cxx_class_name);
+    if (this_had_base_class) {
+      if (parent_had_base_class)
+        s.PutCString("::");
+      s.PutCString(cxx_class_name.c_str());
+    }
+    return parent_had_base_class || this_had_base_class;
+  }
+  return false;
+}
+
+ValueObject *ValueObject::GetNonBaseClassParent() {
+  if (GetParent()) {
+    if (GetParent()->IsBaseClass())
+      return GetParent()->GetNonBaseClassParent();
+    else
+      return GetParent();
+  }
+  return NULL;
+}
 
-bool
-ValueObject::IsBaseClass (uint32_t& depth)
-{
-    if (!IsBaseClass())
-    {
-        depth = 0;
-        return false;
-    }
-    if (GetParent())
-    {
-        GetParent()->IsBaseClass(depth);
-        depth = depth + 1;
-        return true;
-    }
-    // TODO: a base of no parent? weird..
-    depth = 1;
+bool ValueObject::IsBaseClass(uint32_t &depth) {
+  if (!IsBaseClass()) {
+    depth = 0;
+    return false;
+  }
+  if (GetParent()) {
+    GetParent()->IsBaseClass(depth);
+    depth = depth + 1;
     return true;
+  }
+  // TODO: a base of no parent? weird..
+  depth = 1;
+  return true;
 }
 
-void
-ValueObject::GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat epformat)
-{
-    // synthetic children do not actually "exist" as part of the hierarchy, and sometimes they are consed up in ways
-    // that don't make sense from an underlying language/API standpoint. So, use a special code path here to return
-    // something that can hopefully be used in expression
-    if (m_is_synthetic_children_generated)
-    {
-        UpdateValueIfNeeded();
-        
-        if (m_value.GetValueType() == Value::eValueTypeLoadAddress)
-        {
-            if (IsPointerOrReferenceType())
-            {
-                s.Printf("((%s)0x%" PRIx64 ")",
-                         GetTypeName().AsCString("void"),
-                         GetValueAsUnsigned(0));
-                return;
-            }
-            else
-            {
-                uint64_t load_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-                if (load_addr != LLDB_INVALID_ADDRESS)
-                {
-                    s.Printf("(*( (%s *)0x%" PRIx64 "))",
-                             GetTypeName().AsCString("void"),
-                             load_addr);
-                    return;
-                }
-            }
-        }
-        
-        if (CanProvideValue())
-        {
-            s.Printf("((%s)%s)",
-                     GetTypeName().AsCString("void"),
-                     GetValueAsCString());
-            return;
-        }
-        
+void ValueObject::GetExpressionPath(Stream &s, bool qualify_cxx_base_classes,
+                                    GetExpressionPathFormat epformat) {
+  // synthetic children do not actually "exist" as part of the hierarchy, and
+  // sometimes they are consed up in ways
+  // that don't make sense from an underlying language/API standpoint. So, use a
+  // special code path here to return
+  // something that can hopefully be used in expression
+  if (m_is_synthetic_children_generated) {
+    UpdateValueIfNeeded();
+
+    if (m_value.GetValueType() == Value::eValueTypeLoadAddress) {
+      if (IsPointerOrReferenceType()) {
+        s.Printf("((%s)0x%" PRIx64 ")", GetTypeName().AsCString("void"),
+                 GetValueAsUnsigned(0));
         return;
-    }
-    
-    const bool is_deref_of_parent = IsDereferenceOfParent ();
+      } else {
+        uint64_t load_addr =
+            m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+        if (load_addr != LLDB_INVALID_ADDRESS) {
+          s.Printf("(*( (%s *)0x%" PRIx64 "))", GetTypeName().AsCString("void"),
+                   load_addr);
+          return;
+        }
+      }
+    }
+
+    if (CanProvideValue()) {
+      s.Printf("((%s)%s)", GetTypeName().AsCString("void"),
+               GetValueAsCString());
+      return;
+    }
+
+    return;
+  }
+
+  const bool is_deref_of_parent = IsDereferenceOfParent();
+
+  if (is_deref_of_parent &&
+      epformat == eGetExpressionPathFormatDereferencePointers) {
+    // this is the original format of GetExpressionPath() producing code like
+    // *(a_ptr).memberName, which is entirely
+    // fine, until you put this into
+    // StackFrame::GetValueForVariableExpressionPath() which prefers to see
+    // a_ptr->memberName.
+    // the eHonorPointers mode is meant to produce strings in this latter format
+    s.PutCString("*(");
+  }
+
+  ValueObject *parent = GetParent();
+
+  if (parent)
+    parent->GetExpressionPath(s, qualify_cxx_base_classes, epformat);
+
+  // if we are a deref_of_parent just because we are synthetic array
+  // members made up to allow ptr[%d] syntax to work in variable
+  // printing, then add our name ([%d]) to the expression path
+  if (m_is_array_item_for_pointer &&
+      epformat == eGetExpressionPathFormatHonorPointers)
+    s.PutCString(m_name.AsCString());
+
+  if (!IsBaseClass()) {
+    if (!is_deref_of_parent) {
+      ValueObject *non_base_class_parent = GetNonBaseClassParent();
+      if (non_base_class_parent &&
+          !non_base_class_parent->GetName().IsEmpty()) {
+        CompilerType non_base_class_parent_compiler_type =
+            non_base_class_parent->GetCompilerType();
+        if (non_base_class_parent_compiler_type) {
+          if (parent && parent->IsDereferenceOfParent() &&
+              epformat == eGetExpressionPathFormatHonorPointers) {
+            s.PutCString("->");
+          } else {
+            const uint32_t non_base_class_parent_type_info =
+                non_base_class_parent_compiler_type.GetTypeInfo();
+
+            if (non_base_class_parent_type_info & eTypeIsPointer) {
+              s.PutCString("->");
+            } else if ((non_base_class_parent_type_info & eTypeHasChildren) &&
+                       !(non_base_class_parent_type_info & eTypeIsArray)) {
+              s.PutChar('.');
+            }
+          }
+        }
+      }
+
+      const char *name = GetName().GetCString();
+      if (name) {
+        if (qualify_cxx_base_classes) {
+          if (GetBaseClassPath(s))
+            s.PutCString("::");
+        }
+        s.PutCString(name);
+      }
+    }
+  }
+
+  if (is_deref_of_parent &&
+      epformat == eGetExpressionPathFormatDereferencePointers) {
+    s.PutChar(')');
+  }
+}
+
+ValueObjectSP ValueObject::GetValueForExpressionPath(
+    const char *expression, const char **first_unparsed,
+    ExpressionPathScanEndReason *reason_to_stop,
+    ExpressionPathEndResultType *final_value_type,
+    const GetValueForExpressionPathOptions &options,
+    ExpressionPathAftermath *final_task_on_target) {
+
+  const char *dummy_first_unparsed;
+  ExpressionPathScanEndReason dummy_reason_to_stop =
+      ValueObject::eExpressionPathScanEndReasonUnknown;
+  ExpressionPathEndResultType dummy_final_value_type =
+      ValueObject::eExpressionPathEndResultTypeInvalid;
+  ExpressionPathAftermath dummy_final_task_on_target =
+      ValueObject::eExpressionPathAftermathNothing;
+
+  ValueObjectSP ret_val = GetValueForExpressionPath_Impl(
+      expression, first_unparsed ? first_unparsed : &dummy_first_unparsed,
+      reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
+      final_value_type ? final_value_type : &dummy_final_value_type, options,
+      final_task_on_target ? final_task_on_target
+                           : &dummy_final_task_on_target);
+
+  if (!final_task_on_target ||
+      *final_task_on_target == ValueObject::eExpressionPathAftermathNothing)
+    return ret_val;
+
+  if (ret_val.get() &&
+      ((final_value_type ? *final_value_type : dummy_final_value_type) ==
+       eExpressionPathEndResultTypePlain)) // I can only deref and takeaddress
+                                           // of plain objects
+  {
+    if ((final_task_on_target ? *final_task_on_target
+                              : dummy_final_task_on_target) ==
+        ValueObject::eExpressionPathAftermathDereference) {
+      Error error;
+      ValueObjectSP final_value = ret_val->Dereference(error);
+      if (error.Fail() || !final_value.get()) {
+        if (reason_to_stop)
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
+        if (final_value_type)
+          *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
+        return ValueObjectSP();
+      } else {
+        if (final_task_on_target)
+          *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
+        return final_value;
+      }
+    }
+    if (*final_task_on_target ==
+        ValueObject::eExpressionPathAftermathTakeAddress) {
+      Error error;
+      ValueObjectSP final_value = ret_val->AddressOf(error);
+      if (error.Fail() || !final_value.get()) {
+        if (reason_to_stop)
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonTakingAddressFailed;
+        if (final_value_type)
+          *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
+        return ValueObjectSP();
+      } else {
+        if (final_task_on_target)
+          *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
+        return final_value;
+      }
+    }
+  }
+  return ret_val; // final_task_on_target will still have its original value, so
+                  // you know I did not do it
+}
+
+int ValueObject::GetValuesForExpressionPath(
+    const char *expression, ValueObjectListSP &list,
+    const char **first_unparsed, ExpressionPathScanEndReason *reason_to_stop,
+    ExpressionPathEndResultType *final_value_type,
+    const GetValueForExpressionPathOptions &options,
+    ExpressionPathAftermath *final_task_on_target) {
+  const char *dummy_first_unparsed;
+  ExpressionPathScanEndReason dummy_reason_to_stop;
+  ExpressionPathEndResultType dummy_final_value_type;
+  ExpressionPathAftermath dummy_final_task_on_target =
+      ValueObject::eExpressionPathAftermathNothing;
+
+  ValueObjectSP ret_val = GetValueForExpressionPath_Impl(
+      expression, first_unparsed ? first_unparsed : &dummy_first_unparsed,
+      reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
+      final_value_type ? final_value_type : &dummy_final_value_type, options,
+      final_task_on_target ? final_task_on_target
+                           : &dummy_final_task_on_target);
 
-    if (is_deref_of_parent && epformat == eGetExpressionPathFormatDereferencePointers)
-    {
-        // this is the original format of GetExpressionPath() producing code like *(a_ptr).memberName, which is entirely
-        // fine, until you put this into StackFrame::GetValueForVariableExpressionPath() which prefers to see a_ptr->memberName.
-        // the eHonorPointers mode is meant to produce strings in this latter format
-        s.PutCString("*(");
-    }
-    
-    ValueObject* parent = GetParent();
-    
-    if (parent)
-        parent->GetExpressionPath (s, qualify_cxx_base_classes, epformat);
-    
-    // if we are a deref_of_parent just because we are synthetic array
-    // members made up to allow ptr[%d] syntax to work in variable
-    // printing, then add our name ([%d]) to the expression path
-    if (m_is_array_item_for_pointer && epformat == eGetExpressionPathFormatHonorPointers)
-        s.PutCString(m_name.AsCString());
-            
-    if (!IsBaseClass())
-    {
-        if (!is_deref_of_parent)
-        {
-            ValueObject *non_base_class_parent = GetNonBaseClassParent();
-            if (non_base_class_parent && !non_base_class_parent->GetName().IsEmpty())
-            {
-                CompilerType non_base_class_parent_compiler_type = non_base_class_parent->GetCompilerType();
-                if (non_base_class_parent_compiler_type)
-                {
-                    if (parent && parent->IsDereferenceOfParent() && epformat == eGetExpressionPathFormatHonorPointers)
-                    {
-                        s.PutCString("->");
-                    }
-                    else
-                    {                    
-                        const uint32_t non_base_class_parent_type_info = non_base_class_parent_compiler_type.GetTypeInfo();
-                        
-                        if (non_base_class_parent_type_info & eTypeIsPointer)
-                        {
-                            s.PutCString("->");
-                        }
-                        else if ((non_base_class_parent_type_info & eTypeHasChildren) &&
-                                 !(non_base_class_parent_type_info & eTypeIsArray))
-                        {
-                            s.PutChar('.');
-                        }
-                    }
-                }
-            }
+  if (!ret_val.get()) // if there are errors, I add nothing to the list
+    return 0;
 
-            const char *name = GetName().GetCString();
-            if (name)
-            {
-                if (qualify_cxx_base_classes)
-                {
-                    if (GetBaseClassPath (s))
-                        s.PutCString("::");
-                }
-                s.PutCString(name);
-            }
-        }
-    }
-    
-    if (is_deref_of_parent && epformat == eGetExpressionPathFormatDereferencePointers)
+  if ((reason_to_stop ? *reason_to_stop : dummy_reason_to_stop) !=
+      eExpressionPathScanEndReasonArrayRangeOperatorMet) {
+    // I need not expand a range, just post-process the final value and return
+    if (!final_task_on_target ||
+        *final_task_on_target == ValueObject::eExpressionPathAftermathNothing) {
+      list->Append(ret_val);
+      return 1;
+    }
+    if (ret_val.get() &&
+        (final_value_type ? *final_value_type : dummy_final_value_type) ==
+            eExpressionPathEndResultTypePlain) // I can only deref and
+                                               // takeaddress of plain objects
     {
-        s.PutChar(')');
+      if (*final_task_on_target ==
+          ValueObject::eExpressionPathAftermathDereference) {
+        Error error;
+        ValueObjectSP final_value = ret_val->Dereference(error);
+        if (error.Fail() || !final_value.get()) {
+          if (reason_to_stop)
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
+          if (final_value_type)
+            *final_value_type =
+                ValueObject::eExpressionPathEndResultTypeInvalid;
+          return 0;
+        } else {
+          *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
+          list->Append(final_value);
+          return 1;
+        }
+      }
+      if (*final_task_on_target ==
+          ValueObject::eExpressionPathAftermathTakeAddress) {
+        Error error;
+        ValueObjectSP final_value = ret_val->AddressOf(error);
+        if (error.Fail() || !final_value.get()) {
+          if (reason_to_stop)
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonTakingAddressFailed;
+          if (final_value_type)
+            *final_value_type =
+                ValueObject::eExpressionPathEndResultTypeInvalid;
+          return 0;
+        } else {
+          *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
+          list->Append(final_value);
+          return 1;
+        }
+      }
+    }
+  } else {
+    return ExpandArraySliceExpression(
+        first_unparsed ? *first_unparsed : dummy_first_unparsed,
+        first_unparsed ? first_unparsed : &dummy_first_unparsed, ret_val, list,
+        reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
+        final_value_type ? final_value_type : &dummy_final_value_type, options,
+        final_task_on_target ? final_task_on_target
+                             : &dummy_final_task_on_target);
+  }
+  // in any non-covered case, just do the obviously right thing
+  list->Append(ret_val);
+  return 1;
+}
+
+ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
+    const char *expression_cstr, const char **first_unparsed,
+    ExpressionPathScanEndReason *reason_to_stop,
+    ExpressionPathEndResultType *final_result,
+    const GetValueForExpressionPathOptions &options,
+    ExpressionPathAftermath *what_next) {
+  ValueObjectSP root = GetSP();
+
+  if (!root.get())
+    return ValueObjectSP();
+
+  *first_unparsed = expression_cstr;
+
+  while (true) {
+
+    const char *expression_cstr =
+        *first_unparsed; // hide the top level expression_cstr
+
+    CompilerType root_compiler_type = root->GetCompilerType();
+    CompilerType pointee_compiler_type;
+    Flags pointee_compiler_type_info;
+
+    Flags root_compiler_type_info(
+        root_compiler_type.GetTypeInfo(&pointee_compiler_type));
+    if (pointee_compiler_type)
+      pointee_compiler_type_info.Reset(pointee_compiler_type.GetTypeInfo());
+
+    if (!expression_cstr || *expression_cstr == '\0') {
+      *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEndOfString;
+      return root;
+    }
+
+    switch (*expression_cstr) {
+    case '-': {
+      if (options.m_check_dot_vs_arrow_syntax &&
+          root_compiler_type_info.Test(eTypeIsPointer)) // if you are trying to
+                                                        // use -> on a
+                                                        // non-pointer and I
+                                                        // must catch the error
+      {
+        *first_unparsed = expression_cstr;
+        *reason_to_stop =
+            ValueObject::eExpressionPathScanEndReasonArrowInsteadOfDot;
+        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+        return ValueObjectSP();
+      }
+      if (root_compiler_type_info.Test(eTypeIsObjC) && // if yo are trying to
+                                                       // extract an ObjC IVar
+                                                       // when this is forbidden
+          root_compiler_type_info.Test(eTypeIsPointer) &&
+          options.m_no_fragile_ivar) {
+        *first_unparsed = expression_cstr;
+        *reason_to_stop =
+            ValueObject::eExpressionPathScanEndReasonFragileIVarNotAllowed;
+        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+        return ValueObjectSP();
+      }
+      if (expression_cstr[1] != '>') {
+        *first_unparsed = expression_cstr;
+        *reason_to_stop =
+            ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+        return ValueObjectSP();
+      }
+      expression_cstr++; // skip the -
     }
-}
-
-ValueObjectSP
-ValueObject::GetValueForExpressionPath(const char* expression,
-                                       const char** first_unparsed,
-                                       ExpressionPathScanEndReason* reason_to_stop,
-                                       ExpressionPathEndResultType* final_value_type,
-                                       const GetValueForExpressionPathOptions& options,
-                                       ExpressionPathAftermath* final_task_on_target)
-{
-    
-    const char* dummy_first_unparsed;
-    ExpressionPathScanEndReason dummy_reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnknown;
-    ExpressionPathEndResultType dummy_final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-    ExpressionPathAftermath dummy_final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-    
-    ValueObjectSP ret_val = GetValueForExpressionPath_Impl(expression,
-                                                           first_unparsed ? first_unparsed : &dummy_first_unparsed,
-                                                           reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
-                                                           final_value_type ? final_value_type : &dummy_final_value_type,
-                                                           options,
-                                                           final_task_on_target ? final_task_on_target : &dummy_final_task_on_target);
-    
-    if (!final_task_on_target || *final_task_on_target == ValueObject::eExpressionPathAftermathNothing)
-        return ret_val;
-
-    if (ret_val.get() && ((final_value_type ? *final_value_type : dummy_final_value_type) == eExpressionPathEndResultTypePlain)) // I can only deref and takeaddress of plain objects
+      LLVM_FALLTHROUGH;
+    case '.': // or fallthrough from ->
     {
-        if ( (final_task_on_target ? *final_task_on_target : dummy_final_task_on_target) == ValueObject::eExpressionPathAftermathDereference)
-        {
-            Error error;
-            ValueObjectSP final_value = ret_val->Dereference(error);
-            if (error.Fail() || !final_value.get())
-            {
-                if (reason_to_stop)
-                    *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
-                if (final_value_type)
-                    *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-                return ValueObjectSP();
-            }
-            else
-            {
-                if (final_task_on_target)
-                    *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-                return final_value;
+      if (options.m_check_dot_vs_arrow_syntax && *expression_cstr == '.' &&
+          root_compiler_type_info.Test(eTypeIsPointer)) // if you are trying to
+                                                        // use . on a pointer
+                                                        // and I must catch the
+                                                        // error
+      {
+        *first_unparsed = expression_cstr;
+        *reason_to_stop =
+            ValueObject::eExpressionPathScanEndReasonDotInsteadOfArrow;
+        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+        return ValueObjectSP();
+      }
+      expression_cstr++; // skip .
+      const char *next_separator = strpbrk(expression_cstr + 1, "-.[");
+      ConstString child_name;
+      if (!next_separator) // if no other separator just expand this last layer
+      {
+        child_name.SetCString(expression_cstr);
+        ValueObjectSP child_valobj_sp =
+            root->GetChildMemberWithName(child_name, true);
+
+        if (child_valobj_sp.get()) // we know we are done, so just return
+        {
+          *first_unparsed = "";
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonEndOfString;
+          *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+          return child_valobj_sp;
+        } else {
+          switch (options.m_synthetic_children_traversal) {
+          case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+              None:
+            break;
+          case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+              FromSynthetic:
+            if (root->IsSynthetic()) {
+              child_valobj_sp = root->GetNonSyntheticValue();
+              if (child_valobj_sp.get())
+                child_valobj_sp =
+                    child_valobj_sp->GetChildMemberWithName(child_name, true);
             }
-        }
-        if (*final_task_on_target == ValueObject::eExpressionPathAftermathTakeAddress)
-        {
-            Error error;
-            ValueObjectSP final_value = ret_val->AddressOf(error);
-            if (error.Fail() || !final_value.get())
-            {
-                if (reason_to_stop)
-                    *reason_to_stop = ValueObject::eExpressionPathScanEndReasonTakingAddressFailed;
-                if (final_value_type)
-                    *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-                return ValueObjectSP();
+            break;
+          case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+              ToSynthetic:
+            if (!root->IsSynthetic()) {
+              child_valobj_sp = root->GetSyntheticValue();
+              if (child_valobj_sp.get())
+                child_valobj_sp =
+                    child_valobj_sp->GetChildMemberWithName(child_name, true);
             }
-            else
-            {
-                if (final_task_on_target)
-                    *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-                return final_value;
+            break;
+          case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+              Both:
+            if (root->IsSynthetic()) {
+              child_valobj_sp = root->GetNonSyntheticValue();
+              if (child_valobj_sp.get())
+                child_valobj_sp =
+                    child_valobj_sp->GetChildMemberWithName(child_name, true);
+            } else {
+              child_valobj_sp = root->GetSyntheticValue();
+              if (child_valobj_sp.get())
+                child_valobj_sp =
+                    child_valobj_sp->GetChildMemberWithName(child_name, true);
             }
+            break;
+          }
         }
-    }
-    return ret_val; // final_task_on_target will still have its original value, so you know I did not do it
-}
 
-int
-ValueObject::GetValuesForExpressionPath(const char* expression,
-                                        ValueObjectListSP& list,
-                                        const char** first_unparsed,
-                                        ExpressionPathScanEndReason* reason_to_stop,
-                                        ExpressionPathEndResultType* final_value_type,
-                                        const GetValueForExpressionPathOptions& options,
-                                        ExpressionPathAftermath* final_task_on_target)
-{
-    const char* dummy_first_unparsed;
-    ExpressionPathScanEndReason dummy_reason_to_stop;
-    ExpressionPathEndResultType dummy_final_value_type;
-    ExpressionPathAftermath dummy_final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-    
-    ValueObjectSP ret_val = GetValueForExpressionPath_Impl(expression,
-                                                           first_unparsed ? first_unparsed : &dummy_first_unparsed,
-                                                           reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
-                                                           final_value_type ? final_value_type : &dummy_final_value_type,
-                                                           options,
-                                                           final_task_on_target ? final_task_on_target : &dummy_final_task_on_target);
-    
-    if (!ret_val.get()) // if there are errors, I add nothing to the list
-        return 0;
-    
-    if ( (reason_to_stop ? *reason_to_stop : dummy_reason_to_stop) != eExpressionPathScanEndReasonArrayRangeOperatorMet)
-    {
-        // I need not expand a range, just post-process the final value and return
-        if (!final_task_on_target || *final_task_on_target == ValueObject::eExpressionPathAftermathNothing)
-        {
-            list->Append(ret_val);
-            return 1;
-        }
-        if (ret_val.get() && (final_value_type ? *final_value_type : dummy_final_value_type) == eExpressionPathEndResultTypePlain) // I can only deref and takeaddress of plain objects
-        {
-            if (*final_task_on_target == ValueObject::eExpressionPathAftermathDereference)
-            {
-                Error error;
-                ValueObjectSP final_value = ret_val->Dereference(error);
-                if (error.Fail() || !final_value.get())
-                {
-                    if (reason_to_stop)
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
-                    if (final_value_type)
-                        *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-                    return 0;
-                }
-                else
-                {
-                    *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-                    list->Append(final_value);
-                    return 1;
-                }
+        // if we are here and options.m_no_synthetic_children is true,
+        // child_valobj_sp is going to be a NULL SP,
+        // so we hit the "else" branch, and return an error
+        if (child_valobj_sp.get()) // if it worked, just return
+        {
+          *first_unparsed = "";
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonEndOfString;
+          *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+          return child_valobj_sp;
+        } else {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return ValueObjectSP();
+        }
+      } else // other layers do expand
+      {
+        child_name.SetCStringWithLength(expression_cstr,
+                                        next_separator - expression_cstr);
+        ValueObjectSP child_valobj_sp =
+            root->GetChildMemberWithName(child_name, true);
+        if (child_valobj_sp.get()) // store the new root and move on
+        {
+          root = child_valobj_sp;
+          *first_unparsed = next_separator;
+          *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+          continue;
+        } else {
+          switch (options.m_synthetic_children_traversal) {
+          case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+              None:
+            break;
+          case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+              FromSynthetic:
+            if (root->IsSynthetic()) {
+              child_valobj_sp = root->GetNonSyntheticValue();
+              if (child_valobj_sp.get())
+                child_valobj_sp =
+                    child_valobj_sp->GetChildMemberWithName(child_name, true);
             }
-            if (*final_task_on_target == ValueObject::eExpressionPathAftermathTakeAddress)
-            {
-                Error error;
-                ValueObjectSP final_value = ret_val->AddressOf(error);
-                if (error.Fail() || !final_value.get())
-                {
-                    if (reason_to_stop)
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonTakingAddressFailed;
-                    if (final_value_type)
-                        *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid;
-                    return 0;
-                }
-                else
-                {
-                    *final_task_on_target = ValueObject::eExpressionPathAftermathNothing;
-                    list->Append(final_value);
-                    return 1;
-                }
+            break;
+          case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+              ToSynthetic:
+            if (!root->IsSynthetic()) {
+              child_valobj_sp = root->GetSyntheticValue();
+              if (child_valobj_sp.get())
+                child_valobj_sp =
+                    child_valobj_sp->GetChildMemberWithName(child_name, true);
             }
+            break;
+          case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+              Both:
+            if (root->IsSynthetic()) {
+              child_valobj_sp = root->GetNonSyntheticValue();
+              if (child_valobj_sp.get())
+                child_valobj_sp =
+                    child_valobj_sp->GetChildMemberWithName(child_name, true);
+            } else {
+              child_valobj_sp = root->GetSyntheticValue();
+              if (child_valobj_sp.get())
+                child_valobj_sp =
+                    child_valobj_sp->GetChildMemberWithName(child_name, true);
+            }
+            break;
+          }
         }
-    }
-    else
-    {
-        return ExpandArraySliceExpression(first_unparsed ? *first_unparsed : dummy_first_unparsed,
-                                          first_unparsed ? first_unparsed : &dummy_first_unparsed,
-                                          ret_val,
-                                          list,
-                                          reason_to_stop ? reason_to_stop : &dummy_reason_to_stop,
-                                          final_value_type ? final_value_type : &dummy_final_value_type,
-                                          options,
-                                          final_task_on_target ? final_task_on_target : &dummy_final_task_on_target);
-    }
-    // in any non-covered case, just do the obviously right thing
-    list->Append(ret_val);
-    return 1;
-}
 
-ValueObjectSP
-ValueObject::GetValueForExpressionPath_Impl(const char* expression_cstr,
-                                            const char** first_unparsed,
-                                            ExpressionPathScanEndReason* reason_to_stop,
-                                            ExpressionPathEndResultType* final_result,
-                                            const GetValueForExpressionPathOptions& options,
-                                            ExpressionPathAftermath* what_next)
-{
-    ValueObjectSP root = GetSP();
-    
-    if (!root.get())
+        // if we are here and options.m_no_synthetic_children is true,
+        // child_valobj_sp is going to be a NULL SP,
+        // so we hit the "else" branch, and return an error
+        if (child_valobj_sp.get()) // if it worked, move on
+        {
+          root = child_valobj_sp;
+          *first_unparsed = next_separator;
+          *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+          continue;
+        } else {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return ValueObjectSP();
+        }
+      }
+      break;
+    }
+    case '[': {
+      if (!root_compiler_type_info.Test(eTypeIsArray) &&
+          !root_compiler_type_info.Test(eTypeIsPointer) &&
+          !root_compiler_type_info.Test(
+              eTypeIsVector)) // if this is not a T[] nor a T*
+      {
+        if (!root_compiler_type_info.Test(
+                eTypeIsScalar)) // if this is not even a scalar...
+        {
+          if (options.m_synthetic_children_traversal ==
+              GetValueForExpressionPathOptions::SyntheticChildrenTraversal::
+                  None) // ...only chance left is synthetic
+          {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonRangeOperatorInvalid;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          }
+        } else if (!options.m_allow_bitfields_syntax) // if this is a scalar,
+                                                      // check that we can
+                                                      // expand bitfields
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonRangeOperatorNotAllowed;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return ValueObjectSP();
+        }
+      }
+      if (*(expression_cstr + 1) ==
+          ']') // if this is an unbounded range it only works for arrays
+      {
+        if (!root_compiler_type_info.Test(eTypeIsArray)) {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return ValueObjectSP();
+        } else // even if something follows, we cannot expand unbounded ranges,
+               // just let the caller do it
+        {
+          *first_unparsed = expression_cstr + 2;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
+          *final_result =
+              ValueObject::eExpressionPathEndResultTypeUnboundedRange;
+          return root;
+        }
+      }
+      const char *separator_position = ::strchr(expression_cstr + 1, '-');
+      const char *close_bracket_position = ::strchr(expression_cstr + 1, ']');
+      if (!close_bracket_position) // if there is no ], this is a syntax error
+      {
+        *first_unparsed = expression_cstr;
+        *reason_to_stop =
+            ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
         return ValueObjectSP();
-    
-    *first_unparsed = expression_cstr;
-    
-    while (true)
-    {
-        
-        const char* expression_cstr = *first_unparsed; // hide the top level expression_cstr
-        
-        CompilerType root_compiler_type = root->GetCompilerType();
-        CompilerType pointee_compiler_type;
-        Flags pointee_compiler_type_info;
-        
-        Flags root_compiler_type_info(root_compiler_type.GetTypeInfo(&pointee_compiler_type));
-        if (pointee_compiler_type)
-            pointee_compiler_type_info.Reset(pointee_compiler_type.GetTypeInfo());
-        
-        if (!expression_cstr || *expression_cstr == '\0')
-        {
-            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEndOfString;
+      }
+      if (!separator_position ||
+          separator_position > close_bracket_position) // if no separator, this
+                                                       // is either [] or [N]
+      {
+        char *end = NULL;
+        unsigned long index = ::strtoul(expression_cstr + 1, &end, 0);
+        if (!end || end != close_bracket_position) // if something weird is in
+                                                   // our way return an error
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return ValueObjectSP();
+        }
+        if (end - expression_cstr ==
+            1) // if this is [], only return a valid value for arrays
+        {
+          if (root_compiler_type_info.Test(eTypeIsArray)) {
+            *first_unparsed = expression_cstr + 2;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
+            *final_result =
+                ValueObject::eExpressionPathEndResultTypeUnboundedRange;
             return root;
-        }
-        
-        switch (*expression_cstr)
-        {
-            case '-':
-            {
-                if (options.m_check_dot_vs_arrow_syntax &&
-                    root_compiler_type_info.Test(eTypeIsPointer) ) // if you are trying to use -> on a non-pointer and I must catch the error
-                {
-                    *first_unparsed = expression_cstr;
-                    *reason_to_stop = ValueObject::eExpressionPathScanEndReasonArrowInsteadOfDot;
-                    *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                    return ValueObjectSP();
-                }
-                if (root_compiler_type_info.Test(eTypeIsObjC) &&  // if yo are trying to extract an ObjC IVar when this is forbidden
-                    root_compiler_type_info.Test(eTypeIsPointer) &&
-                    options.m_no_fragile_ivar)
-                {
-                    *first_unparsed = expression_cstr;
-                    *reason_to_stop = ValueObject::eExpressionPathScanEndReasonFragileIVarNotAllowed;
-                    *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                    return ValueObjectSP();
-                }
-                if (expression_cstr[1] != '>')
-                {
-                    *first_unparsed = expression_cstr;
-                    *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                    *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                    return ValueObjectSP();
-                }
-                expression_cstr++; // skip the -
-            }
-            LLVM_FALLTHROUGH;
-            case '.': // or fallthrough from ->
-            {
-                if (options.m_check_dot_vs_arrow_syntax && *expression_cstr == '.' &&
-                    root_compiler_type_info.Test(eTypeIsPointer)) // if you are trying to use . on a pointer and I must catch the error
-                {
-                    *first_unparsed = expression_cstr;
-                    *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDotInsteadOfArrow;
-                    *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                    return ValueObjectSP();
-                }
-                expression_cstr++; // skip .
-                const char *next_separator = strpbrk(expression_cstr+1,"-.[");
-                ConstString child_name;
-                if (!next_separator) // if no other separator just expand this last layer
-                {
-                    child_name.SetCString (expression_cstr);
-                    ValueObjectSP child_valobj_sp = root->GetChildMemberWithName(child_name, true);
-                    
-                    if (child_valobj_sp.get()) // we know we are done, so just return
-                    {
-                        *first_unparsed = "";
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEndOfString;
-                        *final_result = ValueObject::eExpressionPathEndResultTypePlain;
-                        return child_valobj_sp;
-                    }
-                    else
-                    {
-                        switch (options.m_synthetic_children_traversal)
-                        {
-                            case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::None:
-                                break;
-                            case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::FromSynthetic:
-                                if (root->IsSynthetic())
-                                {
-                                    child_valobj_sp = root->GetNonSyntheticValue();
-                                    if (child_valobj_sp.get())
-                                        child_valobj_sp = child_valobj_sp->GetChildMemberWithName(child_name, true);
-                                }
-                                break;
-                            case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::ToSynthetic:
-                                if (!root->IsSynthetic())
-                                {
-                                    child_valobj_sp = root->GetSyntheticValue();
-                                    if (child_valobj_sp.get())
-                                        child_valobj_sp = child_valobj_sp->GetChildMemberWithName(child_name, true);
-                                }
-                                break;
-                            case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::Both:
-                                if (root->IsSynthetic())
-                                {
-                                    child_valobj_sp = root->GetNonSyntheticValue();
-                                    if (child_valobj_sp.get())
-                                        child_valobj_sp = child_valobj_sp->GetChildMemberWithName(child_name, true);
-                                }
-                                else
-                                {
-                                    child_valobj_sp = root->GetSyntheticValue();
-                                    if (child_valobj_sp.get())
-                                        child_valobj_sp = child_valobj_sp->GetChildMemberWithName(child_name, true);
-                                }
-                                break;
-                        }
-                    }
-                    
-                    // if we are here and options.m_no_synthetic_children is true, child_valobj_sp is going to be a NULL SP,
-                    // so we hit the "else" branch, and return an error
-                    if(child_valobj_sp.get()) // if it worked, just return
-                    {
-                        *first_unparsed = "";
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEndOfString;
-                        *final_result = ValueObject::eExpressionPathEndResultTypePlain;
-                        return child_valobj_sp;
-                    }
-                    else
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return ValueObjectSP();
-                    }
-                }
-                else // other layers do expand
-                {
-                    child_name.SetCStringWithLength(expression_cstr, next_separator - expression_cstr);
-                    ValueObjectSP child_valobj_sp = root->GetChildMemberWithName(child_name, true);
-                    if (child_valobj_sp.get()) // store the new root and move on
-                    {
-                        root = child_valobj_sp;
-                        *first_unparsed = next_separator;
-                        *final_result = ValueObject::eExpressionPathEndResultTypePlain;
-                        continue;
-                    }
-                    else
-                    {
-                        switch (options.m_synthetic_children_traversal)
-                        {
-                            case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::None:
-                                break;
-                            case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::FromSynthetic:
-                                if (root->IsSynthetic())
-                                {
-                                    child_valobj_sp = root->GetNonSyntheticValue();
-                                    if (child_valobj_sp.get())
-                                        child_valobj_sp = child_valobj_sp->GetChildMemberWithName(child_name, true);
-                                }
-                                break;
-                            case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::ToSynthetic:
-                                if (!root->IsSynthetic())
-                                {
-                                    child_valobj_sp = root->GetSyntheticValue();
-                                    if (child_valobj_sp.get())
-                                        child_valobj_sp = child_valobj_sp->GetChildMemberWithName(child_name, true);
-                                }
-                                break;
-                            case GetValueForExpressionPathOptions::SyntheticChildrenTraversal::Both:
-                                if (root->IsSynthetic())
-                                {
-                                    child_valobj_sp = root->GetNonSyntheticValue();
-                                    if (child_valobj_sp.get())
-                                        child_valobj_sp = child_valobj_sp->GetChildMemberWithName(child_name, true);
-                                }
-                                else
-                                {
-                                    child_valobj_sp = root->GetSyntheticValue();
-                                    if (child_valobj_sp.get())
-                                        child_valobj_sp = child_valobj_sp->GetChildMemberWithName(child_name, true);
-                                }
-                                break;
-                        }
-                    }
-                    
-                    // if we are here and options.m_no_synthetic_children is true, child_valobj_sp is going to be a NULL SP,
-                    // so we hit the "else" branch, and return an error
-                    if(child_valobj_sp.get()) // if it worked, move on
-                    {
-                        root = child_valobj_sp;
-                        *first_unparsed = next_separator;
-                        *final_result = ValueObject::eExpressionPathEndResultTypePlain;
-                        continue;
-                    }
-                    else
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return ValueObjectSP();
-                    }
-                }
-                break;
-            }
-            case '[':
-            {
-                if (!root_compiler_type_info.Test(eTypeIsArray) && !root_compiler_type_info.Test(eTypeIsPointer) && !root_compiler_type_info.Test(eTypeIsVector)) // if this is not a T[] nor a T*
-                {
-                    if (!root_compiler_type_info.Test(eTypeIsScalar)) // if this is not even a scalar...
-                    {
-                        if (options.m_synthetic_children_traversal == GetValueForExpressionPathOptions::SyntheticChildrenTraversal::None) // ...only chance left is synthetic
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorInvalid;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                    }
-                    else if (!options.m_allow_bitfields_syntax) // if this is a scalar, check that we can expand bitfields
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorNotAllowed;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return ValueObjectSP();
-                    }
-                }
-                if (*(expression_cstr+1) == ']') // if this is an unbounded range it only works for arrays
-                {
-                    if (!root_compiler_type_info.Test(eTypeIsArray))
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return ValueObjectSP();
-                    }
-                    else // even if something follows, we cannot expand unbounded ranges, just let the caller do it
-                    {
-                        *first_unparsed = expression_cstr+2;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeUnboundedRange;
-                        return root;
-                    }
-                }
-                const char *separator_position = ::strchr(expression_cstr+1,'-');
-                const char *close_bracket_position = ::strchr(expression_cstr+1,']');
-                if (!close_bracket_position) // if there is no ], this is a syntax error
-                {
-                    *first_unparsed = expression_cstr;
-                    *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                    *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                    return ValueObjectSP();
-                }
-                if (!separator_position || separator_position > close_bracket_position) // if no separator, this is either [] or [N]
-                {
-                    char *end = NULL;
-                    unsigned long index = ::strtoul (expression_cstr+1, &end, 0);
-                    if (!end || end != close_bracket_position) // if something weird is in our way return an error
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return ValueObjectSP();
-                    }
-                    if (end - expression_cstr == 1) // if this is [], only return a valid value for arrays
-                    {
-                        if (root_compiler_type_info.Test(eTypeIsArray))
-                        {
-                            *first_unparsed = expression_cstr+2;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeUnboundedRange;
-                            return root;
-                        }
-                        else
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                    }
-                    // from here on we do have a valid index
-                    if (root_compiler_type_info.Test(eTypeIsArray))
-                    {
-                        ValueObjectSP child_valobj_sp = root->GetChildAtIndex(index, true);
-                        if (!child_valobj_sp)
-                            child_valobj_sp = root->GetSyntheticArrayMember(index, true);
-                        if (!child_valobj_sp)
-                            if (root->HasSyntheticValue() && root->GetSyntheticValue()->GetNumChildren() > index)
-                                child_valobj_sp = root->GetSyntheticValue()->GetChildAtIndex(index, true);
-                        if (child_valobj_sp)
-                        {
-                            root = child_valobj_sp;
-                            *first_unparsed = end+1; // skip ]
-                            *final_result = ValueObject::eExpressionPathEndResultTypePlain;
-                            continue;
-                        }
-                        else
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                    }
-                    else if (root_compiler_type_info.Test(eTypeIsPointer))
-                    {
-                        if (*what_next == ValueObject::eExpressionPathAftermathDereference &&  // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
-                            pointee_compiler_type_info.Test(eTypeIsScalar))
-                        {
-                            Error error;
-                            root = root->Dereference(error);
-                            if (error.Fail() || !root.get())
-                            {
-                                *first_unparsed = expression_cstr;
-                                *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
-                                *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                                return ValueObjectSP();
-                            }
-                            else
-                            {
-                                *what_next = eExpressionPathAftermathNothing;
-                                continue;
-                            }
-                        }
-                        else
-                        {
-                            if (root->GetCompilerType().GetMinimumLanguage() == eLanguageTypeObjC
-                                && pointee_compiler_type_info.AllClear(eTypeIsPointer)
-                                && root->HasSyntheticValue()
-                                && (options.m_synthetic_children_traversal == GetValueForExpressionPathOptions::SyntheticChildrenTraversal::ToSynthetic ||
-                                    options.m_synthetic_children_traversal == GetValueForExpressionPathOptions::SyntheticChildrenTraversal::Both))
-                            {
-                                root = root->GetSyntheticValue()->GetChildAtIndex(index, true);
-                            }
-                            else
-                                root = root->GetSyntheticArrayMember(index, true);
-                            if (!root.get())
-                            {
-                                *first_unparsed = expression_cstr;
-                                *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                                *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                                return ValueObjectSP();
-                            }
-                            else
-                            {
-                                *first_unparsed = end+1; // skip ]
-                                *final_result = ValueObject::eExpressionPathEndResultTypePlain;
-                                continue;
-                            }
-                        }
-                    }
-                    else if (root_compiler_type_info.Test(eTypeIsScalar))
-                    {
-                        root = root->GetSyntheticBitFieldChild(index, index, true);
-                        if (!root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                        else // we do not know how to expand members of bitfields, so we just return and let the caller do any further processing
-                        {
-                            *first_unparsed = end+1; // skip ]
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonBitfieldRangeOperatorMet;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeBitfield;
-                            return root;
-                        }
-                    }
-                    else if (root_compiler_type_info.Test(eTypeIsVector))
-                    {
-                        root = root->GetChildAtIndex(index, true);
-                        if (!root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                        else
-                        {
-                            *first_unparsed = end+1; // skip ]
-                            *final_result = ValueObject::eExpressionPathEndResultTypePlain;
-                            continue;
-                        }
-                    }
-                    else if (options.m_synthetic_children_traversal == GetValueForExpressionPathOptions::SyntheticChildrenTraversal::ToSynthetic ||
-                             options.m_synthetic_children_traversal == GetValueForExpressionPathOptions::SyntheticChildrenTraversal::Both)
-                    {
-                        if (root->HasSyntheticValue())
-                            root = root->GetSyntheticValue();
-                        else if (!root->IsSynthetic())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonSyntheticValueMissing;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                        // if we are here, then root itself is a synthetic VO.. should be good to go
-                        
-                        if (!root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonSyntheticValueMissing;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                        root = root->GetChildAtIndex(index, true);
-                        if (!root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                        else
-                        {
-                            *first_unparsed = end+1; // skip ]
-                            *final_result = ValueObject::eExpressionPathEndResultTypePlain;
-                            continue;
-                        }
-                    }
-                    else
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return ValueObjectSP();
-                    }
-                }
-                else // we have a low and a high index
-                {
-                    char *end = NULL;
-                    unsigned long index_lower = ::strtoul (expression_cstr+1, &end, 0);
-                    if (!end || end != separator_position) // if something weird is in our way return an error
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return ValueObjectSP();
-                    }
-                    unsigned long index_higher = ::strtoul (separator_position+1, &end, 0);
-                    if (!end || end != close_bracket_position) // if something weird is in our way return an error
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return ValueObjectSP();
-                    }
-                    if (index_lower > index_higher) // swap indices if required
-                    {
-                        unsigned long temp = index_lower;
-                        index_lower = index_higher;
-                        index_higher = temp;
-                    }
-                    if (root_compiler_type_info.Test(eTypeIsScalar)) // expansion only works for scalars
-                    {
-                        root = root->GetSyntheticBitFieldChild(index_lower, index_higher, true);
-                        if (!root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                        else
-                        {
-                            *first_unparsed = end+1; // skip ]
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonBitfieldRangeOperatorMet;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeBitfield;
-                            return root;
-                        }
-                    }
-                    else if (root_compiler_type_info.Test(eTypeIsPointer) && // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
-                             *what_next == ValueObject::eExpressionPathAftermathDereference &&
-                             pointee_compiler_type_info.Test(eTypeIsScalar))
-                    {
-                        Error error;
-                        root = root->Dereference(error);
-                        if (error.Fail() || !root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return ValueObjectSP();
-                        }
-                        else
-                        {
-                            *what_next = ValueObject::eExpressionPathAftermathNothing;
-                            continue;
-                        }
-                    }
-                    else
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeBoundedRange;
-                        return root;
-                    }
-                }
-                break;
-            }
-            default: // some non-separator is in the way
-            {
-                *first_unparsed = expression_cstr;
-                *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                return ValueObjectSP();
-                break;
-            }
-        }
-    }
-}
+          } else {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          }
+        }
+        // from here on we do have a valid index
+        if (root_compiler_type_info.Test(eTypeIsArray)) {
+          ValueObjectSP child_valobj_sp = root->GetChildAtIndex(index, true);
+          if (!child_valobj_sp)
+            child_valobj_sp = root->GetSyntheticArrayMember(index, true);
+          if (!child_valobj_sp)
+            if (root->HasSyntheticValue() &&
+                root->GetSyntheticValue()->GetNumChildren() > index)
+              child_valobj_sp =
+                  root->GetSyntheticValue()->GetChildAtIndex(index, true);
+          if (child_valobj_sp) {
+            root = child_valobj_sp;
+            *first_unparsed = end + 1; // skip ]
+            *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+            continue;
+          } else {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          }
+        } else if (root_compiler_type_info.Test(eTypeIsPointer)) {
+          if (*what_next ==
+                  ValueObject::
+                      eExpressionPathAftermathDereference && // if this is a
+                                                             // ptr-to-scalar, I
+                                                             // am accessing it
+                                                             // by index and I
+                                                             // would have
+                                                             // deref'ed anyway,
+                                                             // then do it now
+                                                             // and use this as
+                                                             // a bitfield
+              pointee_compiler_type_info.Test(eTypeIsScalar)) {
+            Error error;
+            root = root->Dereference(error);
+            if (error.Fail() || !root.get()) {
+              *first_unparsed = expression_cstr;
+              *reason_to_stop =
+                  ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
+              *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+              return ValueObjectSP();
+            } else {
+              *what_next = eExpressionPathAftermathNothing;
+              continue;
+            }
+          } else {
+            if (root->GetCompilerType().GetMinimumLanguage() ==
+                    eLanguageTypeObjC &&
+                pointee_compiler_type_info.AllClear(eTypeIsPointer) &&
+                root->HasSyntheticValue() &&
+                (options.m_synthetic_children_traversal ==
+                     GetValueForExpressionPathOptions::
+                         SyntheticChildrenTraversal::ToSynthetic ||
+                 options.m_synthetic_children_traversal ==
+                     GetValueForExpressionPathOptions::
+                         SyntheticChildrenTraversal::Both)) {
+              root = root->GetSyntheticValue()->GetChildAtIndex(index, true);
+            } else
+              root = root->GetSyntheticArrayMember(index, true);
+            if (!root.get()) {
+              *first_unparsed = expression_cstr;
+              *reason_to_stop =
+                  ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+              *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+              return ValueObjectSP();
+            } else {
+              *first_unparsed = end + 1; // skip ]
+              *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+              continue;
+            }
+          }
+        } else if (root_compiler_type_info.Test(eTypeIsScalar)) {
+          root = root->GetSyntheticBitFieldChild(index, index, true);
+          if (!root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          } else // we do not know how to expand members of bitfields, so we
+                 // just return and let the caller do any further processing
+          {
+            *first_unparsed = end + 1; // skip ]
+            *reason_to_stop = ValueObject::
+                eExpressionPathScanEndReasonBitfieldRangeOperatorMet;
+            *final_result = ValueObject::eExpressionPathEndResultTypeBitfield;
+            return root;
+          }
+        } else if (root_compiler_type_info.Test(eTypeIsVector)) {
+          root = root->GetChildAtIndex(index, true);
+          if (!root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          } else {
+            *first_unparsed = end + 1; // skip ]
+            *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+            continue;
+          }
+        } else if (options.m_synthetic_children_traversal ==
+                       GetValueForExpressionPathOptions::
+                           SyntheticChildrenTraversal::ToSynthetic ||
+                   options.m_synthetic_children_traversal ==
+                       GetValueForExpressionPathOptions::
+                           SyntheticChildrenTraversal::Both) {
+          if (root->HasSyntheticValue())
+            root = root->GetSyntheticValue();
+          else if (!root->IsSynthetic()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonSyntheticValueMissing;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          }
+          // if we are here, then root itself is a synthetic VO.. should be good
+          // to go
+
+          if (!root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonSyntheticValueMissing;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          }
+          root = root->GetChildAtIndex(index, true);
+          if (!root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          } else {
+            *first_unparsed = end + 1; // skip ]
+            *final_result = ValueObject::eExpressionPathEndResultTypePlain;
+            continue;
+          }
+        } else {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return ValueObjectSP();
+        }
+      } else // we have a low and a high index
+      {
+        char *end = NULL;
+        unsigned long index_lower = ::strtoul(expression_cstr + 1, &end, 0);
+        if (!end || end != separator_position) // if something weird is in our
+                                               // way return an error
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return ValueObjectSP();
+        }
+        unsigned long index_higher = ::strtoul(separator_position + 1, &end, 0);
+        if (!end || end != close_bracket_position) // if something weird is in
+                                                   // our way return an error
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return ValueObjectSP();
+        }
+        if (index_lower > index_higher) // swap indices if required
+        {
+          unsigned long temp = index_lower;
+          index_lower = index_higher;
+          index_higher = temp;
+        }
+        if (root_compiler_type_info.Test(
+                eTypeIsScalar)) // expansion only works for scalars
+        {
+          root =
+              root->GetSyntheticBitFieldChild(index_lower, index_higher, true);
+          if (!root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          } else {
+            *first_unparsed = end + 1; // skip ]
+            *reason_to_stop = ValueObject::
+                eExpressionPathScanEndReasonBitfieldRangeOperatorMet;
+            *final_result = ValueObject::eExpressionPathEndResultTypeBitfield;
+            return root;
+          }
+        } else if (root_compiler_type_info.Test(
+                       eTypeIsPointer) && // if this is a ptr-to-scalar, I am
+                                          // accessing it by index and I would
+                                          // have deref'ed anyway, then do it
+                                          // now and use this as a bitfield
+                   *what_next ==
+                       ValueObject::eExpressionPathAftermathDereference &&
+                   pointee_compiler_type_info.Test(eTypeIsScalar)) {
+          Error error;
+          root = root->Dereference(error);
+          if (error.Fail() || !root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return ValueObjectSP();
+          } else {
+            *what_next = ValueObject::eExpressionPathAftermathNothing;
+            continue;
+          }
+        } else {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
+          *final_result = ValueObject::eExpressionPathEndResultTypeBoundedRange;
+          return root;
+        }
+      }
+      break;
+    }
+    default: // some non-separator is in the way
+    {
+      *first_unparsed = expression_cstr;
+      *reason_to_stop =
+          ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+      *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+      return ValueObjectSP();
+      break;
+    }
+    }
+  }
+}
+
+int ValueObject::ExpandArraySliceExpression(
+    const char *expression_cstr, const char **first_unparsed,
+    ValueObjectSP root, ValueObjectListSP &list,
+    ExpressionPathScanEndReason *reason_to_stop,
+    ExpressionPathEndResultType *final_result,
+    const GetValueForExpressionPathOptions &options,
+    ExpressionPathAftermath *what_next) {
+  if (!root.get())
+    return 0;
+
+  *first_unparsed = expression_cstr;
+
+  while (true) {
+
+    const char *expression_cstr =
+        *first_unparsed; // hide the top level expression_cstr
 
-int
-ValueObject::ExpandArraySliceExpression(const char* expression_cstr,
-                                        const char** first_unparsed,
-                                        ValueObjectSP root,
-                                        ValueObjectListSP& list,
-                                        ExpressionPathScanEndReason* reason_to_stop,
-                                        ExpressionPathEndResultType* final_result,
-                                        const GetValueForExpressionPathOptions& options,
-                                        ExpressionPathAftermath* what_next)
-{
-    if (!root.get())
+    CompilerType root_compiler_type = root->GetCompilerType();
+    CompilerType pointee_compiler_type;
+    Flags pointee_compiler_type_info;
+    Flags root_compiler_type_info(
+        root_compiler_type.GetTypeInfo(&pointee_compiler_type));
+    if (pointee_compiler_type)
+      pointee_compiler_type_info.Reset(pointee_compiler_type.GetTypeInfo());
+
+    if (!expression_cstr || *expression_cstr == '\0') {
+      *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEndOfString;
+      list->Append(root);
+      return 1;
+    }
+
+    switch (*expression_cstr) {
+    case '[': {
+      if (!root_compiler_type_info.Test(eTypeIsArray) &&
+          !root_compiler_type_info.Test(
+              eTypeIsPointer)) // if this is not a T[] nor a T*
+      {
+        if (!root_compiler_type_info.Test(eTypeIsScalar)) // if this is not even
+                                                          // a scalar, this
+                                                          // syntax is just
+                                                          // plain wrong!
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonRangeOperatorInvalid;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return 0;
+        } else if (!options.m_allow_bitfields_syntax) // if this is a scalar,
+                                                      // check that we can
+                                                      // expand bitfields
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonRangeOperatorNotAllowed;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return 0;
+        }
+      }
+      if (*(expression_cstr + 1) ==
+          ']') // if this is an unbounded range it only works for arrays
+      {
+        if (!root_compiler_type_info.Test(eTypeIsArray)) {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return 0;
+        } else // expand this into list
+        {
+          const size_t max_index = root->GetNumChildren() - 1;
+          for (size_t index = 0; index < max_index; index++) {
+            ValueObjectSP child = root->GetChildAtIndex(index, true);
+            list->Append(child);
+          }
+          *first_unparsed = expression_cstr + 2;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
+          *final_result =
+              ValueObject::eExpressionPathEndResultTypeValueObjectList;
+          return max_index; // tell me number of items I added to the VOList
+        }
+      }
+      const char *separator_position = ::strchr(expression_cstr + 1, '-');
+      const char *close_bracket_position = ::strchr(expression_cstr + 1, ']');
+      if (!close_bracket_position) // if there is no ], this is a syntax error
+      {
+        *first_unparsed = expression_cstr;
+        *reason_to_stop =
+            ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
         return 0;
-    
-    *first_unparsed = expression_cstr;
-    
-    while (true)
-    {
-        
-        const char* expression_cstr = *first_unparsed; // hide the top level expression_cstr
-        
-        CompilerType root_compiler_type = root->GetCompilerType();
-        CompilerType pointee_compiler_type;
-        Flags pointee_compiler_type_info;
-        Flags root_compiler_type_info(root_compiler_type.GetTypeInfo(&pointee_compiler_type));
-        if (pointee_compiler_type)
-            pointee_compiler_type_info.Reset(pointee_compiler_type.GetTypeInfo());
-        
-        if (!expression_cstr || *expression_cstr == '\0')
-        {
-            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEndOfString;
+      }
+      if (!separator_position ||
+          separator_position > close_bracket_position) // if no separator, this
+                                                       // is either [] or [N]
+      {
+        char *end = NULL;
+        unsigned long index = ::strtoul(expression_cstr + 1, &end, 0);
+        if (!end || end != close_bracket_position) // if something weird is in
+                                                   // our way return an error
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return 0;
+        }
+        if (end - expression_cstr ==
+            1) // if this is [], only return a valid value for arrays
+        {
+          if (root_compiler_type_info.Test(eTypeIsArray)) {
+            const size_t max_index = root->GetNumChildren() - 1;
+            for (size_t index = 0; index < max_index; index++) {
+              ValueObjectSP child = root->GetChildAtIndex(index, true);
+              list->Append(child);
+            }
+            *first_unparsed = expression_cstr + 2;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
+            *final_result =
+                ValueObject::eExpressionPathEndResultTypeValueObjectList;
+            return max_index; // tell me number of items I added to the VOList
+          } else {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return 0;
+          }
+        }
+        // from here on we do have a valid index
+        if (root_compiler_type_info.Test(eTypeIsArray)) {
+          root = root->GetChildAtIndex(index, true);
+          if (!root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return 0;
+          } else {
             list->Append(root);
+            *first_unparsed = end + 1; // skip ]
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
+            *final_result =
+                ValueObject::eExpressionPathEndResultTypeValueObjectList;
             return 1;
+          }
+        } else if (root_compiler_type_info.Test(eTypeIsPointer)) {
+          if (*what_next ==
+                  ValueObject::
+                      eExpressionPathAftermathDereference && // if this is a
+                                                             // ptr-to-scalar, I
+                                                             // am accessing it
+                                                             // by index and I
+                                                             // would have
+                                                             // deref'ed anyway,
+                                                             // then do it now
+                                                             // and use this as
+                                                             // a bitfield
+              pointee_compiler_type_info.Test(eTypeIsScalar)) {
+            Error error;
+            root = root->Dereference(error);
+            if (error.Fail() || !root.get()) {
+              *first_unparsed = expression_cstr;
+              *reason_to_stop =
+                  ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
+              *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+              return 0;
+            } else {
+              *what_next = eExpressionPathAftermathNothing;
+              continue;
+            }
+          } else {
+            root = root->GetSyntheticArrayMember(index, true);
+            if (!root.get()) {
+              *first_unparsed = expression_cstr;
+              *reason_to_stop =
+                  ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+              *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+              return 0;
+            } else {
+              list->Append(root);
+              *first_unparsed = end + 1; // skip ]
+              *reason_to_stop = ValueObject::
+                  eExpressionPathScanEndReasonRangeOperatorExpanded;
+              *final_result =
+                  ValueObject::eExpressionPathEndResultTypeValueObjectList;
+              return 1;
+            }
+          }
+        } else /*if (ClangASTContext::IsScalarType(root_compiler_type))*/
+        {
+          root = root->GetSyntheticBitFieldChild(index, index, true);
+          if (!root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return 0;
+          } else // we do not know how to expand members of bitfields, so we
+                 // just return and let the caller do any further processing
+          {
+            list->Append(root);
+            *first_unparsed = end + 1; // skip ]
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
+            *final_result =
+                ValueObject::eExpressionPathEndResultTypeValueObjectList;
+            return 1;
+          }
         }
-        
-        switch (*expression_cstr)
-        {
-            case '[':
-            {
-                if (!root_compiler_type_info.Test(eTypeIsArray) && !root_compiler_type_info.Test(eTypeIsPointer)) // if this is not a T[] nor a T*
-                {
-                    if (!root_compiler_type_info.Test(eTypeIsScalar)) // if this is not even a scalar, this syntax is just plain wrong!
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorInvalid;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return 0;
-                    }
-                    else if (!options.m_allow_bitfields_syntax) // if this is a scalar, check that we can expand bitfields
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorNotAllowed;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return 0;
-                    }
-                }
-                if (*(expression_cstr+1) == ']') // if this is an unbounded range it only works for arrays
-                {
-                    if (!root_compiler_type_info.Test(eTypeIsArray))
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return 0;
-                    }
-                    else // expand this into list
-                    {
-                        const size_t max_index = root->GetNumChildren() - 1;
-                        for (size_t index = 0; index < max_index; index++)
-                        {
-                            ValueObjectSP child = 
-                                root->GetChildAtIndex(index, true);
-                            list->Append(child);
-                        }
-                        *first_unparsed = expression_cstr+2;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeValueObjectList;
-                        return max_index; // tell me number of items I added to the VOList
-                    }
-                }
-                const char *separator_position = ::strchr(expression_cstr+1,'-');
-                const char *close_bracket_position = ::strchr(expression_cstr+1,']');
-                if (!close_bracket_position) // if there is no ], this is a syntax error
-                {
-                    *first_unparsed = expression_cstr;
-                    *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                    *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                    return 0;
-                }
-                if (!separator_position || separator_position > close_bracket_position) // if no separator, this is either [] or [N]
-                {
-                    char *end = NULL;
-                    unsigned long index = ::strtoul (expression_cstr+1, &end, 0);
-                    if (!end || end != close_bracket_position) // if something weird is in our way return an error
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return 0;
-                    }
-                    if (end - expression_cstr == 1) // if this is [], only return a valid value for arrays
-                    {
-                        if (root_compiler_type_info.Test(eTypeIsArray))
-                        {
-                            const size_t max_index = root->GetNumChildren() - 1;
-                            for (size_t index = 0; index < max_index; index++)
-                            {
-                                ValueObjectSP child = 
-                                root->GetChildAtIndex(index, true);
-                                list->Append(child);
-                            }
-                            *first_unparsed = expression_cstr+2;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeValueObjectList;
-                            return max_index; // tell me number of items I added to the VOList
-                        }
-                        else
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return 0;
-                        }
-                    }
-                    // from here on we do have a valid index
-                    if (root_compiler_type_info.Test(eTypeIsArray))
-                    {
-                        root = root->GetChildAtIndex(index, true);
-                        if (!root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return 0;
-                        }
-                        else
-                        {
-                            list->Append(root);
-                            *first_unparsed = end+1; // skip ]
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeValueObjectList;
-                            return 1;
-                        }
-                    }
-                    else if (root_compiler_type_info.Test(eTypeIsPointer))
-                    {
-                        if (*what_next == ValueObject::eExpressionPathAftermathDereference &&  // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
-                            pointee_compiler_type_info.Test(eTypeIsScalar))
-                        {
-                            Error error;
-                            root = root->Dereference(error);
-                            if (error.Fail() || !root.get())
-                            {
-                                *first_unparsed = expression_cstr;
-                                *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
-                                *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                                return 0;
-                            }
-                            else
-                            {
-                                *what_next = eExpressionPathAftermathNothing;
-                                continue;
-                            }
-                        }
-                        else
-                        {
-                            root = root->GetSyntheticArrayMember(index, true);
-                            if (!root.get())
-                            {
-                                *first_unparsed = expression_cstr;
-                                *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                                *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                                return 0;
-                            }
-                            else
-                            {
-                                list->Append(root);
-                                *first_unparsed = end+1; // skip ]
-                                *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
-                                *final_result = ValueObject::eExpressionPathEndResultTypeValueObjectList;
-                                return 1;
-                            }
-                        }
-                    }
-                    else /*if (ClangASTContext::IsScalarType(root_compiler_type))*/
-                    {
-                        root = root->GetSyntheticBitFieldChild(index, index, true);
-                        if (!root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return 0;
-                        }
-                        else // we do not know how to expand members of bitfields, so we just return and let the caller do any further processing
-                        {
-                            list->Append(root);
-                            *first_unparsed = end+1; // skip ]
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeValueObjectList;
-                            return 1;
-                        }
-                    }
-                }
-                else // we have a low and a high index
-                {
-                    char *end = NULL;
-                    unsigned long index_lower = ::strtoul (expression_cstr+1, &end, 0);
-                    if (!end || end != separator_position) // if something weird is in our way return an error
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return 0;
-                    }
-                    unsigned long index_higher = ::strtoul (separator_position+1, &end, 0);
-                    if (!end || end != close_bracket_position) // if something weird is in our way return an error
-                    {
-                        *first_unparsed = expression_cstr;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                        return 0;
-                    }
-                    if (index_lower > index_higher) // swap indices if required
-                    {
-                        unsigned long temp = index_lower;
-                        index_lower = index_higher;
-                        index_higher = temp;
-                    }
-                    if (root_compiler_type_info.Test(eTypeIsScalar)) // expansion only works for scalars
-                    {
-                        root = root->GetSyntheticBitFieldChild(index_lower, index_higher, true);
-                        if (!root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonNoSuchChild;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return 0;
-                        }
-                        else
-                        {
-                            list->Append(root);
-                            *first_unparsed = end+1; // skip ]
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeValueObjectList;
-                            return 1;
-                        }
-                    }
-                    else if (root_compiler_type_info.Test(eTypeIsPointer) && // if this is a ptr-to-scalar, I am accessing it by index and I would have deref'ed anyway, then do it now and use this as a bitfield
-                             *what_next == ValueObject::eExpressionPathAftermathDereference &&
-                             pointee_compiler_type_info.Test(eTypeIsScalar))
-                    {
-                        Error error;
-                        root = root->Dereference(error);
-                        if (error.Fail() || !root.get())
-                        {
-                            *first_unparsed = expression_cstr;
-                            *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
-                            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                            return 0;
-                        }
-                        else
-                        {
-                            *what_next = ValueObject::eExpressionPathAftermathNothing;
-                            continue;
-                        }
-                    }
-                    else
-                    {
-                        for (unsigned long index = index_lower;
-                             index <= index_higher; index++)
-                        {
-                            ValueObjectSP child = 
-                                root->GetChildAtIndex(index, true);
-                            list->Append(child);
-                        }
-                        *first_unparsed = end+1;
-                        *reason_to_stop = ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
-                        *final_result = ValueObject::eExpressionPathEndResultTypeValueObjectList;
-                        return index_higher-index_lower+1; // tell me number of items I added to the VOList
-                    }
-                }
-                break;
-            }
-            default: // some non-[ separator, or something entirely wrong, is in the way
-            {
-                *first_unparsed = expression_cstr;
-                *reason_to_stop = ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
-                *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
-                return 0;
-                break;
-            }
-        }
-    }
-}
-
-void
-ValueObject::LogValueObject (Log *log)
-{
-    if (log)
-        return LogValueObject (log, DumpValueObjectOptions(*this));
-}
-
-void
-ValueObject::LogValueObject (Log *log, const DumpValueObjectOptions& options)
-{
-    if (log)
-    {
-        StreamString s;
-        Dump (s, options);
-        if (s.GetSize())
-            log->PutCString(s.GetData());
-    }
-}
-
-void
-ValueObject::Dump (Stream &s)
-{
-    Dump (s, DumpValueObjectOptions(*this));
+      } else // we have a low and a high index
+      {
+        char *end = NULL;
+        unsigned long index_lower = ::strtoul(expression_cstr + 1, &end, 0);
+        if (!end || end != separator_position) // if something weird is in our
+                                               // way return an error
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return 0;
+        }
+        unsigned long index_higher = ::strtoul(separator_position + 1, &end, 0);
+        if (!end || end != close_bracket_position) // if something weird is in
+                                                   // our way return an error
+        {
+          *first_unparsed = expression_cstr;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+          *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+          return 0;
+        }
+        if (index_lower > index_higher) // swap indices if required
+        {
+          unsigned long temp = index_lower;
+          index_lower = index_higher;
+          index_higher = temp;
+        }
+        if (root_compiler_type_info.Test(
+                eTypeIsScalar)) // expansion only works for scalars
+        {
+          root =
+              root->GetSyntheticBitFieldChild(index_lower, index_higher, true);
+          if (!root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonNoSuchChild;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return 0;
+          } else {
+            list->Append(root);
+            *first_unparsed = end + 1; // skip ]
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
+            *final_result =
+                ValueObject::eExpressionPathEndResultTypeValueObjectList;
+            return 1;
+          }
+        } else if (root_compiler_type_info.Test(
+                       eTypeIsPointer) && // if this is a ptr-to-scalar, I am
+                                          // accessing it by index and I would
+                                          // have deref'ed anyway, then do it
+                                          // now and use this as a bitfield
+                   *what_next ==
+                       ValueObject::eExpressionPathAftermathDereference &&
+                   pointee_compiler_type_info.Test(eTypeIsScalar)) {
+          Error error;
+          root = root->Dereference(error);
+          if (error.Fail() || !root.get()) {
+            *first_unparsed = expression_cstr;
+            *reason_to_stop =
+                ValueObject::eExpressionPathScanEndReasonDereferencingFailed;
+            *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+            return 0;
+          } else {
+            *what_next = ValueObject::eExpressionPathAftermathNothing;
+            continue;
+          }
+        } else {
+          for (unsigned long index = index_lower; index <= index_higher;
+               index++) {
+            ValueObjectSP child = root->GetChildAtIndex(index, true);
+            list->Append(child);
+          }
+          *first_unparsed = end + 1;
+          *reason_to_stop =
+              ValueObject::eExpressionPathScanEndReasonRangeOperatorExpanded;
+          *final_result =
+              ValueObject::eExpressionPathEndResultTypeValueObjectList;
+          return index_higher - index_lower +
+                 1; // tell me number of items I added to the VOList
+        }
+      }
+      break;
+    }
+    default: // some non-[ separator, or something entirely wrong, is in the way
+    {
+      *first_unparsed = expression_cstr;
+      *reason_to_stop =
+          ValueObject::eExpressionPathScanEndReasonUnexpectedSymbol;
+      *final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
+      return 0;
+      break;
+    }
+    }
+  }
+}
+
+void ValueObject::LogValueObject(Log *log) {
+  if (log)
+    return LogValueObject(log, DumpValueObjectOptions(*this));
+}
+
+void ValueObject::LogValueObject(Log *log,
+                                 const DumpValueObjectOptions &options) {
+  if (log) {
+    StreamString s;
+    Dump(s, options);
+    if (s.GetSize())
+      log->PutCString(s.GetData());
+  }
 }
 
-void
-ValueObject::Dump (Stream &s,
-                   const DumpValueObjectOptions& options)
-{
-    ValueObjectPrinter printer(this,&s,options);
-    printer.PrintValueObject();
-}
+void ValueObject::Dump(Stream &s) { Dump(s, DumpValueObjectOptions(*this)); }
 
-ValueObjectSP
-ValueObject::CreateConstantValue (const ConstString &name)
-{
-    ValueObjectSP valobj_sp;
-    
-    if (UpdateValueIfNeeded(false) && m_error.Success())
-    {
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        
-        DataExtractor data;
-        data.SetByteOrder (m_data.GetByteOrder());
-        data.SetAddressByteSize(m_data.GetAddressByteSize());
-        
-        if (IsBitfield())
-        {
-            Value v(Scalar(GetValueAsUnsigned(UINT64_MAX)));
-            m_error = v.GetValueAsData (&exe_ctx, data, 0, GetModule().get());
-        }
-        else
-            m_error = m_value.GetValueAsData (&exe_ctx, data, 0, GetModule().get());
-        
-        valobj_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), 
-                                                    GetCompilerType(),
-                                                    name,
-                                                    data,
-                                                    GetAddressOf());
-    }
-    
-    if (!valobj_sp)
-    {
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        valobj_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(), m_error);
-    }
-    return valobj_sp;
+void ValueObject::Dump(Stream &s, const DumpValueObjectOptions &options) {
+  ValueObjectPrinter printer(this, &s, options);
+  printer.PrintValueObject();
 }
 
-ValueObjectSP
-ValueObject::GetQualifiedRepresentationIfAvailable (lldb::DynamicValueType dynValue,
-                                                    bool synthValue)
-{
-    ValueObjectSP result_sp(GetSP());
-    
-    switch (dynValue)
-    {
-        case lldb::eDynamicCanRunTarget:
-        case lldb::eDynamicDontRunTarget:
-        {
-            if (!result_sp->IsDynamic())
-            {
-                if (result_sp->GetDynamicValue(dynValue))
-                    result_sp = result_sp->GetDynamicValue(dynValue);
-            }
-        }
-            break;
-        case lldb::eNoDynamicValues:
-        {
-            if (result_sp->IsDynamic())
-            {
-                if (result_sp->GetStaticValue())
-                    result_sp = result_sp->GetStaticValue();
-            }
-        }
-            break;
-    }
-    
-    if (synthValue)
-    {
-        if (!result_sp->IsSynthetic())
-        {
-            if (result_sp->GetSyntheticValue())
-                result_sp = result_sp->GetSyntheticValue();
-        }
-    }
-    else
-    {
-        if (result_sp->IsSynthetic())
-        {
-            if (result_sp->GetNonSyntheticValue())
-                result_sp = result_sp->GetNonSyntheticValue();
-        }
-    }
-    
-    return result_sp;
-}
+ValueObjectSP ValueObject::CreateConstantValue(const ConstString &name) {
+  ValueObjectSP valobj_sp;
 
-lldb::addr_t
-ValueObject::GetCPPVTableAddress (AddressType &address_type)
-{
-    CompilerType pointee_type;
-    CompilerType this_type(GetCompilerType());
-    uint32_t type_info = this_type.GetTypeInfo(&pointee_type);
-    if (type_info)
-    {
-        bool ptr_or_ref = false;
-        if (type_info & (eTypeIsPointer | eTypeIsReference))
-        {
-            ptr_or_ref = true;
-            type_info = pointee_type.GetTypeInfo();
-        }
-        
-        const uint32_t cpp_class = eTypeIsClass | eTypeIsCPlusPlus;
-        if ((type_info & cpp_class) == cpp_class)
-        {
-            if (ptr_or_ref)
-            {
-                address_type = GetAddressTypeOfChildren();
-                return GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
-            }
-            else
-                return GetAddressOf (false, &address_type);
-        }
-    }
+  if (UpdateValueIfNeeded(false) && m_error.Success()) {
+    ExecutionContext exe_ctx(GetExecutionContextRef());
 
-    address_type = eAddressTypeInvalid;
-    return LLDB_INVALID_ADDRESS;
-}
+    DataExtractor data;
+    data.SetByteOrder(m_data.GetByteOrder());
+    data.SetAddressByteSize(m_data.GetAddressByteSize());
 
-ValueObjectSP
-ValueObject::Dereference (Error &error)
-{
-    if (m_deref_valobj)
-        return m_deref_valobj->GetSP();
+    if (IsBitfield()) {
+      Value v(Scalar(GetValueAsUnsigned(UINT64_MAX)));
+      m_error = v.GetValueAsData(&exe_ctx, data, 0, GetModule().get());
+    } else
+      m_error = m_value.GetValueAsData(&exe_ctx, data, 0, GetModule().get());
+
+    valobj_sp = ValueObjectConstResult::Create(
+        exe_ctx.GetBestExecutionContextScope(), GetCompilerType(), name, data,
+        GetAddressOf());
+  }
+
+  if (!valobj_sp) {
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    valobj_sp = ValueObjectConstResult::Create(
+        exe_ctx.GetBestExecutionContextScope(), m_error);
+  }
+  return valobj_sp;
+}
+
+ValueObjectSP ValueObject::GetQualifiedRepresentationIfAvailable(
+    lldb::DynamicValueType dynValue, bool synthValue) {
+  ValueObjectSP result_sp(GetSP());
+
+  switch (dynValue) {
+  case lldb::eDynamicCanRunTarget:
+  case lldb::eDynamicDontRunTarget: {
+    if (!result_sp->IsDynamic()) {
+      if (result_sp->GetDynamicValue(dynValue))
+        result_sp = result_sp->GetDynamicValue(dynValue);
+    }
+  } break;
+  case lldb::eNoDynamicValues: {
+    if (result_sp->IsDynamic()) {
+      if (result_sp->GetStaticValue())
+        result_sp = result_sp->GetStaticValue();
+    }
+  } break;
+  }
+
+  if (synthValue) {
+    if (!result_sp->IsSynthetic()) {
+      if (result_sp->GetSyntheticValue())
+        result_sp = result_sp->GetSyntheticValue();
+    }
+  } else {
+    if (result_sp->IsSynthetic()) {
+      if (result_sp->GetNonSyntheticValue())
+        result_sp = result_sp->GetNonSyntheticValue();
+    }
+  }
+
+  return result_sp;
+}
+
+lldb::addr_t ValueObject::GetCPPVTableAddress(AddressType &address_type) {
+  CompilerType pointee_type;
+  CompilerType this_type(GetCompilerType());
+  uint32_t type_info = this_type.GetTypeInfo(&pointee_type);
+  if (type_info) {
+    bool ptr_or_ref = false;
+    if (type_info & (eTypeIsPointer | eTypeIsReference)) {
+      ptr_or_ref = true;
+      type_info = pointee_type.GetTypeInfo();
+    }
+
+    const uint32_t cpp_class = eTypeIsClass | eTypeIsCPlusPlus;
+    if ((type_info & cpp_class) == cpp_class) {
+      if (ptr_or_ref) {
+        address_type = GetAddressTypeOfChildren();
+        return GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
+      } else
+        return GetAddressOf(false, &address_type);
+    }
+  }
+
+  address_type = eAddressTypeInvalid;
+  return LLDB_INVALID_ADDRESS;
+}
+
+ValueObjectSP ValueObject::Dereference(Error &error) {
+  if (m_deref_valobj)
+    return m_deref_valobj->GetSP();
 
-    const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
-    if (is_pointer_or_reference_type)
-    {
-        bool omit_empty_base_classes = true;
-        bool ignore_array_bounds = false;
+  const bool is_pointer_or_reference_type = IsPointerOrReferenceType();
+  if (is_pointer_or_reference_type) {
+    bool omit_empty_base_classes = true;
+    bool ignore_array_bounds = false;
 
-        std::string child_name_str;
-        uint32_t child_byte_size = 0;
-        int32_t child_byte_offset = 0;
-        uint32_t child_bitfield_bit_size = 0;
-        uint32_t child_bitfield_bit_offset = 0;
-        bool child_is_base_class = false;
-        bool child_is_deref_of_parent = false;
-        const bool transparent_pointers = false;
-        CompilerType compiler_type = GetCompilerType();
-        CompilerType child_compiler_type;
-        uint64_t language_flags;
-
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-
-        child_compiler_type = compiler_type.GetChildCompilerTypeAtIndex (&exe_ctx,
-                                                                         0,
-                                                                         transparent_pointers,
-                                                                         omit_empty_base_classes,
-                                                                         ignore_array_bounds,
-                                                                         child_name_str,
-                                                                         child_byte_size,
-                                                                         child_byte_offset,
-                                                                         child_bitfield_bit_size,
-                                                                         child_bitfield_bit_offset,
-                                                                         child_is_base_class,
-                                                                         child_is_deref_of_parent,
-                                                                         this,
-                                                                         language_flags);
-        if (child_compiler_type && child_byte_size)
-        {
-            ConstString child_name;
-            if (!child_name_str.empty())
-                child_name.SetCString (child_name_str.c_str());
-
-            m_deref_valobj = new ValueObjectChild (*this,
-                                                   child_compiler_type,
-                                                   child_name,
-                                                   child_byte_size,
-                                                   child_byte_offset,
-                                                   child_bitfield_bit_size,
-                                                   child_bitfield_bit_offset,
-                                                   child_is_base_class,
-                                                   child_is_deref_of_parent,
-                                                   eAddressTypeInvalid,
-                                                   language_flags);
-        }
-    }
+    std::string child_name_str;
+    uint32_t child_byte_size = 0;
+    int32_t child_byte_offset = 0;
+    uint32_t child_bitfield_bit_size = 0;
+    uint32_t child_bitfield_bit_offset = 0;
+    bool child_is_base_class = false;
+    bool child_is_deref_of_parent = false;
+    const bool transparent_pointers = false;
+    CompilerType compiler_type = GetCompilerType();
+    CompilerType child_compiler_type;
+    uint64_t language_flags;
 
-    if (m_deref_valobj)
-    {
-        error.Clear();
-        return m_deref_valobj->GetSP();
-    }
-    else
-    {
-        StreamString strm;
-        GetExpressionPath(strm, true);
+    ExecutionContext exe_ctx(GetExecutionContextRef());
 
-        if (is_pointer_or_reference_type)
-            error.SetErrorStringWithFormat("dereference failed: (%s) %s", GetTypeName().AsCString("<invalid type>"), strm.GetString().c_str());
-        else
-            error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s", GetTypeName().AsCString("<invalid type>"), strm.GetString().c_str());
-        return ValueObjectSP();
+    child_compiler_type = compiler_type.GetChildCompilerTypeAtIndex(
+        &exe_ctx, 0, transparent_pointers, omit_empty_base_classes,
+        ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
+        child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
+        child_is_deref_of_parent, this, language_flags);
+    if (child_compiler_type && child_byte_size) {
+      ConstString child_name;
+      if (!child_name_str.empty())
+        child_name.SetCString(child_name_str.c_str());
+
+      m_deref_valobj = new ValueObjectChild(
+          *this, child_compiler_type, child_name, child_byte_size,
+          child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
+          child_is_base_class, child_is_deref_of_parent, eAddressTypeInvalid,
+          language_flags);
     }
-}
+  }
 
-ValueObjectSP
-ValueObject::AddressOf (Error &error)
-{
-    if (m_addr_of_valobj_sp)
-        return m_addr_of_valobj_sp;
-        
-    AddressType address_type = eAddressTypeInvalid;
-    const bool scalar_is_load_address = false;
-    addr_t addr = GetAddressOf (scalar_is_load_address, &address_type);
+  if (m_deref_valobj) {
     error.Clear();
-    if (addr != LLDB_INVALID_ADDRESS && address_type != eAddressTypeHost)
-    {
-        switch (address_type)
-        {
-        case eAddressTypeInvalid:
-            {
-                StreamString expr_path_strm;
-                GetExpressionPath(expr_path_strm, true);
-                error.SetErrorStringWithFormat("'%s' is not in memory", expr_path_strm.GetString().c_str());
-            }
-            break;
+    return m_deref_valobj->GetSP();
+  } else {
+    StreamString strm;
+    GetExpressionPath(strm, true);
 
-        case eAddressTypeFile:
-        case eAddressTypeLoad:
-            {
-                CompilerType compiler_type = GetCompilerType();
-                if (compiler_type)
-                {
-                    std::string name (1, '&');
-                    name.append (m_name.AsCString(""));
-                    ExecutionContext exe_ctx (GetExecutionContextRef());
-                    m_addr_of_valobj_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                                          compiler_type.GetPointerType(),
-                                                                          ConstString (name.c_str()),
-                                                                          addr, 
-                                                                          eAddressTypeInvalid,
-                                                                          m_data.GetAddressByteSize());
-                }
-            }
-            break;
-        default:
-            break;
-        }
-    }
+    if (is_pointer_or_reference_type)
+      error.SetErrorStringWithFormat("dereference failed: (%s) %s",
+                                     GetTypeName().AsCString("<invalid type>"),
+                                     strm.GetString().c_str());
     else
-    {
-        StreamString expr_path_strm;
-        GetExpressionPath(expr_path_strm, true);
-        error.SetErrorStringWithFormat("'%s' doesn't have a valid address", expr_path_strm.GetString().c_str());
-    }
-    
-    return m_addr_of_valobj_sp;
+      error.SetErrorStringWithFormat("not a pointer or reference type: (%s) %s",
+                                     GetTypeName().AsCString("<invalid type>"),
+                                     strm.GetString().c_str());
+    return ValueObjectSP();
+  }
 }
 
-ValueObjectSP
-ValueObject::Cast (const CompilerType &compiler_type)
-{
-    return ValueObjectCast::Create (*this, GetName(), compiler_type);
-}
+ValueObjectSP ValueObject::AddressOf(Error &error) {
+  if (m_addr_of_valobj_sp)
+    return m_addr_of_valobj_sp;
 
-ValueObjectSP
-ValueObject::CastPointerType (const char *name, CompilerType &compiler_type)
-{
-    ValueObjectSP valobj_sp;
-    AddressType address_type;
-    addr_t ptr_value = GetPointerValue (&address_type);
-    
-    if (ptr_value != LLDB_INVALID_ADDRESS)
-    {
-        Address ptr_addr (ptr_value);
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        valobj_sp = ValueObjectMemory::Create (exe_ctx.GetBestExecutionContextScope(),
-                                               name, 
-                                               ptr_addr, 
-                                               compiler_type);
-    }
-    return valobj_sp;    
-}
+  AddressType address_type = eAddressTypeInvalid;
+  const bool scalar_is_load_address = false;
+  addr_t addr = GetAddressOf(scalar_is_load_address, &address_type);
+  error.Clear();
+  if (addr != LLDB_INVALID_ADDRESS && address_type != eAddressTypeHost) {
+    switch (address_type) {
+    case eAddressTypeInvalid: {
+      StreamString expr_path_strm;
+      GetExpressionPath(expr_path_strm, true);
+      error.SetErrorStringWithFormat("'%s' is not in memory",
+                                     expr_path_strm.GetString().c_str());
+    } break;
+
+    case eAddressTypeFile:
+    case eAddressTypeLoad: {
+      CompilerType compiler_type = GetCompilerType();
+      if (compiler_type) {
+        std::string name(1, '&');
+        name.append(m_name.AsCString(""));
+        ExecutionContext exe_ctx(GetExecutionContextRef());
+        m_addr_of_valobj_sp = ValueObjectConstResult::Create(
+            exe_ctx.GetBestExecutionContextScope(),
+            compiler_type.GetPointerType(), ConstString(name.c_str()), addr,
+            eAddressTypeInvalid, m_data.GetAddressByteSize());
+      }
+    } break;
+    default:
+      break;
+    }
+  } else {
+    StreamString expr_path_strm;
+    GetExpressionPath(expr_path_strm, true);
+    error.SetErrorStringWithFormat("'%s' doesn't have a valid address",
+                                   expr_path_strm.GetString().c_str());
+  }
+
+  return m_addr_of_valobj_sp;
+}
+
+ValueObjectSP ValueObject::Cast(const CompilerType &compiler_type) {
+  return ValueObjectCast::Create(*this, GetName(), compiler_type);
+}
+
+ValueObjectSP ValueObject::CastPointerType(const char *name,
+                                           CompilerType &compiler_type) {
+  ValueObjectSP valobj_sp;
+  AddressType address_type;
+  addr_t ptr_value = GetPointerValue(&address_type);
+
+  if (ptr_value != LLDB_INVALID_ADDRESS) {
+    Address ptr_addr(ptr_value);
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    valobj_sp = ValueObjectMemory::Create(
+        exe_ctx.GetBestExecutionContextScope(), name, ptr_addr, compiler_type);
+  }
+  return valobj_sp;
+}
+
+ValueObjectSP ValueObject::CastPointerType(const char *name, TypeSP &type_sp) {
+  ValueObjectSP valobj_sp;
+  AddressType address_type;
+  addr_t ptr_value = GetPointerValue(&address_type);
+
+  if (ptr_value != LLDB_INVALID_ADDRESS) {
+    Address ptr_addr(ptr_value);
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    valobj_sp = ValueObjectMemory::Create(
+        exe_ctx.GetBestExecutionContextScope(), name, ptr_addr, type_sp);
+  }
+  return valobj_sp;
+}
+
+ValueObject::EvaluationPoint::EvaluationPoint()
+    : m_mod_id(), m_exe_ctx_ref(), m_needs_update(true) {}
+
+ValueObject::EvaluationPoint::EvaluationPoint(ExecutionContextScope *exe_scope,
+                                              bool use_selected)
+    : m_mod_id(), m_exe_ctx_ref(), m_needs_update(true) {
+  ExecutionContext exe_ctx(exe_scope);
+  TargetSP target_sp(exe_ctx.GetTargetSP());
+  if (target_sp) {
+    m_exe_ctx_ref.SetTargetSP(target_sp);
+    ProcessSP process_sp(exe_ctx.GetProcessSP());
+    if (!process_sp)
+      process_sp = target_sp->GetProcessSP();
+
+    if (process_sp) {
+      m_mod_id = process_sp->GetModID();
+      m_exe_ctx_ref.SetProcessSP(process_sp);
+
+      ThreadSP thread_sp(exe_ctx.GetThreadSP());
+
+      if (!thread_sp) {
+        if (use_selected)
+          thread_sp = process_sp->GetThreadList().GetSelectedThread();
+      }
+
+      if (thread_sp) {
+        m_exe_ctx_ref.SetThreadSP(thread_sp);
+
+        StackFrameSP frame_sp(exe_ctx.GetFrameSP());
+        if (!frame_sp) {
+          if (use_selected)
+            frame_sp = thread_sp->GetSelectedFrame();
+        }
+        if (frame_sp)
+          m_exe_ctx_ref.SetFrameSP(frame_sp);
+      }
+    }
+  }
+}
+
+ValueObject::EvaluationPoint::EvaluationPoint(
+    const ValueObject::EvaluationPoint &rhs)
+    : m_mod_id(), m_exe_ctx_ref(rhs.m_exe_ctx_ref), m_needs_update(true) {}
+
+ValueObject::EvaluationPoint::~EvaluationPoint() {}
+
+// This function checks the EvaluationPoint against the current process state.
+// If the current
+// state matches the evaluation point, or the evaluation point is already
+// invalid, then we return
+// false, meaning "no change".  If the current state is different, we update our
+// state, and return
+// true meaning "yes, change".  If we did see a change, we also set
+// m_needs_update to true, so
+// future calls to NeedsUpdate will return true.
+// exe_scope will be set to the current execution context scope.
 
-ValueObjectSP
-ValueObject::CastPointerType (const char *name, TypeSP &type_sp)
-{
-    ValueObjectSP valobj_sp;
-    AddressType address_type;
-    addr_t ptr_value = GetPointerValue (&address_type);
-    
-    if (ptr_value != LLDB_INVALID_ADDRESS)
-    {
-        Address ptr_addr (ptr_value);
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        valobj_sp = ValueObjectMemory::Create (exe_ctx.GetBestExecutionContextScope(),
-                                               name, 
-                                               ptr_addr, 
-                                               type_sp);
-    }
-    return valobj_sp;
-}
-
-ValueObject::EvaluationPoint::EvaluationPoint () :
-    m_mod_id(),
-    m_exe_ctx_ref(),
-    m_needs_update (true)
-{
-}
-
-ValueObject::EvaluationPoint::EvaluationPoint (ExecutionContextScope *exe_scope, bool use_selected):
-    m_mod_id(),
-    m_exe_ctx_ref(),
-    m_needs_update (true)
-{
-    ExecutionContext exe_ctx(exe_scope);
-    TargetSP target_sp (exe_ctx.GetTargetSP());
-    if (target_sp)
-    {
-        m_exe_ctx_ref.SetTargetSP (target_sp);
-        ProcessSP process_sp (exe_ctx.GetProcessSP());
-        if (!process_sp)
-            process_sp = target_sp->GetProcessSP();
-        
-        if (process_sp)
-        {
-            m_mod_id = process_sp->GetModID();
-            m_exe_ctx_ref.SetProcessSP (process_sp);
-            
-            ThreadSP thread_sp (exe_ctx.GetThreadSP());
-            
-            if (!thread_sp)
-            {
-                if (use_selected)
-                    thread_sp = process_sp->GetThreadList().GetSelectedThread();
-            }
-                
-            if (thread_sp)
-            {
-                m_exe_ctx_ref.SetThreadSP(thread_sp);
-                
-                StackFrameSP frame_sp (exe_ctx.GetFrameSP());
-                if (!frame_sp)
-                {
-                    if (use_selected)
-                        frame_sp = thread_sp->GetSelectedFrame();
-                }
-                if (frame_sp)
-                    m_exe_ctx_ref.SetFrameSP(frame_sp);
-            }
-        }
-    }
-}
+bool ValueObject::EvaluationPoint::SyncWithProcessState(
+    bool accept_invalid_exe_ctx) {
+  // Start with the target, if it is NULL, then we're obviously not going to get
+  // any further:
+  const bool thread_and_frame_only_if_stopped = true;
+  ExecutionContext exe_ctx(
+      m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
 
-ValueObject::EvaluationPoint::EvaluationPoint (const ValueObject::EvaluationPoint &rhs) :
-    m_mod_id(),
-    m_exe_ctx_ref(rhs.m_exe_ctx_ref),
-    m_needs_update (true)
-{
-}
+  if (exe_ctx.GetTargetPtr() == NULL)
+    return false;
 
-ValueObject::EvaluationPoint::~EvaluationPoint () 
-{
-}
+  // If we don't have a process nothing can change.
+  Process *process = exe_ctx.GetProcessPtr();
+  if (process == NULL)
+    return false;
 
-// This function checks the EvaluationPoint against the current process state.  If the current
-// state matches the evaluation point, or the evaluation point is already invalid, then we return
-// false, meaning "no change".  If the current state is different, we update our state, and return
-// true meaning "yes, change".  If we did see a change, we also set m_needs_update to true, so 
-// future calls to NeedsUpdate will return true.
-// exe_scope will be set to the current execution context scope.
+  // If our stop id is the current stop ID, nothing has changed:
+  ProcessModID current_mod_id = process->GetModID();
 
-bool
-ValueObject::EvaluationPoint::SyncWithProcessState(bool accept_invalid_exe_ctx)
-{
-    // Start with the target, if it is NULL, then we're obviously not going to get any further:
-    const bool thread_and_frame_only_if_stopped = true;
-    ExecutionContext exe_ctx(m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
-    
-    if (exe_ctx.GetTargetPtr() == NULL)
-        return false;
-    
-    // If we don't have a process nothing can change.
-    Process *process = exe_ctx.GetProcessPtr();
-    if (process == NULL)
-        return false;
-        
-    // If our stop id is the current stop ID, nothing has changed:
-    ProcessModID current_mod_id = process->GetModID();
-    
-    // If the current stop id is 0, either we haven't run yet, or the process state has been cleared.
-    // In either case, we aren't going to be able to sync with the process state.
-    if (current_mod_id.GetStopID() == 0)
-        return false;
-    
-    bool changed = false;
-    const bool was_valid = m_mod_id.IsValid();
-    if (was_valid)
-    {
-        if (m_mod_id == current_mod_id)
-        {
-            // Everything is already up to date in this object, no need to 
-            // update the execution context scope.
-            changed = false;
-        }
-        else
-        {
-            m_mod_id = current_mod_id;
-            m_needs_update = true;
-            changed = true;
-        }       
-    }
-    
-    // Now re-look up the thread and frame in case the underlying objects have gone away & been recreated.
-    // That way we'll be sure to return a valid exe_scope.
-    // If we used to have a thread or a frame but can't find it anymore, then mark ourselves as invalid.
-    
-    if (!accept_invalid_exe_ctx)
-    {
-        if (m_exe_ctx_ref.HasThreadRef())
-        {
-            ThreadSP thread_sp (m_exe_ctx_ref.GetThreadSP());
-            if (thread_sp)
-            {
-                if (m_exe_ctx_ref.HasFrameRef())
-                {
-                    StackFrameSP frame_sp (m_exe_ctx_ref.GetFrameSP());
-                    if (!frame_sp)
-                    {
-                        // We used to have a frame, but now it is gone
-                        SetInvalid();
-                        changed = was_valid;
-                    }
-                }
-            }
-            else
-            {
-                // We used to have a thread, but now it is gone
-                SetInvalid();
-                changed = was_valid;
-            }
-        }
-    }
+  // If the current stop id is 0, either we haven't run yet, or the process
+  // state has been cleared.
+  // In either case, we aren't going to be able to sync with the process state.
+  if (current_mod_id.GetStopID() == 0)
+    return false;
 
-    return changed;
-}
+  bool changed = false;
+  const bool was_valid = m_mod_id.IsValid();
+  if (was_valid) {
+    if (m_mod_id == current_mod_id) {
+      // Everything is already up to date in this object, no need to
+      // update the execution context scope.
+      changed = false;
+    } else {
+      m_mod_id = current_mod_id;
+      m_needs_update = true;
+      changed = true;
+    }
+  }
+
+  // Now re-look up the thread and frame in case the underlying objects have
+  // gone away & been recreated.
+  // That way we'll be sure to return a valid exe_scope.
+  // If we used to have a thread or a frame but can't find it anymore, then mark
+  // ourselves as invalid.
+
+  if (!accept_invalid_exe_ctx) {
+    if (m_exe_ctx_ref.HasThreadRef()) {
+      ThreadSP thread_sp(m_exe_ctx_ref.GetThreadSP());
+      if (thread_sp) {
+        if (m_exe_ctx_ref.HasFrameRef()) {
+          StackFrameSP frame_sp(m_exe_ctx_ref.GetFrameSP());
+          if (!frame_sp) {
+            // We used to have a frame, but now it is gone
+            SetInvalid();
+            changed = was_valid;
+          }
+        }
+      } else {
+        // We used to have a thread, but now it is gone
+        SetInvalid();
+        changed = was_valid;
+      }
+    }
+  }
+
+  return changed;
+}
+
+void ValueObject::EvaluationPoint::SetUpdated() {
+  ProcessSP process_sp(m_exe_ctx_ref.GetProcessSP());
+  if (process_sp)
+    m_mod_id = process_sp->GetModID();
+  m_needs_update = false;
+}
+
+void ValueObject::ClearUserVisibleData(uint32_t clear_mask) {
+  if ((clear_mask & eClearUserVisibleDataItemsValue) ==
+      eClearUserVisibleDataItemsValue)
+    m_value_str.clear();
+
+  if ((clear_mask & eClearUserVisibleDataItemsLocation) ==
+      eClearUserVisibleDataItemsLocation)
+    m_location_str.clear();
+
+  if ((clear_mask & eClearUserVisibleDataItemsSummary) ==
+      eClearUserVisibleDataItemsSummary)
+    m_summary_str.clear();
+
+  if ((clear_mask & eClearUserVisibleDataItemsDescription) ==
+      eClearUserVisibleDataItemsDescription)
+    m_object_desc_str.clear();
 
-void
-ValueObject::EvaluationPoint::SetUpdated ()
-{
-    ProcessSP process_sp(m_exe_ctx_ref.GetProcessSP());
-    if (process_sp)
-        m_mod_id = process_sp->GetModID();
-    m_needs_update = false;
-}
-        
-
-
-void
-ValueObject::ClearUserVisibleData(uint32_t clear_mask)
-{
-    if ((clear_mask & eClearUserVisibleDataItemsValue) == eClearUserVisibleDataItemsValue)
-        m_value_str.clear();
-    
-    if ((clear_mask & eClearUserVisibleDataItemsLocation) == eClearUserVisibleDataItemsLocation)
-        m_location_str.clear();
-    
-    if ((clear_mask & eClearUserVisibleDataItemsSummary) == eClearUserVisibleDataItemsSummary)
-        m_summary_str.clear();
-    
-    if ((clear_mask & eClearUserVisibleDataItemsDescription) == eClearUserVisibleDataItemsDescription)
-        m_object_desc_str.clear();
-    
-    if ((clear_mask & eClearUserVisibleDataItemsSyntheticChildren) == eClearUserVisibleDataItemsSyntheticChildren)
-    {
-            if (m_synthetic_value)
-                m_synthetic_value = NULL;
-    }
-    
-    if ((clear_mask & eClearUserVisibleDataItemsValidator) == eClearUserVisibleDataItemsValidator)
-        m_validation_result.reset();
-}
+  if ((clear_mask & eClearUserVisibleDataItemsSyntheticChildren) ==
+      eClearUserVisibleDataItemsSyntheticChildren) {
+    if (m_synthetic_value)
+      m_synthetic_value = NULL;
+  }
 
-SymbolContextScope *
-ValueObject::GetSymbolContextScope()
-{
-    if (m_parent)
-    {
-        if (!m_parent->IsPointerOrReferenceType())
-            return m_parent->GetSymbolContextScope();
-    }
-    return NULL;
+  if ((clear_mask & eClearUserVisibleDataItemsValidator) ==
+      eClearUserVisibleDataItemsValidator)
+    m_validation_result.reset();
+}
+
+SymbolContextScope *ValueObject::GetSymbolContextScope() {
+  if (m_parent) {
+    if (!m_parent->IsPointerOrReferenceType())
+      return m_parent->GetSymbolContextScope();
+  }
+  return NULL;
+}
+
+lldb::ValueObjectSP ValueObject::CreateValueObjectFromExpression(
+    const char *name, const char *expression, const ExecutionContext &exe_ctx) {
+  return CreateValueObjectFromExpression(name, expression, exe_ctx,
+                                         EvaluateExpressionOptions());
+}
+
+lldb::ValueObjectSP ValueObject::CreateValueObjectFromExpression(
+    const char *name, const char *expression, const ExecutionContext &exe_ctx,
+    const EvaluateExpressionOptions &options) {
+  lldb::ValueObjectSP retval_sp;
+  lldb::TargetSP target_sp(exe_ctx.GetTargetSP());
+  if (!target_sp)
+    return retval_sp;
+  if (!expression || !*expression)
+    return retval_sp;
+  target_sp->EvaluateExpression(expression, exe_ctx.GetFrameSP().get(),
+                                retval_sp, options);
+  if (retval_sp && name && *name)
+    retval_sp->SetName(ConstString(name));
+  return retval_sp;
 }
 
 lldb::ValueObjectSP
-ValueObject::CreateValueObjectFromExpression (const char* name,
-                                              const char* expression,
-                                              const ExecutionContext& exe_ctx)
-{
-    return CreateValueObjectFromExpression(name, expression, exe_ctx, EvaluateExpressionOptions());
+ValueObject::CreateValueObjectFromAddress(const char *name, uint64_t address,
+                                          const ExecutionContext &exe_ctx,
+                                          CompilerType type) {
+  if (type) {
+    CompilerType pointer_type(type.GetPointerType());
+    if (pointer_type) {
+      lldb::DataBufferSP buffer(
+          new lldb_private::DataBufferHeap(&address, sizeof(lldb::addr_t)));
+      lldb::ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create(
+          exe_ctx.GetBestExecutionContextScope(), pointer_type,
+          ConstString(name), buffer, exe_ctx.GetByteOrder(),
+          exe_ctx.GetAddressByteSize()));
+      if (ptr_result_valobj_sp) {
+        ptr_result_valobj_sp->GetValue().SetValueType(
+            Value::eValueTypeLoadAddress);
+        Error err;
+        ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
+        if (ptr_result_valobj_sp && name && *name)
+          ptr_result_valobj_sp->SetName(ConstString(name));
+      }
+      return ptr_result_valobj_sp;
+    }
+  }
+  return lldb::ValueObjectSP();
+}
+
+lldb::ValueObjectSP ValueObject::CreateValueObjectFromData(
+    const char *name, const DataExtractor &data,
+    const ExecutionContext &exe_ctx, CompilerType type) {
+  lldb::ValueObjectSP new_value_sp;
+  new_value_sp = ValueObjectConstResult::Create(
+      exe_ctx.GetBestExecutionContextScope(), type, ConstString(name), data,
+      LLDB_INVALID_ADDRESS);
+  new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
+  if (new_value_sp && name && *name)
+    new_value_sp->SetName(ConstString(name));
+  return new_value_sp;
+}
+
+ModuleSP ValueObject::GetModule() {
+  ValueObject *root(GetRoot());
+  if (root != this)
+    return root->GetModule();
+  return lldb::ModuleSP();
+}
+
+ValueObject *ValueObject::GetRoot() {
+  if (m_root)
+    return m_root;
+  return (m_root = FollowParentChain([](ValueObject *vo) -> bool {
+            return (vo->m_parent != nullptr);
+          }));
 }
 
+ValueObject *
+ValueObject::FollowParentChain(std::function<bool(ValueObject *)> f) {
+  ValueObject *vo = this;
+  while (vo) {
+    if (f(vo) == false)
+      break;
+    vo = vo->m_parent;
+  }
+  return vo;
+}
 
-lldb::ValueObjectSP
-ValueObject::CreateValueObjectFromExpression (const char* name,
-                                              const char* expression,
-                                              const ExecutionContext& exe_ctx,
-                                              const EvaluateExpressionOptions& options)
-{
-    lldb::ValueObjectSP retval_sp;
-    lldb::TargetSP target_sp(exe_ctx.GetTargetSP());
-    if (!target_sp)
-        return retval_sp;
-    if (!expression || !*expression)
-        return retval_sp;
-    target_sp->EvaluateExpression (expression,
-                                   exe_ctx.GetFrameSP().get(),
-                                   retval_sp,
-                                   options);
-    if (retval_sp && name && *name)
-        retval_sp->SetName(ConstString(name));
-    return retval_sp;
+AddressType ValueObject::GetAddressTypeOfChildren() {
+  if (m_address_type_of_ptr_or_ref_children == eAddressTypeInvalid) {
+    ValueObject *root(GetRoot());
+    if (root != this)
+      return root->GetAddressTypeOfChildren();
+  }
+  return m_address_type_of_ptr_or_ref_children;
 }
 
-lldb::ValueObjectSP
-ValueObject::CreateValueObjectFromAddress (const char* name,
-                                           uint64_t address,
-                                           const ExecutionContext& exe_ctx,
-                                           CompilerType type)
-{
-    if (type)
-    {
-        CompilerType pointer_type(type.GetPointerType());
-        if (pointer_type)
-        {
-            lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
-            lldb::ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                                                     pointer_type,
-                                                                                     ConstString(name),
-                                                                                     buffer,
-                                                                                     exe_ctx.GetByteOrder(),
-                                                                                     exe_ctx.GetAddressByteSize()));
-            if (ptr_result_valobj_sp)
-            {
-                ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
-                Error err;
-                ptr_result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
-                if (ptr_result_valobj_sp && name && *name)
-                    ptr_result_valobj_sp->SetName(ConstString(name));
-            }
-            return ptr_result_valobj_sp;
-        }
-    }
-    return lldb::ValueObjectSP();
+lldb::DynamicValueType ValueObject::GetDynamicValueType() {
+  ValueObject *with_dv_info = this;
+  while (with_dv_info) {
+    if (with_dv_info->HasDynamicValueTypeInfo())
+      return with_dv_info->GetDynamicValueTypeImpl();
+    with_dv_info = with_dv_info->m_parent;
+  }
+  return lldb::eNoDynamicValues;
 }
 
-lldb::ValueObjectSP
-ValueObject::CreateValueObjectFromData (const char* name,
-                                        const DataExtractor& data,
-                                        const ExecutionContext& exe_ctx,
-                                        CompilerType type)
-{
-    lldb::ValueObjectSP new_value_sp;
-    new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                   type,
-                                                   ConstString(name),
-                                                   data,
-                                                   LLDB_INVALID_ADDRESS);
-    new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
-    if (new_value_sp && name && *name)
-        new_value_sp->SetName(ConstString(name));
-    return new_value_sp;
-}
-
-ModuleSP
-ValueObject::GetModule ()
-{
-    ValueObject* root(GetRoot());
-    if (root != this)
-        return root->GetModule();
-    return lldb::ModuleSP();
+lldb::Format ValueObject::GetFormat() const {
+  const ValueObject *with_fmt_info = this;
+  while (with_fmt_info) {
+    if (with_fmt_info->m_format != lldb::eFormatDefault)
+      return with_fmt_info->m_format;
+    with_fmt_info = with_fmt_info->m_parent;
+  }
+  return m_format;
 }
 
-ValueObject*
-ValueObject::GetRoot ()
-{
-    if (m_root)
-        return m_root;
-    return (m_root = FollowParentChain( [] (ValueObject* vo) -> bool {
-        return (vo->m_parent != nullptr);
-    }));
-}
-
-ValueObject*
-ValueObject::FollowParentChain (std::function<bool(ValueObject*)> f)
-{
-    ValueObject* vo = this;
-    while (vo)
-    {
-        if (f(vo) == false)
-            break;
-        vo = vo->m_parent;
+lldb::LanguageType ValueObject::GetPreferredDisplayLanguage() {
+  lldb::LanguageType type = m_preferred_display_language;
+  if (m_preferred_display_language == lldb::eLanguageTypeUnknown) {
+    if (GetRoot()) {
+      if (GetRoot() == this) {
+        if (StackFrameSP frame_sp = GetFrameSP()) {
+          const SymbolContext &sc(
+              frame_sp->GetSymbolContext(eSymbolContextCompUnit));
+          if (CompileUnit *cu = sc.comp_unit)
+            type = cu->GetLanguage();
+        }
+      } else {
+        type = GetRoot()->GetPreferredDisplayLanguage();
+      }
     }
-    return vo;
+  }
+  return (m_preferred_display_language = type); // only compute it once
 }
 
-AddressType
-ValueObject::GetAddressTypeOfChildren()
-{
-    if (m_address_type_of_ptr_or_ref_children == eAddressTypeInvalid)
-    {
-        ValueObject* root(GetRoot());
-        if (root != this)
-            return root->GetAddressTypeOfChildren();
-    }
-    return m_address_type_of_ptr_or_ref_children;
+void ValueObject::SetPreferredDisplayLanguage(lldb::LanguageType lt) {
+  m_preferred_display_language = lt;
 }
 
-lldb::DynamicValueType
-ValueObject::GetDynamicValueType ()
-{
-    ValueObject* with_dv_info = this;
-    while (with_dv_info)
-    {
-        if (with_dv_info->HasDynamicValueTypeInfo())
-            return with_dv_info->GetDynamicValueTypeImpl();
-        with_dv_info = with_dv_info->m_parent;
-    }
-    return lldb::eNoDynamicValues;
+void ValueObject::SetPreferredDisplayLanguageIfNeeded(lldb::LanguageType lt) {
+  if (m_preferred_display_language == lldb::eLanguageTypeUnknown)
+    SetPreferredDisplayLanguage(lt);
 }
 
-lldb::Format
-ValueObject::GetFormat () const
-{
-    const ValueObject* with_fmt_info = this;
-    while (with_fmt_info)
-    {
-        if (with_fmt_info->m_format != lldb::eFormatDefault)
-            return with_fmt_info->m_format;
-        with_fmt_info = with_fmt_info->m_parent;
-    }
-    return m_format;
+bool ValueObject::CanProvideValue() {
+  // we need to support invalid types as providers of values because some
+  // bare-board
+  // debugging scenarios have no notion of types, but still manage to have raw
+  // numeric
+  // values for things like registers. sigh.
+  const CompilerType &type(GetCompilerType());
+  return (false == type.IsValid()) ||
+         (0 != (type.GetTypeInfo() & eTypeHasValue));
 }
 
-lldb::LanguageType
-ValueObject::GetPreferredDisplayLanguage ()
-{
-    lldb::LanguageType type = m_preferred_display_language;
-    if (m_preferred_display_language == lldb::eLanguageTypeUnknown)
-    {
-        if (GetRoot())
-        {
-            if (GetRoot() == this)
-            {
-                if (StackFrameSP frame_sp = GetFrameSP())
-                {
-                    const SymbolContext& sc(frame_sp->GetSymbolContext(eSymbolContextCompUnit));
-                    if (CompileUnit* cu = sc.comp_unit)
-                        type = cu->GetLanguage();
-                }
-            }
-            else
-            {
-                type = GetRoot()->GetPreferredDisplayLanguage();
-            }
-        }
-    }
-    return (m_preferred_display_language = type); // only compute it once
-}
+bool ValueObject::IsChecksumEmpty() { return m_value_checksum.empty(); }
 
-void
-ValueObject::SetPreferredDisplayLanguage (lldb::LanguageType lt)
-{
-    m_preferred_display_language = lt;
-}
+ValueObjectSP ValueObject::Persist() {
+  if (!UpdateValueIfNeeded())
+    return nullptr;
 
-void
-ValueObject::SetPreferredDisplayLanguageIfNeeded (lldb::LanguageType lt)
-{
-    if (m_preferred_display_language == lldb::eLanguageTypeUnknown)
-        SetPreferredDisplayLanguage(lt);
-}
+  TargetSP target_sp(GetTargetSP());
+  if (!target_sp)
+    return nullptr;
+
+  PersistentExpressionState *persistent_state =
+      target_sp->GetPersistentExpressionStateForLanguage(
+          GetPreferredDisplayLanguage());
+
+  if (!persistent_state)
+    return nullptr;
+
+  ConstString name(persistent_state->GetNextPersistentVariableName());
+
+  ValueObjectSP const_result_sp =
+      ValueObjectConstResult::Create(target_sp.get(), GetValue(), name);
 
-bool
-ValueObject::CanProvideValue ()
-{
-    // we need to support invalid types as providers of values because some bare-board
-    // debugging scenarios have no notion of types, but still manage to have raw numeric
-    // values for things like registers. sigh.
-    const CompilerType &type(GetCompilerType());
-    return (false == type.IsValid()) || (0 != (type.GetTypeInfo() & eTypeHasValue));
+  ExpressionVariableSP clang_var_sp =
+      persistent_state->CreatePersistentVariable(const_result_sp);
+  clang_var_sp->m_live_sp = clang_var_sp->m_frozen_sp;
+  clang_var_sp->m_flags |= ExpressionVariable::EVIsProgramReference;
+
+  return clang_var_sp->GetValueObject();
 }
 
-bool
-ValueObject::IsChecksumEmpty ()
-{
-    return m_value_checksum.empty();
+bool ValueObject::IsSyntheticChildrenGenerated() {
+  return m_is_synthetic_children_generated;
 }
 
-ValueObjectSP
-ValueObject::Persist ()
-{
-    if (!UpdateValueIfNeeded())
-        return nullptr;
-    
-    TargetSP target_sp(GetTargetSP());
-    if (!target_sp)
-        return nullptr;
-    
-    PersistentExpressionState *persistent_state = target_sp->GetPersistentExpressionStateForLanguage(GetPreferredDisplayLanguage());
-    
-    if (!persistent_state)
-        return nullptr;
-    
-    ConstString name(persistent_state->GetNextPersistentVariableName());
-    
-    ValueObjectSP const_result_sp = ValueObjectConstResult::Create (target_sp.get(), GetValue(), name);
-    
-    ExpressionVariableSP clang_var_sp = persistent_state->CreatePersistentVariable(const_result_sp);
-    clang_var_sp->m_live_sp = clang_var_sp->m_frozen_sp;
-    clang_var_sp->m_flags |= ExpressionVariable::EVIsProgramReference;
-    
-    return clang_var_sp->GetValueObject();
-}
-
-bool
-ValueObject::IsSyntheticChildrenGenerated ()
-{
-    return m_is_synthetic_children_generated;
-}
-
-void
-ValueObject::SetSyntheticChildrenGenerated (bool b)
-{
-    m_is_synthetic_children_generated = b;
-}
-
-uint64_t
-ValueObject::GetLanguageFlags ()
-{
-    return m_language_flags;
-}
-
-void
-ValueObject::SetLanguageFlags (uint64_t flags)
-{
-    m_language_flags = flags;
+void ValueObject::SetSyntheticChildrenGenerated(bool b) {
+  m_is_synthetic_children_generated = b;
 }
+
+uint64_t ValueObject::GetLanguageFlags() { return m_language_flags; }
+
+void ValueObject::SetLanguageFlags(uint64_t flags) { m_language_flags = flags; }

Modified: lldb/trunk/source/Core/ValueObjectCast.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectCast.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectCast.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectCast.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ValueObjectDynamicValue.cpp ---------------------------------*- C++ -*-===//
+//===-- ValueObjectDynamicValue.cpp ---------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +8,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #include "lldb/Core/ValueObjectCast.h"
 
 // C Includes
@@ -16,9 +16,9 @@
 // Project includes
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
-#include "lldb/Core/ValueObjectList.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectList.h"
 
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -34,97 +34,72 @@
 
 using namespace lldb_private;
 
-lldb::ValueObjectSP
-ValueObjectCast::Create (ValueObject &parent, 
-                         const ConstString &name, 
-                         const CompilerType &cast_type)
-{
-    ValueObjectCast *cast_valobj_ptr = new ValueObjectCast (parent, name, cast_type);
-    return cast_valobj_ptr->GetSP();
-}
-
-ValueObjectCast::ValueObjectCast
-(
-    ValueObject &parent, 
-    const ConstString &name, 
-    const CompilerType &cast_type
-) :
-    ValueObject(parent),
-    m_cast_type (cast_type)
-{
-    SetName (name);
-    //m_value.SetContext (Value::eContextTypeClangType, cast_type.GetOpaqueQualType());
-    m_value.SetCompilerType (cast_type);
-}
-
-ValueObjectCast::~ValueObjectCast()
-{
-}
-
-CompilerType
-ValueObjectCast::GetCompilerTypeImpl ()
-{
-    return m_cast_type;
-}
-
-size_t
-ValueObjectCast::CalculateNumChildren(uint32_t max)
-{
-    auto children_count = GetCompilerType().GetNumChildren (true);
-    return children_count <= max ? children_count : max;
-}
-
-uint64_t
-ValueObjectCast::GetByteSize()
-{
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    return m_value.GetValueByteSize(nullptr, &exe_ctx);
-}
-
-lldb::ValueType
-ValueObjectCast::GetValueType() const
-{
-    // Let our parent answer global, local, argument, etc...
-    return m_parent->GetValueType();
-}
-
-bool
-ValueObjectCast::UpdateValue ()
-{
-    SetValueIsValid (false);
-    m_error.Clear();
-    
-    if (m_parent->UpdateValueIfNeeded(false))
-    {
-        Value old_value(m_value);
-        m_update_point.SetUpdated();
-        m_value = m_parent->GetValue();
-        CompilerType compiler_type (GetCompilerType());
-        //m_value.SetContext (Value::eContextTypeClangType, compiler_type);
-        m_value.SetCompilerType (compiler_type);
-        SetAddressTypeOfChildren(m_parent->GetAddressTypeOfChildren());
-        if (!CanProvideValue())
-        {
-            // this value object represents an aggregate type whose
-            // children have values, but this object does not. So we
-            // say we are changed if our location has changed.
-            SetValueDidChange (m_value.GetValueType() != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
-        } 
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
-        SetValueDidChange (m_parent->GetValueDidChange());
-        return true;
+lldb::ValueObjectSP ValueObjectCast::Create(ValueObject &parent,
+                                            const ConstString &name,
+                                            const CompilerType &cast_type) {
+  ValueObjectCast *cast_valobj_ptr =
+      new ValueObjectCast(parent, name, cast_type);
+  return cast_valobj_ptr->GetSP();
+}
+
+ValueObjectCast::ValueObjectCast(ValueObject &parent, const ConstString &name,
+                                 const CompilerType &cast_type)
+    : ValueObject(parent), m_cast_type(cast_type) {
+  SetName(name);
+  // m_value.SetContext (Value::eContextTypeClangType,
+  // cast_type.GetOpaqueQualType());
+  m_value.SetCompilerType(cast_type);
+}
+
+ValueObjectCast::~ValueObjectCast() {}
+
+CompilerType ValueObjectCast::GetCompilerTypeImpl() { return m_cast_type; }
+
+size_t ValueObjectCast::CalculateNumChildren(uint32_t max) {
+  auto children_count = GetCompilerType().GetNumChildren(true);
+  return children_count <= max ? children_count : max;
+}
+
+uint64_t ValueObjectCast::GetByteSize() {
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  return m_value.GetValueByteSize(nullptr, &exe_ctx);
+}
+
+lldb::ValueType ValueObjectCast::GetValueType() const {
+  // Let our parent answer global, local, argument, etc...
+  return m_parent->GetValueType();
+}
+
+bool ValueObjectCast::UpdateValue() {
+  SetValueIsValid(false);
+  m_error.Clear();
+
+  if (m_parent->UpdateValueIfNeeded(false)) {
+    Value old_value(m_value);
+    m_update_point.SetUpdated();
+    m_value = m_parent->GetValue();
+    CompilerType compiler_type(GetCompilerType());
+    // m_value.SetContext (Value::eContextTypeClangType, compiler_type);
+    m_value.SetCompilerType(compiler_type);
+    SetAddressTypeOfChildren(m_parent->GetAddressTypeOfChildren());
+    if (!CanProvideValue()) {
+      // this value object represents an aggregate type whose
+      // children have values, but this object does not. So we
+      // say we are changed if our location has changed.
+      SetValueDidChange(m_value.GetValueType() != old_value.GetValueType() ||
+                        m_value.GetScalar() != old_value.GetScalar());
     }
-    
-    // The dynamic value failed to get an error, pass the error along
-    if (m_error.Success() && m_parent->GetError().Fail())
-        m_error = m_parent->GetError();
-    SetValueIsValid (false);
-    return false;
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+    SetValueDidChange(m_parent->GetValueDidChange());
+    return true;
+  }
+
+  // The dynamic value failed to get an error, pass the error along
+  if (m_error.Success() && m_parent->GetError().Fail())
+    m_error = m_parent->GetError();
+  SetValueIsValid(false);
+  return false;
 }
 
-bool
-ValueObjectCast::IsInScope ()
-{
-    return m_parent->IsInScope();
-}
+bool ValueObjectCast::IsInScope() { return m_parent->IsInScope(); }

Modified: lldb/trunk/source/Core/ValueObjectChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectChild.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectChild.cpp Tue Sep  6 15:57:50 2016
@@ -24,254 +24,205 @@
 
 using namespace lldb_private;
 
-ValueObjectChild::ValueObjectChild
-(
-    ValueObject &parent,
-    const CompilerType &compiler_type,
-    const ConstString &name,
-    uint64_t byte_size,
-    int32_t byte_offset,
-    uint32_t bitfield_bit_size,
-    uint32_t bitfield_bit_offset,
-    bool is_base_class,
-    bool is_deref_of_parent,
-    AddressType child_ptr_or_ref_addr_type,
-    uint64_t language_flags
-) :
-    ValueObject (parent),
-    m_compiler_type (compiler_type),
-    m_byte_size (byte_size),
-    m_byte_offset (byte_offset),
-    m_bitfield_bit_size (bitfield_bit_size),
-    m_bitfield_bit_offset (bitfield_bit_offset),
-    m_is_base_class (is_base_class),
-    m_is_deref_of_parent (is_deref_of_parent),
-    m_can_update_with_invalid_exe_ctx()
-{
-    m_name = name;
-    SetAddressTypeOfChildren(child_ptr_or_ref_addr_type);
-    SetLanguageFlags(language_flags);
-}
-
-ValueObjectChild::~ValueObjectChild()
-{
-}
-
-lldb::ValueType
-ValueObjectChild::GetValueType() const
-{
-    return m_parent->GetValueType();
-}
-
-size_t
-ValueObjectChild::CalculateNumChildren(uint32_t max)
-{
-    auto children_count = GetCompilerType().GetNumChildren (true);
-    return children_count <= max ? children_count : max;
-}
-
-static void
-AdjustForBitfieldness(ConstString& name,
-                      uint8_t bitfield_bit_size)
-{
-    if (name && bitfield_bit_size)
-    {
-        const char *compiler_type_name = name.AsCString();
-        if (compiler_type_name)
-        {
-            std::vector<char> bitfield_type_name (strlen(compiler_type_name) + 32, 0);
-            ::snprintf (&bitfield_type_name.front(), bitfield_type_name.size(), "%s:%u", compiler_type_name, bitfield_bit_size);
-            name.SetCString(&bitfield_type_name.front());
-        }
+ValueObjectChild::ValueObjectChild(
+    ValueObject &parent, const CompilerType &compiler_type,
+    const ConstString &name, uint64_t byte_size, int32_t byte_offset,
+    uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+    bool is_base_class, bool is_deref_of_parent,
+    AddressType child_ptr_or_ref_addr_type, uint64_t language_flags)
+    : ValueObject(parent), m_compiler_type(compiler_type),
+      m_byte_size(byte_size), m_byte_offset(byte_offset),
+      m_bitfield_bit_size(bitfield_bit_size),
+      m_bitfield_bit_offset(bitfield_bit_offset),
+      m_is_base_class(is_base_class), m_is_deref_of_parent(is_deref_of_parent),
+      m_can_update_with_invalid_exe_ctx() {
+  m_name = name;
+  SetAddressTypeOfChildren(child_ptr_or_ref_addr_type);
+  SetLanguageFlags(language_flags);
+}
+
+ValueObjectChild::~ValueObjectChild() {}
+
+lldb::ValueType ValueObjectChild::GetValueType() const {
+  return m_parent->GetValueType();
+}
+
+size_t ValueObjectChild::CalculateNumChildren(uint32_t max) {
+  auto children_count = GetCompilerType().GetNumChildren(true);
+  return children_count <= max ? children_count : max;
+}
+
+static void AdjustForBitfieldness(ConstString &name,
+                                  uint8_t bitfield_bit_size) {
+  if (name && bitfield_bit_size) {
+    const char *compiler_type_name = name.AsCString();
+    if (compiler_type_name) {
+      std::vector<char> bitfield_type_name(strlen(compiler_type_name) + 32, 0);
+      ::snprintf(&bitfield_type_name.front(), bitfield_type_name.size(),
+                 "%s:%u", compiler_type_name, bitfield_bit_size);
+      name.SetCString(&bitfield_type_name.front());
     }
+  }
 }
 
-ConstString
-ValueObjectChild::GetTypeName()
-{
-    if (m_type_name.IsEmpty())
-    {
-        m_type_name = GetCompilerType().GetConstTypeName ();
-        AdjustForBitfieldness(m_type_name, m_bitfield_bit_size);
-    }
-    return m_type_name;
+ConstString ValueObjectChild::GetTypeName() {
+  if (m_type_name.IsEmpty()) {
+    m_type_name = GetCompilerType().GetConstTypeName();
+    AdjustForBitfieldness(m_type_name, m_bitfield_bit_size);
+  }
+  return m_type_name;
 }
 
-ConstString
-ValueObjectChild::GetQualifiedTypeName()
-{
-    ConstString qualified_name = GetCompilerType().GetConstTypeName();
-    AdjustForBitfieldness(qualified_name, m_bitfield_bit_size);
-    return qualified_name;
-}
-
-ConstString
-ValueObjectChild::GetDisplayTypeName()
-{
-    ConstString display_name = GetCompilerType().GetDisplayTypeName();
-    AdjustForBitfieldness(display_name, m_bitfield_bit_size);
-    return display_name;
-}
-
-LazyBool
-ValueObjectChild::CanUpdateWithInvalidExecutionContext ()
-{
-    if (m_can_update_with_invalid_exe_ctx.hasValue())
-        return m_can_update_with_invalid_exe_ctx.getValue();
-    if (m_parent)
-    {
-        ValueObject *opinionated_parent = m_parent->FollowParentChain([] (ValueObject* valobj) -> bool {
-            return (valobj->CanUpdateWithInvalidExecutionContext() == eLazyBoolCalculate);
-        });
-        if (opinionated_parent)
-            return (m_can_update_with_invalid_exe_ctx = opinionated_parent->CanUpdateWithInvalidExecutionContext()).getValue();
-    }
-    return (m_can_update_with_invalid_exe_ctx = this->ValueObject::CanUpdateWithInvalidExecutionContext()).getValue();
+ConstString ValueObjectChild::GetQualifiedTypeName() {
+  ConstString qualified_name = GetCompilerType().GetConstTypeName();
+  AdjustForBitfieldness(qualified_name, m_bitfield_bit_size);
+  return qualified_name;
 }
 
-bool
-ValueObjectChild::UpdateValue ()
-{
-    m_error.Clear();
-    SetValueIsValid (false);
-    ValueObject* parent = m_parent;
-    if (parent)
-    {
-        if (parent->UpdateValueIfNeeded(false))
-        {
-            m_value.SetCompilerType(GetCompilerType());
-            
-            CompilerType parent_type(parent->GetCompilerType());
-            // Copy the parent scalar value and the scalar value type
-            m_value.GetScalar() = parent->GetValue().GetScalar();
-            Value::ValueType value_type = parent->GetValue().GetValueType();
-            m_value.SetValueType (value_type);
-            
-            Flags parent_type_flags(parent_type.GetTypeInfo());
-            const bool is_instance_ptr_base = ((m_is_base_class == true) && (parent_type_flags.AnySet(lldb::eTypeInstanceIsPointer)));
-
-            if (parent->GetCompilerType().ShouldTreatScalarValueAsAddress())
-            {
-                lldb::addr_t addr = parent->GetPointerValue ();
-                m_value.GetScalar() = addr;
-                
-                if (addr == LLDB_INVALID_ADDRESS)
-                {
-                    m_error.SetErrorString ("parent address is invalid.");
-                }
-                else if (addr == 0)
-                {
-                    m_error.SetErrorString ("parent is NULL");
-                }
-                else
-                {
-                    m_value.GetScalar() += m_byte_offset;
-                    AddressType addr_type = parent->GetAddressTypeOfChildren();
-                    
-                    switch (addr_type)
-                    {
-                        case eAddressTypeFile:
-                        {
-                            lldb::ProcessSP process_sp (GetProcessSP());
-                            if (process_sp && process_sp->IsAlive() == true)
-                                m_value.SetValueType (Value::eValueTypeLoadAddress);
-                            else
-                                m_value.SetValueType(Value::eValueTypeFileAddress);
-                        }
-                            break;
-                        case eAddressTypeLoad:
-                            m_value.SetValueType (is_instance_ptr_base ? Value::eValueTypeScalar: Value::eValueTypeLoadAddress);
-                            break;
-                        case eAddressTypeHost:
-                            m_value.SetValueType(Value::eValueTypeHostAddress);
-                            break;
-                        case eAddressTypeInvalid:
-                            // TODO: does this make sense?
-                            m_value.SetValueType(Value::eValueTypeScalar);
-                            break;
-                    }
-                }
-            }
+ConstString ValueObjectChild::GetDisplayTypeName() {
+  ConstString display_name = GetCompilerType().GetDisplayTypeName();
+  AdjustForBitfieldness(display_name, m_bitfield_bit_size);
+  return display_name;
+}
+
+LazyBool ValueObjectChild::CanUpdateWithInvalidExecutionContext() {
+  if (m_can_update_with_invalid_exe_ctx.hasValue())
+    return m_can_update_with_invalid_exe_ctx.getValue();
+  if (m_parent) {
+    ValueObject *opinionated_parent =
+        m_parent->FollowParentChain([](ValueObject *valobj) -> bool {
+          return (valobj->CanUpdateWithInvalidExecutionContext() ==
+                  eLazyBoolCalculate);
+        });
+    if (opinionated_parent)
+      return (m_can_update_with_invalid_exe_ctx =
+                  opinionated_parent->CanUpdateWithInvalidExecutionContext())
+          .getValue();
+  }
+  return (m_can_update_with_invalid_exe_ctx =
+              this->ValueObject::CanUpdateWithInvalidExecutionContext())
+      .getValue();
+}
+
+bool ValueObjectChild::UpdateValue() {
+  m_error.Clear();
+  SetValueIsValid(false);
+  ValueObject *parent = m_parent;
+  if (parent) {
+    if (parent->UpdateValueIfNeeded(false)) {
+      m_value.SetCompilerType(GetCompilerType());
+
+      CompilerType parent_type(parent->GetCompilerType());
+      // Copy the parent scalar value and the scalar value type
+      m_value.GetScalar() = parent->GetValue().GetScalar();
+      Value::ValueType value_type = parent->GetValue().GetValueType();
+      m_value.SetValueType(value_type);
+
+      Flags parent_type_flags(parent_type.GetTypeInfo());
+      const bool is_instance_ptr_base =
+          ((m_is_base_class == true) &&
+           (parent_type_flags.AnySet(lldb::eTypeInstanceIsPointer)));
+
+      if (parent->GetCompilerType().ShouldTreatScalarValueAsAddress()) {
+        lldb::addr_t addr = parent->GetPointerValue();
+        m_value.GetScalar() = addr;
+
+        if (addr == LLDB_INVALID_ADDRESS) {
+          m_error.SetErrorString("parent address is invalid.");
+        } else if (addr == 0) {
+          m_error.SetErrorString("parent is NULL");
+        } else {
+          m_value.GetScalar() += m_byte_offset;
+          AddressType addr_type = parent->GetAddressTypeOfChildren();
+
+          switch (addr_type) {
+          case eAddressTypeFile: {
+            lldb::ProcessSP process_sp(GetProcessSP());
+            if (process_sp && process_sp->IsAlive() == true)
+              m_value.SetValueType(Value::eValueTypeLoadAddress);
             else
-            {
-                switch (value_type)
-                {
-                    case Value::eValueTypeLoadAddress:
-                    case Value::eValueTypeFileAddress:
-                    case Value::eValueTypeHostAddress:
-                    {
-                        lldb::addr_t addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-                        if (addr == LLDB_INVALID_ADDRESS)
-                        {
-                            m_error.SetErrorString ("parent address is invalid.");
-                        }
-                        else if (addr == 0)
-                        {
-                            m_error.SetErrorString ("parent is NULL");
-                        }
-                        else
-                        {
-                            // Set this object's scalar value to the address of its
-                            // value by adding its byte offset to the parent address
-                            m_value.GetScalar() += GetByteOffset();
-                        }
-                    }
-                        break;
-                        
-                    case Value::eValueTypeScalar:
-                        // try to extract the child value from the parent's scalar value
-                    {
-                        Scalar scalar(m_value.GetScalar());
-                        if (m_bitfield_bit_size)
-                            scalar.ExtractBitfield(m_bitfield_bit_size, m_bitfield_bit_offset);
-                        else
-                            scalar.ExtractBitfield(8*m_byte_size, 8*m_byte_offset);
-                        m_value.GetScalar() = scalar;
-                    }
-                        break;
-                    default:
-                        m_error.SetErrorString ("parent has invalid value.");
-                        break;
-                }
-            }
-            
-            if (m_error.Success())
-            {
-                const bool thread_and_frame_only_if_stopped = true;
-                ExecutionContext exe_ctx (GetExecutionContextRef().Lock(thread_and_frame_only_if_stopped));
-                if (GetCompilerType().GetTypeInfo() & lldb::eTypeHasValue)
-                {
-                    if (!is_instance_ptr_base)
-                        m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
-                    else
-                        m_error = m_parent->GetValue().GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
-                }
-                else
-                {
-                    m_error.Clear(); // No value so nothing to read...
-                }
-            }
-            
+              m_value.SetValueType(Value::eValueTypeFileAddress);
+          } break;
+          case eAddressTypeLoad:
+            m_value.SetValueType(is_instance_ptr_base
+                                     ? Value::eValueTypeScalar
+                                     : Value::eValueTypeLoadAddress);
+            break;
+          case eAddressTypeHost:
+            m_value.SetValueType(Value::eValueTypeHostAddress);
+            break;
+          case eAddressTypeInvalid:
+            // TODO: does this make sense?
+            m_value.SetValueType(Value::eValueTypeScalar);
+            break;
+          }
         }
-        else
-        {
-            m_error.SetErrorStringWithFormat("parent failed to evaluate: %s", parent->GetError().AsCString());
+      } else {
+        switch (value_type) {
+        case Value::eValueTypeLoadAddress:
+        case Value::eValueTypeFileAddress:
+        case Value::eValueTypeHostAddress: {
+          lldb::addr_t addr =
+              m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+          if (addr == LLDB_INVALID_ADDRESS) {
+            m_error.SetErrorString("parent address is invalid.");
+          } else if (addr == 0) {
+            m_error.SetErrorString("parent is NULL");
+          } else {
+            // Set this object's scalar value to the address of its
+            // value by adding its byte offset to the parent address
+            m_value.GetScalar() += GetByteOffset();
+          }
+        } break;
+
+        case Value::eValueTypeScalar:
+          // try to extract the child value from the parent's scalar value
+          {
+            Scalar scalar(m_value.GetScalar());
+            if (m_bitfield_bit_size)
+              scalar.ExtractBitfield(m_bitfield_bit_size,
+                                     m_bitfield_bit_offset);
+            else
+              scalar.ExtractBitfield(8 * m_byte_size, 8 * m_byte_offset);
+            m_value.GetScalar() = scalar;
+          }
+          break;
+        default:
+          m_error.SetErrorString("parent has invalid value.");
+          break;
         }
+      }
+
+      if (m_error.Success()) {
+        const bool thread_and_frame_only_if_stopped = true;
+        ExecutionContext exe_ctx(
+            GetExecutionContextRef().Lock(thread_and_frame_only_if_stopped));
+        if (GetCompilerType().GetTypeInfo() & lldb::eTypeHasValue) {
+          if (!is_instance_ptr_base)
+            m_error =
+                m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+          else
+            m_error = m_parent->GetValue().GetValueAsData(&exe_ctx, m_data, 0,
+                                                          GetModule().get());
+        } else {
+          m_error.Clear(); // No value so nothing to read...
+        }
+      }
+
+    } else {
+      m_error.SetErrorStringWithFormat("parent failed to evaluate: %s",
+                                       parent->GetError().AsCString());
     }
-    else
-    {
-        m_error.SetErrorString("ValueObjectChild has a NULL parent ValueObject.");
-    }
-    
-    return m_error.Success();
+  } else {
+    m_error.SetErrorString("ValueObjectChild has a NULL parent ValueObject.");
+  }
+
+  return m_error.Success();
 }
 
-
-bool
-ValueObjectChild::IsInScope ()
-{
-    ValueObject* root(GetRoot());
-    if (root)
-        return root->IsInScope ();
-    return false;
+bool ValueObjectChild::IsInScope() {
+  ValueObject *root(GetRoot());
+  if (root)
+    return root->IsInScope();
+  return false;
 }

Modified: lldb/trunk/source/Core/ValueObjectConstResult.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResult.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectConstResult.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectConstResult.cpp Tue Sep  6 15:57:50 2016
@@ -9,10 +9,10 @@
 
 #include "lldb/Core/ValueObjectConstResult.h"
 
-#include "lldb/Core/ValueObjectChild.h"
-#include "lldb/Core/ValueObjectConstResultChild.h"
 #include "lldb/Core/DataExtractor.h"
 #include "lldb/Core/Module.h"
+#include "lldb/Core/ValueObjectChild.h"
+#include "lldb/Core/ValueObjectConstResultChild.h"
 #include "lldb/Core/ValueObjectDynamicValue.h"
 #include "lldb/Core/ValueObjectList.h"
 
@@ -29,356 +29,270 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ValueObjectSP
-ValueObjectConstResult::Create (ExecutionContextScope *exe_scope,
-                                ByteOrder byte_order,
-                                uint32_t addr_byte_size,
-                                lldb::addr_t address)
-{
-    return (new ValueObjectConstResult (exe_scope,
-                                        byte_order,
-                                        addr_byte_size,
-                                        address))->GetSP();
-}
-
-ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                                                ByteOrder byte_order,
-                                                uint32_t addr_byte_size,
-                                                lldb::addr_t address) :
-    ValueObject (exe_scope),
-    m_type_name (),
-    m_byte_size (0),
-    m_impl(this, address)
-{
-    SetIsConstant ();
-    SetValueIsValid(true);
-    m_data.SetByteOrder(byte_order);
-    m_data.SetAddressByteSize(addr_byte_size);
-    SetAddressTypeOfChildren(eAddressTypeLoad);
-}
-
-ValueObjectSP
-ValueObjectConstResult::Create
-(
-    ExecutionContextScope *exe_scope,
-    const CompilerType &compiler_type,
-    const ConstString &name,
-    const DataExtractor &data,
-    lldb::addr_t address
-)
-{
-    return (new ValueObjectConstResult (exe_scope,
-                                        compiler_type,
-                                        name,
-                                        data,
-                                        address))->GetSP();
-}
-
-ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                                                const CompilerType &compiler_type,
-                                                const ConstString &name,
-                                                const DataExtractor &data,
-                                                lldb::addr_t address) :
-    ValueObject (exe_scope),
-    m_type_name (),
-    m_byte_size (0),
-    m_impl(this, address)
-{
-    m_data = data;
-    
-    if (!m_data.GetSharedDataBuffer())
-    {
-        DataBufferSP shared_data_buffer(new DataBufferHeap(data.GetDataStart(), data.GetByteSize()));
-        m_data.SetData(shared_data_buffer);
-    }
-    
-    m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
-    m_value.SetValueType(Value::eValueTypeHostAddress);
-    m_value.SetCompilerType(compiler_type);
-    m_name = name;
-    SetIsConstant ();
-    SetValueIsValid(true);
-    SetAddressTypeOfChildren(eAddressTypeLoad);
-}
-
-ValueObjectSP
-ValueObjectConstResult::Create (ExecutionContextScope *exe_scope,
-                                const CompilerType &compiler_type,
-                                const ConstString &name,
-                                const lldb::DataBufferSP &data_sp,
-                                lldb::ByteOrder data_byte_order,
-                                uint32_t data_addr_size,
-                                lldb::addr_t address)
-{
-    return (new ValueObjectConstResult (exe_scope,
-                                        compiler_type,
-                                        name,
-                                        data_sp,
-                                        data_byte_order,
-                                        data_addr_size,
-                                        address))->GetSP();
-}
-
-ValueObjectSP
-ValueObjectConstResult::Create (ExecutionContextScope *exe_scope,
-                                Value &value,
-                                const ConstString &name,
-                                Module *module)
-{
-    return (new ValueObjectConstResult (exe_scope, value, name, module))->GetSP();
-}
-
-ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                                                const CompilerType &compiler_type,
-                                                const ConstString &name,
-                                                const lldb::DataBufferSP &data_sp,
-                                                lldb::ByteOrder data_byte_order, 
-                                                uint32_t data_addr_size,
-                                                lldb::addr_t address) :
-    ValueObject (exe_scope),
-    m_type_name (),
-    m_byte_size (0),
-    m_impl(this, address)
-{
-    m_data.SetByteOrder(data_byte_order);
-    m_data.SetAddressByteSize(data_addr_size);
-    m_data.SetData(data_sp);
-    m_value.GetScalar() = (uintptr_t)data_sp->GetBytes();
+ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
+                                             ByteOrder byte_order,
+                                             uint32_t addr_byte_size,
+                                             lldb::addr_t address) {
+  return (new ValueObjectConstResult(exe_scope, byte_order, addr_byte_size,
+                                     address))
+      ->GetSP();
+}
+
+ValueObjectConstResult::ValueObjectConstResult(ExecutionContextScope *exe_scope,
+                                               ByteOrder byte_order,
+                                               uint32_t addr_byte_size,
+                                               lldb::addr_t address)
+    : ValueObject(exe_scope), m_type_name(), m_byte_size(0),
+      m_impl(this, address) {
+  SetIsConstant();
+  SetValueIsValid(true);
+  m_data.SetByteOrder(byte_order);
+  m_data.SetAddressByteSize(addr_byte_size);
+  SetAddressTypeOfChildren(eAddressTypeLoad);
+}
+
+ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
+                                             const CompilerType &compiler_type,
+                                             const ConstString &name,
+                                             const DataExtractor &data,
+                                             lldb::addr_t address) {
+  return (new ValueObjectConstResult(exe_scope, compiler_type, name, data,
+                                     address))
+      ->GetSP();
+}
+
+ValueObjectConstResult::ValueObjectConstResult(
+    ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
+    const ConstString &name, const DataExtractor &data, lldb::addr_t address)
+    : ValueObject(exe_scope), m_type_name(), m_byte_size(0),
+      m_impl(this, address) {
+  m_data = data;
+
+  if (!m_data.GetSharedDataBuffer()) {
+    DataBufferSP shared_data_buffer(
+        new DataBufferHeap(data.GetDataStart(), data.GetByteSize()));
+    m_data.SetData(shared_data_buffer);
+  }
+
+  m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
+  m_value.SetValueType(Value::eValueTypeHostAddress);
+  m_value.SetCompilerType(compiler_type);
+  m_name = name;
+  SetIsConstant();
+  SetValueIsValid(true);
+  SetAddressTypeOfChildren(eAddressTypeLoad);
+}
+
+ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
+                                             const CompilerType &compiler_type,
+                                             const ConstString &name,
+                                             const lldb::DataBufferSP &data_sp,
+                                             lldb::ByteOrder data_byte_order,
+                                             uint32_t data_addr_size,
+                                             lldb::addr_t address) {
+  return (new ValueObjectConstResult(exe_scope, compiler_type, name, data_sp,
+                                     data_byte_order, data_addr_size, address))
+      ->GetSP();
+}
+
+ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
+                                             Value &value,
+                                             const ConstString &name,
+                                             Module *module) {
+  return (new ValueObjectConstResult(exe_scope, value, name, module))->GetSP();
+}
+
+ValueObjectConstResult::ValueObjectConstResult(
+    ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
+    const ConstString &name, const lldb::DataBufferSP &data_sp,
+    lldb::ByteOrder data_byte_order, uint32_t data_addr_size,
+    lldb::addr_t address)
+    : ValueObject(exe_scope), m_type_name(), m_byte_size(0),
+      m_impl(this, address) {
+  m_data.SetByteOrder(data_byte_order);
+  m_data.SetAddressByteSize(data_addr_size);
+  m_data.SetData(data_sp);
+  m_value.GetScalar() = (uintptr_t)data_sp->GetBytes();
+  m_value.SetValueType(Value::eValueTypeHostAddress);
+  // m_value.SetContext(Value::eContextTypeClangType, compiler_type);
+  m_value.SetCompilerType(compiler_type);
+  m_name = name;
+  SetIsConstant();
+  SetValueIsValid(true);
+  SetAddressTypeOfChildren(eAddressTypeLoad);
+}
+
+ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
+                                             const CompilerType &compiler_type,
+                                             const ConstString &name,
+                                             lldb::addr_t address,
+                                             AddressType address_type,
+                                             uint32_t addr_byte_size) {
+  return (new ValueObjectConstResult(exe_scope, compiler_type, name, address,
+                                     address_type, addr_byte_size))
+      ->GetSP();
+}
+
+ValueObjectConstResult::ValueObjectConstResult(
+    ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
+    const ConstString &name, lldb::addr_t address, AddressType address_type,
+    uint32_t addr_byte_size)
+    : ValueObject(exe_scope), m_type_name(), m_byte_size(0),
+      m_impl(this, address) {
+  m_value.GetScalar() = address;
+  m_data.SetAddressByteSize(addr_byte_size);
+  m_value.GetScalar().GetData(m_data, addr_byte_size);
+  // m_value.SetValueType(Value::eValueTypeHostAddress);
+  switch (address_type) {
+  case eAddressTypeInvalid:
+    m_value.SetValueType(Value::eValueTypeScalar);
+    break;
+  case eAddressTypeFile:
+    m_value.SetValueType(Value::eValueTypeFileAddress);
+    break;
+  case eAddressTypeLoad:
+    m_value.SetValueType(Value::eValueTypeLoadAddress);
+    break;
+  case eAddressTypeHost:
     m_value.SetValueType(Value::eValueTypeHostAddress);
-    //m_value.SetContext(Value::eContextTypeClangType, compiler_type);
-    m_value.SetCompilerType (compiler_type);
-    m_name = name;
-    SetIsConstant ();
-    SetValueIsValid(true);
-    SetAddressTypeOfChildren(eAddressTypeLoad);
-}
-
-ValueObjectSP
-ValueObjectConstResult::Create (ExecutionContextScope *exe_scope,
-                                const CompilerType &compiler_type,
-                                const ConstString &name,
-                                lldb::addr_t address,
-                                AddressType address_type,
-                                uint32_t addr_byte_size)
-{
-    return (new ValueObjectConstResult (exe_scope,
-                                        compiler_type,
-                                        name,
-                                        address,
-                                        address_type,
-                                        addr_byte_size))->GetSP();
-}
-
-ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                                                const CompilerType &compiler_type,
-                                                const ConstString &name,
-                                                lldb::addr_t address,
-                                                AddressType address_type,
-                                                uint32_t addr_byte_size) :
-    ValueObject (exe_scope),
-    m_type_name (),
-    m_byte_size (0),
-    m_impl(this, address)
-{
-    m_value.GetScalar() = address;
-    m_data.SetAddressByteSize(addr_byte_size);
-    m_value.GetScalar().GetData (m_data, addr_byte_size);
-    //m_value.SetValueType(Value::eValueTypeHostAddress); 
-    switch (address_type)
-    {
-    case eAddressTypeInvalid:   m_value.SetValueType(Value::eValueTypeScalar);      break;
-    case eAddressTypeFile:      m_value.SetValueType(Value::eValueTypeFileAddress); break;
-    case eAddressTypeLoad:      m_value.SetValueType(Value::eValueTypeLoadAddress); break;    
-    case eAddressTypeHost:      m_value.SetValueType(Value::eValueTypeHostAddress); break;
-    }
-//    m_value.SetContext(Value::eContextTypeClangType, compiler_type);
-    m_value.SetCompilerType (compiler_type);
-    m_name = name;
-    SetIsConstant ();
-    SetValueIsValid(true);
-    SetAddressTypeOfChildren(eAddressTypeLoad);
-}
-
-ValueObjectSP
-ValueObjectConstResult::Create
-(
-    ExecutionContextScope *exe_scope,
-    const Error& error
-)
-{
-    return (new ValueObjectConstResult (exe_scope,
-                                        error))->GetSP();
-}
-
-ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                                                const Error& error) :
-    ValueObject (exe_scope),
-    m_type_name (),
-    m_byte_size (0),
-    m_impl(this)
-{
-    m_error = error;
-    SetIsConstant ();
-}
-
-ValueObjectConstResult::ValueObjectConstResult (ExecutionContextScope *exe_scope,
-                                                const Value &value,
-                                                const ConstString &name,
-                                                Module *module) :
-    ValueObject (exe_scope),
-    m_type_name (),
-    m_byte_size (0),
-    m_impl(this)
-{
-    m_value = value;
-    m_name = name;
-    ExecutionContext exe_ctx;
-    exe_scope->CalculateExecutionContext(exe_ctx);
-    m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, module);
-}
-
-ValueObjectConstResult::~ValueObjectConstResult()
-{
-}
-
-CompilerType
-ValueObjectConstResult::GetCompilerTypeImpl()
-{
-    return m_value.GetCompilerType();
-}
-
-lldb::ValueType
-ValueObjectConstResult::GetValueType() const
-{
-    return eValueTypeConstResult;
-}
-
-uint64_t
-ValueObjectConstResult::GetByteSize()
-{
-    ExecutionContext exe_ctx(GetExecutionContextRef());
-
-    if (m_byte_size == 0)
-        SetByteSize(GetCompilerType().GetByteSize(exe_ctx.GetBestExecutionContextScope()));
-    return m_byte_size;
-}
-
-void
-ValueObjectConstResult::SetByteSize (size_t size)
-{
-    m_byte_size = size;
-}
-
-size_t
-ValueObjectConstResult::CalculateNumChildren(uint32_t max)
-{
-    auto children_count = GetCompilerType().GetNumChildren (true);
-    return children_count <= max ? children_count : max;
-}
-
-ConstString
-ValueObjectConstResult::GetTypeName()
-{
-    if (m_type_name.IsEmpty())
-        m_type_name = GetCompilerType().GetConstTypeName ();
-    return m_type_name;
-}
-
-ConstString
-ValueObjectConstResult::GetDisplayTypeName()
-{
-    return GetCompilerType().GetDisplayTypeName();
-}
-
-bool
-ValueObjectConstResult::UpdateValue ()
-{
-    // Const value is always valid
-    SetValueIsValid (true);
-    return true;
-}
-
-
-bool
-ValueObjectConstResult::IsInScope ()
-{
-    // A const result value is always in scope since it serializes all 
-    // information needed to contain the constant value.
-    return true;
+    break;
+  }
+  //    m_value.SetContext(Value::eContextTypeClangType, compiler_type);
+  m_value.SetCompilerType(compiler_type);
+  m_name = name;
+  SetIsConstant();
+  SetValueIsValid(true);
+  SetAddressTypeOfChildren(eAddressTypeLoad);
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResult::Dereference (Error &error)
-{
-    return m_impl.Dereference(error);
+ValueObjectSP ValueObjectConstResult::Create(ExecutionContextScope *exe_scope,
+                                             const Error &error) {
+  return (new ValueObjectConstResult(exe_scope, error))->GetSP();
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResult::GetSyntheticChildAtOffset(uint32_t offset,
-                                                  const CompilerType& type,
-                                                  bool can_create,
-                                                  ConstString name_const_str)
-{
-    return m_impl.GetSyntheticChildAtOffset(offset, type, can_create, name_const_str);
+ValueObjectConstResult::ValueObjectConstResult(ExecutionContextScope *exe_scope,
+                                               const Error &error)
+    : ValueObject(exe_scope), m_type_name(), m_byte_size(0), m_impl(this) {
+  m_error = error;
+  SetIsConstant();
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResult::AddressOf (Error &error)
-{
-    return m_impl.AddressOf(error);
-}
-
-lldb::addr_t
-ValueObjectConstResult::GetAddressOf (bool scalar_is_load_address,
-                                      AddressType *address_type)
-{
-    return m_impl.GetAddressOf(scalar_is_load_address, address_type);
-}
-
-ValueObject *
-ValueObjectConstResult::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index)
-{
-    return m_impl.CreateChildAtIndex(idx, synthetic_array_member, synthetic_index);
-}
-
-size_t
-ValueObjectConstResult::GetPointeeData (DataExtractor& data,
-                                        uint32_t item_idx,
-                                        uint32_t item_count)
-{
-    return m_impl.GetPointeeData(data, item_idx, item_count);
+ValueObjectConstResult::ValueObjectConstResult(ExecutionContextScope *exe_scope,
+                                               const Value &value,
+                                               const ConstString &name,
+                                               Module *module)
+    : ValueObject(exe_scope), m_type_name(), m_byte_size(0), m_impl(this) {
+  m_value = value;
+  m_name = name;
+  ExecutionContext exe_ctx;
+  exe_scope->CalculateExecutionContext(exe_ctx);
+  m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, module);
+}
+
+ValueObjectConstResult::~ValueObjectConstResult() {}
+
+CompilerType ValueObjectConstResult::GetCompilerTypeImpl() {
+  return m_value.GetCompilerType();
+}
+
+lldb::ValueType ValueObjectConstResult::GetValueType() const {
+  return eValueTypeConstResult;
+}
+
+uint64_t ValueObjectConstResult::GetByteSize() {
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+
+  if (m_byte_size == 0)
+    SetByteSize(
+        GetCompilerType().GetByteSize(exe_ctx.GetBestExecutionContextScope()));
+  return m_byte_size;
+}
+
+void ValueObjectConstResult::SetByteSize(size_t size) { m_byte_size = size; }
+
+size_t ValueObjectConstResult::CalculateNumChildren(uint32_t max) {
+  auto children_count = GetCompilerType().GetNumChildren(true);
+  return children_count <= max ? children_count : max;
+}
+
+ConstString ValueObjectConstResult::GetTypeName() {
+  if (m_type_name.IsEmpty())
+    m_type_name = GetCompilerType().GetConstTypeName();
+  return m_type_name;
+}
+
+ConstString ValueObjectConstResult::GetDisplayTypeName() {
+  return GetCompilerType().GetDisplayTypeName();
+}
+
+bool ValueObjectConstResult::UpdateValue() {
+  // Const value is always valid
+  SetValueIsValid(true);
+  return true;
+}
+
+bool ValueObjectConstResult::IsInScope() {
+  // A const result value is always in scope since it serializes all
+  // information needed to contain the constant value.
+  return true;
+}
+
+lldb::ValueObjectSP ValueObjectConstResult::Dereference(Error &error) {
+  return m_impl.Dereference(error);
+}
+
+lldb::ValueObjectSP ValueObjectConstResult::GetSyntheticChildAtOffset(
+    uint32_t offset, const CompilerType &type, bool can_create,
+    ConstString name_const_str) {
+  return m_impl.GetSyntheticChildAtOffset(offset, type, can_create,
+                                          name_const_str);
+}
+
+lldb::ValueObjectSP ValueObjectConstResult::AddressOf(Error &error) {
+  return m_impl.AddressOf(error);
+}
+
+lldb::addr_t ValueObjectConstResult::GetAddressOf(bool scalar_is_load_address,
+                                                  AddressType *address_type) {
+  return m_impl.GetAddressOf(scalar_is_load_address, address_type);
+}
+
+ValueObject *ValueObjectConstResult::CreateChildAtIndex(
+    size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
+  return m_impl.CreateChildAtIndex(idx, synthetic_array_member,
+                                   synthetic_index);
+}
+
+size_t ValueObjectConstResult::GetPointeeData(DataExtractor &data,
+                                              uint32_t item_idx,
+                                              uint32_t item_count) {
+  return m_impl.GetPointeeData(data, item_idx, item_count);
 }
 
 lldb::ValueObjectSP
-ValueObjectConstResult::GetDynamicValue (lldb::DynamicValueType use_dynamic)
-{
-    // Always recalculate dynamic values for const results as the memory that
-    // they might point to might have changed at any time.
-    if (use_dynamic != eNoDynamicValues)
-    {
-        if (!IsDynamic())
-        {
-            ExecutionContext exe_ctx (GetExecutionContextRef());
-            Process *process = exe_ctx.GetProcessPtr();
-            if (process && process->IsPossibleDynamicValue(*this))
-                m_dynamic_value = new ValueObjectDynamicValue (*this, use_dynamic);
-        }
-        if (m_dynamic_value)
-            return m_dynamic_value->GetSP();
+ValueObjectConstResult::GetDynamicValue(lldb::DynamicValueType use_dynamic) {
+  // Always recalculate dynamic values for const results as the memory that
+  // they might point to might have changed at any time.
+  if (use_dynamic != eNoDynamicValues) {
+    if (!IsDynamic()) {
+      ExecutionContext exe_ctx(GetExecutionContextRef());
+      Process *process = exe_ctx.GetProcessPtr();
+      if (process && process->IsPossibleDynamicValue(*this))
+        m_dynamic_value = new ValueObjectDynamicValue(*this, use_dynamic);
     }
-    return ValueObjectSP();
+    if (m_dynamic_value)
+      return m_dynamic_value->GetSP();
+  }
+  return ValueObjectSP();
 }
 
 lldb::ValueObjectSP
-ValueObjectConstResult::Cast (const CompilerType &compiler_type)
-{
-    return m_impl.Cast(compiler_type);
+ValueObjectConstResult::Cast(const CompilerType &compiler_type) {
+  return m_impl.Cast(compiler_type);
 }
 
-lldb::LanguageType
-ValueObjectConstResult::GetPreferredDisplayLanguage ()
-{
-    if (m_preferred_display_language != lldb::eLanguageTypeUnknown)
-        return m_preferred_display_language;
-    return GetCompilerTypeImpl().GetMinimumLanguage();
+lldb::LanguageType ValueObjectConstResult::GetPreferredDisplayLanguage() {
+  if (m_preferred_display_language != lldb::eLanguageTypeUnknown)
+    return m_preferred_display_language;
+  return GetCompilerTypeImpl().GetMinimumLanguage();
 }

Modified: lldb/trunk/source/Core/ValueObjectConstResultCast.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResultCast.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectConstResultCast.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectConstResultCast.cpp Tue Sep  6 15:57:50 2016
@@ -17,60 +17,42 @@
 using namespace lldb_private;
 
 ValueObjectConstResultCast::ValueObjectConstResultCast(
-    ValueObject &parent,
-    const ConstString &name,
-    const CompilerType &cast_type,
-    lldb::addr_t live_address) :
-    ValueObjectCast (parent, name, cast_type),
-    m_impl(this, live_address)
-{
-    m_name = name;
+    ValueObject &parent, const ConstString &name, const CompilerType &cast_type,
+    lldb::addr_t live_address)
+    : ValueObjectCast(parent, name, cast_type), m_impl(this, live_address) {
+  m_name = name;
 }
 
-ValueObjectConstResultCast::~ValueObjectConstResultCast()
-{
+ValueObjectConstResultCast::~ValueObjectConstResultCast() {}
+
+lldb::ValueObjectSP ValueObjectConstResultCast::Dereference(Error &error) {
+  return m_impl.Dereference(error);
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResultCast::Dereference (Error &error)
-{
-    return m_impl.Dereference(error);
+lldb::ValueObjectSP ValueObjectConstResultCast::GetSyntheticChildAtOffset(
+    uint32_t offset, const CompilerType &type, bool can_create,
+    ConstString name_const_str) {
+  return m_impl.GetSyntheticChildAtOffset(offset, type, can_create,
+                                          name_const_str);
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResultCast::GetSyntheticChildAtOffset(uint32_t offset,
-                                                      const CompilerType& type,
-                                                      bool can_create,
-                                                      ConstString name_const_str)
-{
-    return m_impl.GetSyntheticChildAtOffset(offset, type, can_create, name_const_str);
+lldb::ValueObjectSP ValueObjectConstResultCast::AddressOf(Error &error) {
+  return m_impl.AddressOf(error);
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResultCast::AddressOf (Error &error)
-{
-    return m_impl.AddressOf(error);
-}
-
-ValueObject *
-ValueObjectConstResultCast::CreateChildAtIndex (size_t idx,
-                                                bool synthetic_array_member,
-                                                int32_t synthetic_index)
-{
-    return m_impl.CreateChildAtIndex(
-        idx, synthetic_array_member, synthetic_index);
-}
-
-size_t
-ValueObjectConstResultCast::GetPointeeData (DataExtractor& data,
-                                             uint32_t item_idx,
-                                             uint32_t item_count)
-{
-    return m_impl.GetPointeeData(data, item_idx, item_count);
+ValueObject *ValueObjectConstResultCast::CreateChildAtIndex(
+    size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
+  return m_impl.CreateChildAtIndex(idx, synthetic_array_member,
+                                   synthetic_index);
+}
+
+size_t ValueObjectConstResultCast::GetPointeeData(DataExtractor &data,
+                                                  uint32_t item_idx,
+                                                  uint32_t item_count) {
+  return m_impl.GetPointeeData(data, item_idx, item_count);
 }
 
 lldb::ValueObjectSP
-ValueObjectConstResultCast::Cast (const CompilerType &compiler_type)
-{
-    return m_impl.Cast(compiler_type);
+ValueObjectConstResultCast::Cast(const CompilerType &compiler_type) {
+  return m_impl.Cast(compiler_type);
 }

Modified: lldb/trunk/source/Core/ValueObjectConstResultChild.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResultChild.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectConstResultChild.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectConstResultChild.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ValueObjectConstResultChild.cpp ------------------------------*- C++ -*-===//
+//===-- ValueObjectConstResultChild.cpp ------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -16,80 +17,49 @@
 
 using namespace lldb_private;
 
-ValueObjectConstResultChild::ValueObjectConstResultChild
-(
-    ValueObject &parent,
-    const CompilerType &compiler_type,
-    const ConstString &name,
-    uint32_t byte_size,
-    int32_t byte_offset,
-    uint32_t bitfield_bit_size,
-    uint32_t bitfield_bit_offset,
-    bool is_base_class,
-    bool is_deref_of_parent,
-    lldb::addr_t live_address,
-    uint64_t language_flags
-) :
-    ValueObjectChild (parent,
-                      compiler_type,
-                      name,
-                      byte_size,
-                      byte_offset,
-                      bitfield_bit_size,
-                      bitfield_bit_offset,
-                      is_base_class,
-                      is_deref_of_parent,
-                      eAddressTypeLoad,
-                      language_flags),
-    m_impl(this, live_address)
-{
-    m_name = name;
+ValueObjectConstResultChild::ValueObjectConstResultChild(
+    ValueObject &parent, const CompilerType &compiler_type,
+    const ConstString &name, uint32_t byte_size, int32_t byte_offset,
+    uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+    bool is_base_class, bool is_deref_of_parent, lldb::addr_t live_address,
+    uint64_t language_flags)
+    : ValueObjectChild(parent, compiler_type, name, byte_size, byte_offset,
+                       bitfield_bit_size, bitfield_bit_offset, is_base_class,
+                       is_deref_of_parent, eAddressTypeLoad, language_flags),
+      m_impl(this, live_address) {
+  m_name = name;
 }
 
-ValueObjectConstResultChild::~ValueObjectConstResultChild()
-{
+ValueObjectConstResultChild::~ValueObjectConstResultChild() {}
+
+lldb::ValueObjectSP ValueObjectConstResultChild::Dereference(Error &error) {
+  return m_impl.Dereference(error);
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResultChild::Dereference (Error &error)
-{
-    return m_impl.Dereference(error);
+lldb::ValueObjectSP ValueObjectConstResultChild::GetSyntheticChildAtOffset(
+    uint32_t offset, const CompilerType &type, bool can_create,
+    ConstString name_const_str) {
+  return m_impl.GetSyntheticChildAtOffset(offset, type, can_create,
+                                          name_const_str);
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResultChild::GetSyntheticChildAtOffset(uint32_t offset,
-                                                       const CompilerType& type,
-                                                       bool can_create,
-                                                       ConstString name_const_str)
-{
-    return m_impl.GetSyntheticChildAtOffset(offset,
-                                            type,
-                                            can_create,
-                                            name_const_str);
+lldb::ValueObjectSP ValueObjectConstResultChild::AddressOf(Error &error) {
+  return m_impl.AddressOf(error);
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResultChild::AddressOf (Error &error)
-{
-    return m_impl.AddressOf(error);
-}
-
-ValueObject *
-ValueObjectConstResultChild::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index)
-{
-    return m_impl.CreateChildAtIndex(idx, synthetic_array_member, synthetic_index);
-}
-
-size_t
-ValueObjectConstResultChild::GetPointeeData (DataExtractor& data,
-                                             uint32_t item_idx,
-                                             uint32_t item_count)
-{
-    return m_impl.GetPointeeData(data, item_idx, item_count);
+ValueObject *ValueObjectConstResultChild::CreateChildAtIndex(
+    size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
+  return m_impl.CreateChildAtIndex(idx, synthetic_array_member,
+                                   synthetic_index);
+}
+
+size_t ValueObjectConstResultChild::GetPointeeData(DataExtractor &data,
+                                                   uint32_t item_idx,
+                                                   uint32_t item_count) {
+  return m_impl.GetPointeeData(data, item_idx, item_count);
 }
 
 lldb::ValueObjectSP
-ValueObjectConstResultChild::Cast (const CompilerType &compiler_type)
-{
-    return m_impl.Cast(compiler_type);
+ValueObjectConstResultChild::Cast(const CompilerType &compiler_type) {
+  return m_impl.Cast(compiler_type);
 }

Modified: lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectConstResultImpl.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ValueObjectConstResultImpl.cpp ---------------------------*- C++ -*-===//
+//===-- ValueObjectConstResultImpl.cpp ---------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -9,14 +10,14 @@
 
 #include "lldb/Core/ValueObjectConstResultImpl.h"
 
+#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/Module.h"
 #include "lldb/Core/ValueObjectChild.h"
 #include "lldb/Core/ValueObjectConstResult.h"
 #include "lldb/Core/ValueObjectConstResultCast.h"
 #include "lldb/Core/ValueObjectConstResultChild.h"
-#include "lldb/Core/ValueObjectMemory.h"
-#include "lldb/Core/DataExtractor.h"
-#include "lldb/Core/Module.h"
 #include "lldb/Core/ValueObjectList.h"
+#include "lldb/Core/ValueObjectMemory.h"
 
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -31,176 +32,143 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ValueObjectConstResultImpl::ValueObjectConstResultImpl (ValueObject* valobj,
-                                                        lldb::addr_t live_address) :
-    m_impl_backend(valobj),
-    m_live_address(live_address),
-    m_live_address_type(eAddressTypeLoad),
-    m_load_addr_backend(),
-    m_address_of_backend()
-{
+ValueObjectConstResultImpl::ValueObjectConstResultImpl(
+    ValueObject *valobj, lldb::addr_t live_address)
+    : m_impl_backend(valobj), m_live_address(live_address),
+      m_live_address_type(eAddressTypeLoad), m_load_addr_backend(),
+      m_address_of_backend() {}
+
+lldb::ValueObjectSP ValueObjectConstResultImpl::Dereference(Error &error) {
+  if (m_impl_backend == NULL)
+    return lldb::ValueObjectSP();
+
+  return m_impl_backend->ValueObject::Dereference(error);
+}
+
+ValueObject *ValueObjectConstResultImpl::CreateChildAtIndex(
+    size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
+  if (m_impl_backend == NULL)
+    return NULL;
+
+  m_impl_backend->UpdateValueIfNeeded(false);
+
+  ValueObjectConstResultChild *valobj = NULL;
+
+  bool omit_empty_base_classes = true;
+  bool ignore_array_bounds = synthetic_array_member;
+  std::string child_name_str;
+  uint32_t child_byte_size = 0;
+  int32_t child_byte_offset = 0;
+  uint32_t child_bitfield_bit_size = 0;
+  uint32_t child_bitfield_bit_offset = 0;
+  bool child_is_base_class = false;
+  bool child_is_deref_of_parent = false;
+  uint64_t language_flags;
+
+  const bool transparent_pointers = synthetic_array_member == false;
+  CompilerType compiler_type = m_impl_backend->GetCompilerType();
+  CompilerType child_compiler_type;
+
+  ExecutionContext exe_ctx(m_impl_backend->GetExecutionContextRef());
+
+  child_compiler_type = compiler_type.GetChildCompilerTypeAtIndex(
+      &exe_ctx, idx, transparent_pointers, omit_empty_base_classes,
+      ignore_array_bounds, child_name_str, child_byte_size, child_byte_offset,
+      child_bitfield_bit_size, child_bitfield_bit_offset, child_is_base_class,
+      child_is_deref_of_parent, m_impl_backend, language_flags);
+  if (child_compiler_type && child_byte_size) {
+    if (synthetic_index)
+      child_byte_offset += child_byte_size * synthetic_index;
+
+    ConstString child_name;
+    if (!child_name_str.empty())
+      child_name.SetCString(child_name_str.c_str());
+
+    valobj = new ValueObjectConstResultChild(
+        *m_impl_backend, child_compiler_type, child_name, child_byte_size,
+        child_byte_offset, child_bitfield_bit_size, child_bitfield_bit_offset,
+        child_is_base_class, child_is_deref_of_parent,
+        m_live_address == LLDB_INVALID_ADDRESS
+            ? m_live_address
+            : m_live_address + child_byte_offset,
+        language_flags);
+  }
+
+  return valobj;
+}
+
+lldb::ValueObjectSP ValueObjectConstResultImpl::GetSyntheticChildAtOffset(
+    uint32_t offset, const CompilerType &type, bool can_create,
+    ConstString name_const_str) {
+  if (m_impl_backend == NULL)
+    return lldb::ValueObjectSP();
+
+  return m_impl_backend->ValueObject::GetSyntheticChildAtOffset(
+      offset, type, can_create, name_const_str);
+}
+
+lldb::ValueObjectSP ValueObjectConstResultImpl::AddressOf(Error &error) {
+  if (m_address_of_backend.get() != NULL)
+    return m_address_of_backend;
+
+  if (m_impl_backend == NULL)
+    return lldb::ValueObjectSP();
+  if (m_live_address != LLDB_INVALID_ADDRESS) {
+    CompilerType compiler_type(m_impl_backend->GetCompilerType());
+
+    lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(
+        &m_live_address, sizeof(lldb::addr_t)));
+
+    std::string new_name("&");
+    new_name.append(m_impl_backend->GetName().AsCString(""));
+    ExecutionContext exe_ctx(m_impl_backend->GetExecutionContextRef());
+    m_address_of_backend = ValueObjectConstResult::Create(
+        exe_ctx.GetBestExecutionContextScope(), compiler_type.GetPointerType(),
+        ConstString(new_name.c_str()), buffer, endian::InlHostByteOrder(),
+        exe_ctx.GetAddressByteSize());
+
+    m_address_of_backend->GetValue().SetValueType(Value::eValueTypeScalar);
+    m_address_of_backend->GetValue().GetScalar() = m_live_address;
+
+    return m_address_of_backend;
+  } else
+    return m_impl_backend->ValueObject::AddressOf(error);
 }
 
 lldb::ValueObjectSP
-ValueObjectConstResultImpl::Dereference (Error &error)
-{
-    if (m_impl_backend == NULL)
-        return lldb::ValueObjectSP();
-    
-    return m_impl_backend->ValueObject::Dereference(error);
-}
-
-ValueObject *
-ValueObjectConstResultImpl::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index)
-{
-    if (m_impl_backend == NULL)
-        return NULL;
-
-    m_impl_backend->UpdateValueIfNeeded(false);
-    
-    ValueObjectConstResultChild *valobj = NULL;
-    
-    bool omit_empty_base_classes = true;
-    bool ignore_array_bounds = synthetic_array_member;
-    std::string child_name_str;
-    uint32_t child_byte_size = 0;
-    int32_t child_byte_offset = 0;
-    uint32_t child_bitfield_bit_size = 0;
-    uint32_t child_bitfield_bit_offset = 0;
-    bool child_is_base_class = false;
-    bool child_is_deref_of_parent = false;
-    uint64_t language_flags;
-    
-    const bool transparent_pointers = synthetic_array_member == false;
-    CompilerType compiler_type = m_impl_backend->GetCompilerType();
-    CompilerType child_compiler_type;
-    
-    ExecutionContext exe_ctx (m_impl_backend->GetExecutionContextRef());
-    
-    child_compiler_type = compiler_type.GetChildCompilerTypeAtIndex (&exe_ctx,
-                                                                     idx,
-                                                                     transparent_pointers,
-                                                                     omit_empty_base_classes,
-                                                                     ignore_array_bounds,
-                                                                     child_name_str,
-                                                                     child_byte_size,
-                                                                     child_byte_offset,
-                                                                     child_bitfield_bit_size,
-                                                                     child_bitfield_bit_offset,
-                                                                     child_is_base_class,
-                                                                     child_is_deref_of_parent,
-                                                                     m_impl_backend,
-                                                                     language_flags);
-    if (child_compiler_type && child_byte_size)
-    {
-        if (synthetic_index)
-            child_byte_offset += child_byte_size * synthetic_index;
-        
-        ConstString child_name;
-        if (!child_name_str.empty())
-            child_name.SetCString (child_name_str.c_str());
-
-        valobj = new ValueObjectConstResultChild (*m_impl_backend,
-                                                  child_compiler_type,
-                                                  child_name,
-                                                  child_byte_size,
-                                                  child_byte_offset,
-                                                  child_bitfield_bit_size,
-                                                  child_bitfield_bit_offset,
-                                                  child_is_base_class,
-                                                  child_is_deref_of_parent,
-                                                  m_live_address == LLDB_INVALID_ADDRESS ? m_live_address : m_live_address+child_byte_offset,
-                                                  language_flags);
-    }
-    
-    return valobj;
+ValueObjectConstResultImpl::Cast(const CompilerType &compiler_type) {
+  if (m_impl_backend == NULL)
+    return lldb::ValueObjectSP();
+
+  ValueObjectConstResultCast *result_cast =
+      new ValueObjectConstResultCast(*m_impl_backend, m_impl_backend->GetName(),
+                                     compiler_type, m_live_address);
+  return result_cast->GetSP();
 }
 
-lldb::ValueObjectSP
-ValueObjectConstResultImpl::GetSyntheticChildAtOffset (uint32_t offset,
-                                                       const CompilerType& type,
-                                                       bool can_create,
-                                                       ConstString name_const_str)
-{
-    if (m_impl_backend == NULL)
-        return lldb::ValueObjectSP();
-
-    return m_impl_backend->ValueObject::GetSyntheticChildAtOffset(offset,
-                                                                  type,
-                                                                  can_create,
-                                                                  name_const_str);
-}
+lldb::addr_t
+ValueObjectConstResultImpl::GetAddressOf(bool scalar_is_load_address,
+                                         AddressType *address_type) {
 
-lldb::ValueObjectSP
-ValueObjectConstResultImpl::AddressOf (Error &error)
-{
-    if (m_address_of_backend.get() != NULL)
-        return m_address_of_backend;
-    
-    if (m_impl_backend == NULL)
-        return lldb::ValueObjectSP();
-    if (m_live_address != LLDB_INVALID_ADDRESS)
-    {
-        CompilerType compiler_type(m_impl_backend->GetCompilerType());
-        
-        lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&m_live_address,sizeof(lldb::addr_t)));
-        
-        std::string new_name("&");
-        new_name.append(m_impl_backend->GetName().AsCString(""));
-        ExecutionContext exe_ctx (m_impl_backend->GetExecutionContextRef());
-        m_address_of_backend = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
-                                                               compiler_type.GetPointerType(),
-                                                               ConstString(new_name.c_str()),
-                                                               buffer,
-                                                               endian::InlHostByteOrder(),
-                                                               exe_ctx.GetAddressByteSize());
-        
-        m_address_of_backend->GetValue().SetValueType(Value::eValueTypeScalar);
-        m_address_of_backend->GetValue().GetScalar() = m_live_address;
-        
-        return m_address_of_backend;
-    }
-    else
-        return m_impl_backend->ValueObject::AddressOf(error);
-}
+  if (m_impl_backend == NULL)
+    return 0;
 
-lldb::ValueObjectSP
-ValueObjectConstResultImpl::Cast (const CompilerType &compiler_type)
-{
-    if (m_impl_backend == NULL)
-        return lldb::ValueObjectSP();
-
-    ValueObjectConstResultCast *result_cast = new ValueObjectConstResultCast(
-        *m_impl_backend, m_impl_backend->GetName(), compiler_type, m_live_address);
-    return result_cast->GetSP();
-}
-
-lldb::addr_t
-ValueObjectConstResultImpl::GetAddressOf (bool scalar_is_load_address,
-                                          AddressType *address_type)
-{
-    
-    if (m_impl_backend == NULL)
-        return 0;
-    
-    if (m_live_address == LLDB_INVALID_ADDRESS)
-    {
-        return m_impl_backend->ValueObject::GetAddressOf (scalar_is_load_address,
-                                                          address_type);
-    }
-    
-    if (address_type)
-        *address_type = m_live_address_type;
-        
-    return m_live_address;
-}
-
-size_t
-ValueObjectConstResultImpl::GetPointeeData (DataExtractor& data,
-                                            uint32_t item_idx,
-                                            uint32_t item_count)
-{
-    if (m_impl_backend == NULL)
-        return 0;
-    return m_impl_backend->ValueObject::GetPointeeData(data, item_idx, item_count);
+  if (m_live_address == LLDB_INVALID_ADDRESS) {
+    return m_impl_backend->ValueObject::GetAddressOf(scalar_is_load_address,
+                                                     address_type);
+  }
+
+  if (address_type)
+    *address_type = m_live_address_type;
+
+  return m_live_address;
+}
+
+size_t ValueObjectConstResultImpl::GetPointeeData(DataExtractor &data,
+                                                  uint32_t item_idx,
+                                                  uint32_t item_count) {
+  if (m_impl_backend == NULL)
+    return 0;
+  return m_impl_backend->ValueObject::GetPointeeData(data, item_idx,
+                                                     item_count);
 }

Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ValueObjectDynamicValue.cpp ---------------------------------*- C++ -*-===//
+//===-- ValueObjectDynamicValue.cpp ---------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -7,7 +8,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #include "lldb/Core/ValueObjectDynamicValue.h"
 
 // C Includes
@@ -16,9 +16,9 @@
 // Project includes
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
-#include "lldb/Core/ValueObjectList.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectList.h"
 
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -35,427 +35,365 @@
 
 using namespace lldb_private;
 
-ValueObjectDynamicValue::ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic) :
-    ValueObject(parent),
-    m_address (),
-    m_dynamic_type_info(),
-    m_use_dynamic (use_dynamic)
-{
-    SetName (parent.GetName());
-}
-
-ValueObjectDynamicValue::~ValueObjectDynamicValue()
-{
-    m_owning_valobj_sp.reset();
-}
-
-CompilerType
-ValueObjectDynamicValue::GetCompilerTypeImpl ()
-{
-    const bool success = UpdateValueIfNeeded(false);
-    if (success)
-    {
-        if (m_dynamic_type_info.HasType())
-            return m_value.GetCompilerType();
-        else
-            return m_parent->GetCompilerType();
-    }
-    return m_parent->GetCompilerType();
-}
-
-ConstString
-ValueObjectDynamicValue::GetTypeName()
-{
-    const bool success = UpdateValueIfNeeded(false);
-    if (success)
-    {
-        if (m_dynamic_type_info.HasName())
-            return m_dynamic_type_info.GetName();
-    }
-    return m_parent->GetTypeName();
-}
-
-TypeImpl
-ValueObjectDynamicValue::GetTypeImpl ()
-{
-    const bool success = UpdateValueIfNeeded(false);
-    if (success && m_type_impl.IsValid())
-    {
-        return m_type_impl;
-    }
-    return m_parent->GetTypeImpl();
-}
-
-ConstString
-ValueObjectDynamicValue::GetQualifiedTypeName()
-{
-    const bool success = UpdateValueIfNeeded(false);
-    if (success)
-    {
-        if (m_dynamic_type_info.HasName())
-            return m_dynamic_type_info.GetName();
-    }
-    return m_parent->GetQualifiedTypeName();
-}
-
-ConstString
-ValueObjectDynamicValue::GetDisplayTypeName()
-{
-    const bool success = UpdateValueIfNeeded(false);
-    if (success)
-    {
-        if (m_dynamic_type_info.HasType())
-            return GetCompilerType().GetDisplayTypeName();
-        if (m_dynamic_type_info.HasName())
-            return m_dynamic_type_info.GetName();
-    }
-    return m_parent->GetDisplayTypeName();
-}
-
-size_t
-ValueObjectDynamicValue::CalculateNumChildren(uint32_t max)
-{
-    const bool success = UpdateValueIfNeeded(false);
-    if (success && m_dynamic_type_info.HasType())
-    {
-        auto children_count = GetCompilerType().GetNumChildren (true);
-        return children_count <= max ? children_count : max;
-    }
-    else
-        return m_parent->GetNumChildren(max);
-}
-
-uint64_t
-ValueObjectDynamicValue::GetByteSize()
-{
-    const bool success = UpdateValueIfNeeded(false);
-    if (success && m_dynamic_type_info.HasType())
-    {
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        return m_value.GetValueByteSize(nullptr, &exe_ctx);
-    }
-    else
-        return m_parent->GetByteSize();
-}
-
-lldb::ValueType
-ValueObjectDynamicValue::GetValueType() const
-{
-    return m_parent->GetValueType();
-}
-
-bool
-ValueObjectDynamicValue::UpdateValue ()
-{
-    SetValueIsValid (false);
-    m_error.Clear();
-
-    if (!m_parent->UpdateValueIfNeeded(false))
-    {
-        // The dynamic value failed to get an error, pass the error along
-        if (m_error.Success() && m_parent->GetError().Fail())
-            m_error = m_parent->GetError();
-        return false;
-    }
-
-    // Setting our type_sp to NULL will route everything back through our
-    // parent which is equivalent to not using dynamic values.
-    if (m_use_dynamic == lldb::eNoDynamicValues)
-    {
-        m_dynamic_type_info.Clear();
-        return true;
-    }
-
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    Target *target = exe_ctx.GetTargetPtr();
-    if (target)
-    {
-        m_data.SetByteOrder(target->GetArchitecture().GetByteOrder());
-        m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
-    }
-
-    // First make sure our Type and/or Address haven't changed:
-    Process *process = exe_ctx.GetProcessPtr();
-    if (!process)
-        return false;
-
-    TypeAndOrName class_type_or_name;
-    Address dynamic_address;
-    bool found_dynamic_type = false;
-    Value::ValueType value_type;
-    
-    LanguageRuntime *runtime = nullptr;
-
-    lldb::LanguageType known_type = m_parent->GetObjectRuntimeLanguage();
-    if (known_type != lldb::eLanguageTypeUnknown && known_type != lldb::eLanguageTypeC)
-    {
-        runtime = process->GetLanguageRuntime (known_type);
-        if (runtime)
-            found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address, value_type);
-    }
-    else
-    {
-        runtime = process->GetLanguageRuntime (lldb::eLanguageTypeC_plus_plus);
-        if (runtime)
-            found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address, value_type);
-
-        if (!found_dynamic_type)
-        {
-            runtime = process->GetLanguageRuntime (lldb::eLanguageTypeObjC);
-            if (runtime)
-                found_dynamic_type = runtime->GetDynamicTypeAndAddress (*m_parent, m_use_dynamic, class_type_or_name, dynamic_address, value_type);
-        }
-    }
-
-    // Getting the dynamic value may have run the program a bit, and so marked us as needing updating, but we really
-    // don't...
-
-    m_update_point.SetUpdated();
-
-    if (runtime && found_dynamic_type)
-    {
-        if (class_type_or_name.HasType())
-        {
-            m_type_impl = TypeImpl(m_parent->GetCompilerType(),
-                                   runtime->FixUpDynamicType(class_type_or_name, *m_parent).GetCompilerType());
-        }
-        else
-        {
-            m_type_impl.Clear();
-        }
-    }
+ValueObjectDynamicValue::ValueObjectDynamicValue(
+    ValueObject &parent, lldb::DynamicValueType use_dynamic)
+    : ValueObject(parent), m_address(), m_dynamic_type_info(),
+      m_use_dynamic(use_dynamic) {
+  SetName(parent.GetName());
+}
+
+ValueObjectDynamicValue::~ValueObjectDynamicValue() {
+  m_owning_valobj_sp.reset();
+}
+
+CompilerType ValueObjectDynamicValue::GetCompilerTypeImpl() {
+  const bool success = UpdateValueIfNeeded(false);
+  if (success) {
+    if (m_dynamic_type_info.HasType())
+      return m_value.GetCompilerType();
     else
-    {
-        m_type_impl.Clear();
-    }
-
-    // If we don't have a dynamic type, then make ourselves just a echo of our parent.
-    // Or we could return false, and make ourselves an echo of our parent?
-    if (!found_dynamic_type)
-    {
-        if (m_dynamic_type_info)
-            SetValueDidChange(true);
-        ClearDynamicTypeInformation();
-        m_dynamic_type_info.Clear();
-        m_value = m_parent->GetValue();
-        m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
-        return m_error.Success();
-    }
-
-    Value old_value(m_value);
-
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
-
-    bool has_changed_type = false;
-
-    if (!m_dynamic_type_info)
-    {
-        m_dynamic_type_info = class_type_or_name;
-        has_changed_type = true;
-    }
-    else if (class_type_or_name != m_dynamic_type_info)
-    {
-        // We are another type, we need to tear down our children...
-        m_dynamic_type_info = class_type_or_name;
-        SetValueDidChange (true);
-        has_changed_type = true;
-    }
-
-    if (has_changed_type)
-        ClearDynamicTypeInformation ();
+      return m_parent->GetCompilerType();
+  }
+  return m_parent->GetCompilerType();
+}
+
+ConstString ValueObjectDynamicValue::GetTypeName() {
+  const bool success = UpdateValueIfNeeded(false);
+  if (success) {
+    if (m_dynamic_type_info.HasName())
+      return m_dynamic_type_info.GetName();
+  }
+  return m_parent->GetTypeName();
+}
+
+TypeImpl ValueObjectDynamicValue::GetTypeImpl() {
+  const bool success = UpdateValueIfNeeded(false);
+  if (success && m_type_impl.IsValid()) {
+    return m_type_impl;
+  }
+  return m_parent->GetTypeImpl();
+}
+
+ConstString ValueObjectDynamicValue::GetQualifiedTypeName() {
+  const bool success = UpdateValueIfNeeded(false);
+  if (success) {
+    if (m_dynamic_type_info.HasName())
+      return m_dynamic_type_info.GetName();
+  }
+  return m_parent->GetQualifiedTypeName();
+}
+
+ConstString ValueObjectDynamicValue::GetDisplayTypeName() {
+  const bool success = UpdateValueIfNeeded(false);
+  if (success) {
+    if (m_dynamic_type_info.HasType())
+      return GetCompilerType().GetDisplayTypeName();
+    if (m_dynamic_type_info.HasName())
+      return m_dynamic_type_info.GetName();
+  }
+  return m_parent->GetDisplayTypeName();
+}
+
+size_t ValueObjectDynamicValue::CalculateNumChildren(uint32_t max) {
+  const bool success = UpdateValueIfNeeded(false);
+  if (success && m_dynamic_type_info.HasType()) {
+    auto children_count = GetCompilerType().GetNumChildren(true);
+    return children_count <= max ? children_count : max;
+  } else
+    return m_parent->GetNumChildren(max);
+}
+
+uint64_t ValueObjectDynamicValue::GetByteSize() {
+  const bool success = UpdateValueIfNeeded(false);
+  if (success && m_dynamic_type_info.HasType()) {
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    return m_value.GetValueByteSize(nullptr, &exe_ctx);
+  } else
+    return m_parent->GetByteSize();
+}
+
+lldb::ValueType ValueObjectDynamicValue::GetValueType() const {
+  return m_parent->GetValueType();
+}
+
+bool ValueObjectDynamicValue::UpdateValue() {
+  SetValueIsValid(false);
+  m_error.Clear();
+
+  if (!m_parent->UpdateValueIfNeeded(false)) {
+    // The dynamic value failed to get an error, pass the error along
+    if (m_error.Success() && m_parent->GetError().Fail())
+      m_error = m_parent->GetError();
+    return false;
+  }
 
-    if (!m_address.IsValid() || m_address != dynamic_address)
-    {
-        if (m_address.IsValid())
-            SetValueDidChange (true);
-
-        // We've moved, so we should be fine...
-        m_address = dynamic_address;
-        lldb::TargetSP target_sp (GetTargetSP());
-        lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
-        m_value.GetScalar() = load_address;
-    }
+  // Setting our type_sp to NULL will route everything back through our
+  // parent which is equivalent to not using dynamic values.
+  if (m_use_dynamic == lldb::eNoDynamicValues) {
+    m_dynamic_type_info.Clear();
+    return true;
+  }
+
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  Target *target = exe_ctx.GetTargetPtr();
+  if (target) {
+    m_data.SetByteOrder(target->GetArchitecture().GetByteOrder());
+    m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
+  }
+
+  // First make sure our Type and/or Address haven't changed:
+  Process *process = exe_ctx.GetProcessPtr();
+  if (!process)
+    return false;
 
+  TypeAndOrName class_type_or_name;
+  Address dynamic_address;
+  bool found_dynamic_type = false;
+  Value::ValueType value_type;
+
+  LanguageRuntime *runtime = nullptr;
+
+  lldb::LanguageType known_type = m_parent->GetObjectRuntimeLanguage();
+  if (known_type != lldb::eLanguageTypeUnknown &&
+      known_type != lldb::eLanguageTypeC) {
+    runtime = process->GetLanguageRuntime(known_type);
     if (runtime)
-        m_dynamic_type_info = runtime->FixUpDynamicType(m_dynamic_type_info, *m_parent);
-
-    //m_value.SetContext (Value::eContextTypeClangType, corrected_type);
-    m_value.SetCompilerType (m_dynamic_type_info.GetCompilerType());
-
-    m_value.SetValueType(value_type);
+      found_dynamic_type = runtime->GetDynamicTypeAndAddress(
+          *m_parent, m_use_dynamic, class_type_or_name, dynamic_address,
+          value_type);
+  } else {
+    runtime = process->GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus);
+    if (runtime)
+      found_dynamic_type = runtime->GetDynamicTypeAndAddress(
+          *m_parent, m_use_dynamic, class_type_or_name, dynamic_address,
+          value_type);
+
+    if (!found_dynamic_type) {
+      runtime = process->GetLanguageRuntime(lldb::eLanguageTypeObjC);
+      if (runtime)
+        found_dynamic_type = runtime->GetDynamicTypeAndAddress(
+            *m_parent, m_use_dynamic, class_type_or_name, dynamic_address,
+            value_type);
+    }
+  }
+
+  // Getting the dynamic value may have run the program a bit, and so marked us
+  // as needing updating, but we really
+  // don't...
+
+  m_update_point.SetUpdated();
+
+  if (runtime && found_dynamic_type) {
+    if (class_type_or_name.HasType()) {
+      m_type_impl =
+          TypeImpl(m_parent->GetCompilerType(),
+                   runtime->FixUpDynamicType(class_type_or_name, *m_parent)
+                       .GetCompilerType());
+    } else {
+      m_type_impl.Clear();
+    }
+  } else {
+    m_type_impl.Clear();
+  }
+
+  // If we don't have a dynamic type, then make ourselves just a echo of our
+  // parent.
+  // Or we could return false, and make ourselves an echo of our parent?
+  if (!found_dynamic_type) {
+    if (m_dynamic_type_info)
+      SetValueDidChange(true);
+    ClearDynamicTypeInformation();
+    m_dynamic_type_info.Clear();
+    m_value = m_parent->GetValue();
+    m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+    return m_error.Success();
+  }
+
+  Value old_value(m_value);
+
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
+
+  bool has_changed_type = false;
+
+  if (!m_dynamic_type_info) {
+    m_dynamic_type_info = class_type_or_name;
+    has_changed_type = true;
+  } else if (class_type_or_name != m_dynamic_type_info) {
+    // We are another type, we need to tear down our children...
+    m_dynamic_type_info = class_type_or_name;
+    SetValueDidChange(true);
+    has_changed_type = true;
+  }
+
+  if (has_changed_type)
+    ClearDynamicTypeInformation();
+
+  if (!m_address.IsValid() || m_address != dynamic_address) {
+    if (m_address.IsValid())
+      SetValueDidChange(true);
+
+    // We've moved, so we should be fine...
+    m_address = dynamic_address;
+    lldb::TargetSP target_sp(GetTargetSP());
+    lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
+    m_value.GetScalar() = load_address;
+  }
+
+  if (runtime)
+    m_dynamic_type_info =
+        runtime->FixUpDynamicType(m_dynamic_type_info, *m_parent);
+
+  // m_value.SetContext (Value::eContextTypeClangType, corrected_type);
+  m_value.SetCompilerType(m_dynamic_type_info.GetCompilerType());
+
+  m_value.SetValueType(value_type);
+
+  if (has_changed_type && log)
+    log->Printf("[%s %p] has a new dynamic type %s", GetName().GetCString(),
+                static_cast<void *>(this), GetTypeName().GetCString());
+
+  if (m_address.IsValid() && m_dynamic_type_info) {
+    // The variable value is in the Scalar value inside the m_value.
+    // We can point our m_data right to it.
+    m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+    if (m_error.Success()) {
+      if (!CanProvideValue()) {
+        // this value object represents an aggregate type whose
+        // children have values, but this object does not. So we
+        // say we are changed if our location has changed.
+        SetValueDidChange(m_value.GetValueType() != old_value.GetValueType() ||
+                          m_value.GetScalar() != old_value.GetScalar());
+      }
+
+      SetValueIsValid(true);
+      return true;
+    }
+  }
+
+  // We get here if we've failed above...
+  SetValueIsValid(false);
+  return false;
+}
+
+bool ValueObjectDynamicValue::IsInScope() { return m_parent->IsInScope(); }
+
+bool ValueObjectDynamicValue::SetValueFromCString(const char *value_str,
+                                                  Error &error) {
+  if (!UpdateValueIfNeeded(false)) {
+    error.SetErrorString("unable to read value");
+    return false;
+  }
 
-    if (has_changed_type && log)
-        log->Printf("[%s %p] has a new dynamic type %s", GetName().GetCString(),
-                    static_cast<void*>(this), GetTypeName().GetCString());
-
-    if (m_address.IsValid() && m_dynamic_type_info)
-    {
-        // The variable value is in the Scalar value inside the m_value.
-        // We can point our m_data right to it.
-        m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
-        if (m_error.Success())
-        {
-            if (!CanProvideValue())
-            {
-                // this value object represents an aggregate type whose
-                // children have values, but this object does not. So we
-                // say we are changed if our location has changed.
-                SetValueDidChange (m_value.GetValueType() != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
-            }
-
-            SetValueIsValid (true);
-            return true;
-        }
-    }
+  uint64_t my_value = GetValueAsUnsigned(UINT64_MAX);
+  uint64_t parent_value = m_parent->GetValueAsUnsigned(UINT64_MAX);
 
-    // We get here if we've failed above...
-    SetValueIsValid (false);
+  if (my_value == UINT64_MAX || parent_value == UINT64_MAX) {
+    error.SetErrorString("unable to read value");
     return false;
-}
-
+  }
 
+  // if we are at an offset from our parent, in order to set ourselves correctly
+  // we would need
+  // to change the new value so that it refers to the correct dynamic type. we
+  // choose not to deal
+  // with that - if anything more than a value overwrite is required, you should
+  // be using the
+  // expression parser instead of the value editing facility
+  if (my_value != parent_value) {
+    // but NULL'ing out a value should always be allowed
+    if (strcmp(value_str, "0")) {
+      error.SetErrorString(
+          "unable to modify dynamic value, use 'expression' command");
+      return false;
+    }
+  }
+
+  bool ret_val = m_parent->SetValueFromCString(value_str, error);
+  SetNeedsUpdate();
+  return ret_val;
+}
+
+bool ValueObjectDynamicValue::SetData(DataExtractor &data, Error &error) {
+  if (!UpdateValueIfNeeded(false)) {
+    error.SetErrorString("unable to read value");
+    return false;
+  }
 
-bool
-ValueObjectDynamicValue::IsInScope ()
-{
-    return m_parent->IsInScope();
-}
+  uint64_t my_value = GetValueAsUnsigned(UINT64_MAX);
+  uint64_t parent_value = m_parent->GetValueAsUnsigned(UINT64_MAX);
 
-bool
-ValueObjectDynamicValue::SetValueFromCString (const char *value_str, Error& error)
-{
-    if (!UpdateValueIfNeeded(false))
-    {
-        error.SetErrorString("unable to read value");
-        return false;
-    }
-    
-    uint64_t my_value = GetValueAsUnsigned(UINT64_MAX);
-    uint64_t parent_value = m_parent->GetValueAsUnsigned(UINT64_MAX);
-    
-    if (my_value == UINT64_MAX || parent_value == UINT64_MAX)
-    {
-        error.SetErrorString("unable to read value");
-        return false;
-    }
-    
-    // if we are at an offset from our parent, in order to set ourselves correctly we would need
-    // to change the new value so that it refers to the correct dynamic type. we choose not to deal
-    // with that - if anything more than a value overwrite is required, you should be using the
-    // expression parser instead of the value editing facility
-    if (my_value != parent_value)
-    {
-        // but NULL'ing out a value should always be allowed
-        if (strcmp(value_str,"0"))
-        {
-            error.SetErrorString("unable to modify dynamic value, use 'expression' command");
-            return false;
-        }
-    }
-    
-    bool ret_val = m_parent->SetValueFromCString(value_str,error);
-    SetNeedsUpdate();
-    return ret_val;
-}
+  if (my_value == UINT64_MAX || parent_value == UINT64_MAX) {
+    error.SetErrorString("unable to read value");
+    return false;
+  }
 
-bool
-ValueObjectDynamicValue::SetData (DataExtractor &data, Error &error)
-{
-    if (!UpdateValueIfNeeded(false))
-    {
-        error.SetErrorString("unable to read value");
-        return false;
-    }
-    
-    uint64_t my_value = GetValueAsUnsigned(UINT64_MAX);
-    uint64_t parent_value = m_parent->GetValueAsUnsigned(UINT64_MAX);
-    
-    if (my_value == UINT64_MAX || parent_value == UINT64_MAX)
-    {
-        error.SetErrorString("unable to read value");
-        return false;
-    }
-    
-    // if we are at an offset from our parent, in order to set ourselves correctly we would need
-    // to change the new value so that it refers to the correct dynamic type. we choose not to deal
-    // with that - if anything more than a value overwrite is required, you should be using the
-    // expression parser instead of the value editing facility
-    if (my_value != parent_value)
-    {
-        // but NULL'ing out a value should always be allowed
-        lldb::offset_t offset = 0;
-        
-        if (data.GetPointer(&offset) != 0)
-        {
-            error.SetErrorString("unable to modify dynamic value, use 'expression' command");
-            return false;
-        }
-    }
-    
-    bool ret_val = m_parent->SetData(data, error);
-    SetNeedsUpdate();
-    return ret_val;
+  // if we are at an offset from our parent, in order to set ourselves correctly
+  // we would need
+  // to change the new value so that it refers to the correct dynamic type. we
+  // choose not to deal
+  // with that - if anything more than a value overwrite is required, you should
+  // be using the
+  // expression parser instead of the value editing facility
+  if (my_value != parent_value) {
+    // but NULL'ing out a value should always be allowed
+    lldb::offset_t offset = 0;
+
+    if (data.GetPointer(&offset) != 0) {
+      error.SetErrorString(
+          "unable to modify dynamic value, use 'expression' command");
+      return false;
+    }
+  }
+
+  bool ret_val = m_parent->SetData(data, error);
+  SetNeedsUpdate();
+  return ret_val;
+}
+
+void ValueObjectDynamicValue::SetPreferredDisplayLanguage(
+    lldb::LanguageType lang) {
+  this->ValueObject::SetPreferredDisplayLanguage(lang);
+  if (m_parent)
+    m_parent->SetPreferredDisplayLanguage(lang);
 }
 
-void
-ValueObjectDynamicValue::SetPreferredDisplayLanguage (lldb::LanguageType lang)
-{
-    this->ValueObject::SetPreferredDisplayLanguage(lang);
+lldb::LanguageType ValueObjectDynamicValue::GetPreferredDisplayLanguage() {
+  if (m_preferred_display_language == lldb::eLanguageTypeUnknown) {
     if (m_parent)
-        m_parent->SetPreferredDisplayLanguage(lang);
-}
-
-lldb::LanguageType
-ValueObjectDynamicValue::GetPreferredDisplayLanguage ()
-{
-    if (m_preferred_display_language == lldb::eLanguageTypeUnknown)
-    {
-        if (m_parent)
-            return m_parent->GetPreferredDisplayLanguage();
-        return lldb::eLanguageTypeUnknown;
-    }
-    else
-        return m_preferred_display_language;
+      return m_parent->GetPreferredDisplayLanguage();
+    return lldb::eLanguageTypeUnknown;
+  } else
+    return m_preferred_display_language;
 }
 
-bool
-ValueObjectDynamicValue::IsSyntheticChildrenGenerated ()
-{
-    if (m_parent)
-        return m_parent->IsSyntheticChildrenGenerated();
-    return false;
+bool ValueObjectDynamicValue::IsSyntheticChildrenGenerated() {
+  if (m_parent)
+    return m_parent->IsSyntheticChildrenGenerated();
+  return false;
 }
 
-void
-ValueObjectDynamicValue::SetSyntheticChildrenGenerated (bool b)
-{
-    if (m_parent)
-        m_parent->SetSyntheticChildrenGenerated(b);
-    this->ValueObject::SetSyntheticChildrenGenerated(b);
+void ValueObjectDynamicValue::SetSyntheticChildrenGenerated(bool b) {
+  if (m_parent)
+    m_parent->SetSyntheticChildrenGenerated(b);
+  this->ValueObject::SetSyntheticChildrenGenerated(b);
 }
 
-bool
-ValueObjectDynamicValue::GetDeclaration (Declaration &decl)
-{
-    if (m_parent)
-        return m_parent->GetDeclaration(decl);
+bool ValueObjectDynamicValue::GetDeclaration(Declaration &decl) {
+  if (m_parent)
+    return m_parent->GetDeclaration(decl);
 
-    return ValueObject::GetDeclaration(decl);
+  return ValueObject::GetDeclaration(decl);
 }
 
-uint64_t
-ValueObjectDynamicValue::GetLanguageFlags ()
-{
-    if (m_parent)
-        return m_parent->GetLanguageFlags();
-    return this->ValueObject::GetLanguageFlags();
+uint64_t ValueObjectDynamicValue::GetLanguageFlags() {
+  if (m_parent)
+    return m_parent->GetLanguageFlags();
+  return this->ValueObject::GetLanguageFlags();
 }
 
-void
-ValueObjectDynamicValue::SetLanguageFlags (uint64_t flags)
-{
-    if (m_parent)
-        m_parent->SetLanguageFlags(flags);
-    else
-        this->ValueObject::SetLanguageFlags(flags);
+void ValueObjectDynamicValue::SetLanguageFlags(uint64_t flags) {
+  if (m_parent)
+    m_parent->SetLanguageFlags(flags);
+  else
+    this->ValueObject::SetLanguageFlags(flags);
 }

Modified: lldb/trunk/source/Core/ValueObjectList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectList.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectList.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectList.cpp Tue Sep  6 15:57:50 2016
@@ -22,145 +22,101 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ValueObjectList::ValueObjectList () :
-    m_value_objects()
-{
-}
+ValueObjectList::ValueObjectList() : m_value_objects() {}
 
-ValueObjectList::ValueObjectList (const ValueObjectList &rhs) :
-    m_value_objects(rhs.m_value_objects)
-{
-}
+ValueObjectList::ValueObjectList(const ValueObjectList &rhs)
+    : m_value_objects(rhs.m_value_objects) {}
 
+ValueObjectList::~ValueObjectList() {}
 
-ValueObjectList::~ValueObjectList ()
-{
+const ValueObjectList &ValueObjectList::operator=(const ValueObjectList &rhs) {
+  if (this != &rhs)
+    m_value_objects = rhs.m_value_objects;
+  return *this;
 }
 
-const ValueObjectList &
-ValueObjectList::operator = (const ValueObjectList &rhs)
-{
-    if (this != &rhs)
-        m_value_objects = rhs.m_value_objects;
-    return *this;
+void ValueObjectList::Append(const ValueObjectSP &val_obj_sp) {
+  m_value_objects.push_back(val_obj_sp);
 }
 
-void
-ValueObjectList::Append (const ValueObjectSP &val_obj_sp)
-{
-    m_value_objects.push_back(val_obj_sp);
+void ValueObjectList::Append(const ValueObjectList &valobj_list) {
+  std::copy(valobj_list.m_value_objects.begin(), // source begin
+            valobj_list.m_value_objects.end(),   // source end
+            back_inserter(m_value_objects));     // destination
 }
 
-void
-ValueObjectList::Append (const ValueObjectList &valobj_list)
-{
-    std::copy(valobj_list.m_value_objects.begin(),  // source begin
-              valobj_list.m_value_objects.end(),    // source end
-              back_inserter(m_value_objects));      // destination
-    
-}
+size_t ValueObjectList::GetSize() const { return m_value_objects.size(); }
 
+void ValueObjectList::Resize(size_t size) { m_value_objects.resize(size); }
 
-size_t
-ValueObjectList::GetSize() const
-{
-    return m_value_objects.size();
+lldb::ValueObjectSP ValueObjectList::GetValueObjectAtIndex(size_t idx) {
+  lldb::ValueObjectSP valobj_sp;
+  if (idx < m_value_objects.size())
+    valobj_sp = m_value_objects[idx];
+  return valobj_sp;
 }
 
-void
-ValueObjectList::Resize (size_t size)
-{
-    m_value_objects.resize (size);
+lldb::ValueObjectSP ValueObjectList::RemoveValueObjectAtIndex(size_t idx) {
+  lldb::ValueObjectSP valobj_sp;
+  if (idx < m_value_objects.size()) {
+    valobj_sp = m_value_objects[idx];
+    m_value_objects.erase(m_value_objects.begin() + idx);
+  }
+  return valobj_sp;
 }
 
-lldb::ValueObjectSP
-ValueObjectList::GetValueObjectAtIndex (size_t idx)
-{
-    lldb::ValueObjectSP valobj_sp;
-    if (idx < m_value_objects.size())
-        valobj_sp = m_value_objects[idx];
-    return valobj_sp;
+void ValueObjectList::SetValueObjectAtIndex(size_t idx,
+                                            const ValueObjectSP &valobj_sp) {
+  if (idx >= m_value_objects.size())
+    m_value_objects.resize(idx + 1);
+  m_value_objects[idx] = valobj_sp;
 }
 
-lldb::ValueObjectSP
-ValueObjectList::RemoveValueObjectAtIndex (size_t idx)
-{
-    lldb::ValueObjectSP valobj_sp;
-    if (idx < m_value_objects.size())
-    {
-        valobj_sp = m_value_objects[idx];
-        m_value_objects.erase (m_value_objects.begin() + idx);
+ValueObjectSP ValueObjectList::FindValueObjectByValueName(const char *name) {
+  ConstString name_const_str(name);
+  ValueObjectSP val_obj_sp;
+  collection::iterator pos, end = m_value_objects.end();
+  for (pos = m_value_objects.begin(); pos != end; ++pos) {
+    ValueObject *valobj = (*pos).get();
+    if (valobj && valobj->GetName() == name_const_str) {
+      val_obj_sp = *pos;
+      break;
     }
-    return valobj_sp;
+  }
+  return val_obj_sp;
 }
 
-void
-ValueObjectList::SetValueObjectAtIndex (size_t idx, const ValueObjectSP &valobj_sp)
-{
-    if (idx >= m_value_objects.size())
-        m_value_objects.resize (idx + 1);
-    m_value_objects[idx] = valobj_sp;
-}
-
-ValueObjectSP
-ValueObjectList::FindValueObjectByValueName (const char *name)
-{
-    ConstString name_const_str(name);
-    ValueObjectSP val_obj_sp;
-    collection::iterator pos, end = m_value_objects.end();
-    for (pos = m_value_objects.begin(); pos != end; ++pos)
-    {
-        ValueObject *valobj = (*pos).get();
-        if (valobj && valobj->GetName() == name_const_str)
-        {
-            val_obj_sp = *pos;
-            break;
-        }
+ValueObjectSP ValueObjectList::FindValueObjectByUID(lldb::user_id_t uid) {
+  ValueObjectSP valobj_sp;
+  collection::iterator pos, end = m_value_objects.end();
+
+  for (pos = m_value_objects.begin(); pos != end; ++pos) {
+    // Watch out for NULL objects in our list as the list
+    // might get resized to a specific size and lazily filled in
+    ValueObject *valobj = (*pos).get();
+    if (valobj && valobj->GetID() == uid) {
+      valobj_sp = *pos;
+      break;
     }
-    return val_obj_sp;
+  }
+  return valobj_sp;
 }
 
 ValueObjectSP
-ValueObjectList::FindValueObjectByUID (lldb::user_id_t uid)
-{
-    ValueObjectSP valobj_sp;
-    collection::iterator pos, end = m_value_objects.end();
-
-    for (pos = m_value_objects.begin(); pos != end; ++pos)
-    {
-        // Watch out for NULL objects in our list as the list
-        // might get resized to a specific size and lazily filled in
-        ValueObject *valobj = (*pos).get();
-        if (valobj && valobj->GetID() == uid)
-        {
-            valobj_sp = *pos;
-            break;
-        }
-    }
-    return valobj_sp;
-}
-
-
-ValueObjectSP
-ValueObjectList::FindValueObjectByPointer (ValueObject *find_valobj)
-{
-    ValueObjectSP valobj_sp;
-    collection::iterator pos, end = m_value_objects.end();
-
-    for (pos = m_value_objects.begin(); pos != end; ++pos)
-    {
-        ValueObject *valobj = (*pos).get();
-        if (valobj && valobj == find_valobj)
-        {
-            valobj_sp = *pos;
-            break;
-        }
+ValueObjectList::FindValueObjectByPointer(ValueObject *find_valobj) {
+  ValueObjectSP valobj_sp;
+  collection::iterator pos, end = m_value_objects.end();
+
+  for (pos = m_value_objects.begin(); pos != end; ++pos) {
+    ValueObject *valobj = (*pos).get();
+    if (valobj && valobj == find_valobj) {
+      valobj_sp = *pos;
+      break;
     }
-    return valobj_sp;
+  }
+  return valobj_sp;
 }
 
-void
-ValueObjectList::Swap (ValueObjectList &value_object_list)
-{
-    m_value_objects.swap (value_object_list.m_value_objects);
+void ValueObjectList::Swap(ValueObjectList &value_object_list) {
+  m_value_objects.swap(value_object_list.m_value_objects);
 }

Modified: lldb/trunk/source/Core/ValueObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectMemory.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectMemory.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectMemory.cpp Tue Sep  6 15:57:50 2016
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #include "lldb/Core/ValueObjectMemory.h"
 
 // C Includes
@@ -15,9 +14,9 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Module.h"
-#include "lldb/Core/ValueObjectList.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectList.h"
 
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolContext.h"
@@ -33,256 +32,199 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ValueObjectSP
-ValueObjectMemory::Create (ExecutionContextScope *exe_scope, 
-                           const char *name,
-                           const Address &address, 
-                           lldb::TypeSP &type_sp)
-{
-    return (new ValueObjectMemory (exe_scope, name, address, type_sp))->GetSP();
-}
-
-ValueObjectSP
-ValueObjectMemory::Create (ExecutionContextScope *exe_scope, 
-                           const char *name,
-                           const Address &address, 
-                           const CompilerType &ast_type)
-{
-    return (new ValueObjectMemory (exe_scope, name, address, ast_type))->GetSP();
-}
-
-ValueObjectMemory::ValueObjectMemory (ExecutionContextScope *exe_scope,
-                                      const char *name, 
-                                      const Address &address,
-                                      lldb::TypeSP &type_sp) :
-    ValueObject(exe_scope),
-    m_address (address),
-    m_type_sp(type_sp),
-    m_compiler_type()
-{
-    // Do not attempt to construct one of these objects with no variable!
-    assert (m_type_sp.get() != NULL);
-    SetName (ConstString(name));
-    m_value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
-    TargetSP target_sp (GetTargetSP());
-    lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
-    if (load_address != LLDB_INVALID_ADDRESS)
-    {
-        m_value.SetValueType(Value::eValueTypeLoadAddress);
-        m_value.GetScalar() = load_address;
-    }
-    else
-    {
-        lldb::addr_t file_address = m_address.GetFileAddress();
-        if (file_address != LLDB_INVALID_ADDRESS)
-        {
-            m_value.SetValueType(Value::eValueTypeFileAddress);
-            m_value.GetScalar() = file_address;
-        }
-        else
-        {
-            m_value.GetScalar() = m_address.GetOffset();
-            m_value.SetValueType (Value::eValueTypeScalar);
-        }
-    }
-}
-
-ValueObjectMemory::ValueObjectMemory (ExecutionContextScope *exe_scope,
-                                      const char *name, 
-                                      const Address &address,
-                                      const CompilerType &ast_type) :
-    ValueObject(exe_scope),
-    m_address (address),
-    m_type_sp(),
-    m_compiler_type(ast_type)
-{
-    // Do not attempt to construct one of these objects with no variable!
-    assert (m_compiler_type.GetTypeSystem());
-    assert (m_compiler_type.GetOpaqueQualType());
-    
-    TargetSP target_sp (GetTargetSP());
-
-    SetName (ConstString(name));
-//    m_value.SetContext(Value::eContextTypeClangType, m_compiler_type.GetOpaqueQualType());
-    m_value.SetCompilerType(m_compiler_type);
-    lldb::addr_t load_address = m_address.GetLoadAddress (target_sp.get());
-    if (load_address != LLDB_INVALID_ADDRESS)
-    {
-        m_value.SetValueType(Value::eValueTypeLoadAddress);
-        m_value.GetScalar() = load_address;
-    }
-    else
-    {
-        lldb::addr_t file_address = m_address.GetFileAddress();
-        if (file_address != LLDB_INVALID_ADDRESS)
-        {
-            m_value.SetValueType(Value::eValueTypeFileAddress);
-            m_value.GetScalar() = file_address;
-        }
-        else
-        {
-            m_value.GetScalar() = m_address.GetOffset();
-            m_value.SetValueType (Value::eValueTypeScalar);
-        }
-    }
-}
-
-ValueObjectMemory::~ValueObjectMemory()
-{
-}
-
-CompilerType
-ValueObjectMemory::GetCompilerTypeImpl ()
-{
-    if (m_type_sp)
-        return m_type_sp->GetForwardCompilerType ();
-    return m_compiler_type;
-}
-
-ConstString
-ValueObjectMemory::GetTypeName()
-{
-    if (m_type_sp)
-        return m_type_sp->GetName();
-    return m_compiler_type.GetConstTypeName();
-}
-
-ConstString
-ValueObjectMemory::GetDisplayTypeName()
-{
-    if (m_type_sp)
-        return m_type_sp->GetForwardCompilerType ().GetDisplayTypeName();
-    return m_compiler_type.GetDisplayTypeName();
-}
-
-size_t
-ValueObjectMemory::CalculateNumChildren(uint32_t max)
-{
-    if (m_type_sp)
-    {
-        auto child_count = m_type_sp->GetNumChildren(true);
-        return child_count <= max ? child_count : max;
-    }
-
-    const bool omit_empty_base_classes = true;
-    auto child_count = m_compiler_type.GetNumChildren (omit_empty_base_classes);
+ValueObjectSP ValueObjectMemory::Create(ExecutionContextScope *exe_scope,
+                                        const char *name,
+                                        const Address &address,
+                                        lldb::TypeSP &type_sp) {
+  return (new ValueObjectMemory(exe_scope, name, address, type_sp))->GetSP();
+}
+
+ValueObjectSP ValueObjectMemory::Create(ExecutionContextScope *exe_scope,
+                                        const char *name,
+                                        const Address &address,
+                                        const CompilerType &ast_type) {
+  return (new ValueObjectMemory(exe_scope, name, address, ast_type))->GetSP();
+}
+
+ValueObjectMemory::ValueObjectMemory(ExecutionContextScope *exe_scope,
+                                     const char *name, const Address &address,
+                                     lldb::TypeSP &type_sp)
+    : ValueObject(exe_scope), m_address(address), m_type_sp(type_sp),
+      m_compiler_type() {
+  // Do not attempt to construct one of these objects with no variable!
+  assert(m_type_sp.get() != NULL);
+  SetName(ConstString(name));
+  m_value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
+  TargetSP target_sp(GetTargetSP());
+  lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
+  if (load_address != LLDB_INVALID_ADDRESS) {
+    m_value.SetValueType(Value::eValueTypeLoadAddress);
+    m_value.GetScalar() = load_address;
+  } else {
+    lldb::addr_t file_address = m_address.GetFileAddress();
+    if (file_address != LLDB_INVALID_ADDRESS) {
+      m_value.SetValueType(Value::eValueTypeFileAddress);
+      m_value.GetScalar() = file_address;
+    } else {
+      m_value.GetScalar() = m_address.GetOffset();
+      m_value.SetValueType(Value::eValueTypeScalar);
+    }
+  }
+}
+
+ValueObjectMemory::ValueObjectMemory(ExecutionContextScope *exe_scope,
+                                     const char *name, const Address &address,
+                                     const CompilerType &ast_type)
+    : ValueObject(exe_scope), m_address(address), m_type_sp(),
+      m_compiler_type(ast_type) {
+  // Do not attempt to construct one of these objects with no variable!
+  assert(m_compiler_type.GetTypeSystem());
+  assert(m_compiler_type.GetOpaqueQualType());
+
+  TargetSP target_sp(GetTargetSP());
+
+  SetName(ConstString(name));
+  //    m_value.SetContext(Value::eContextTypeClangType,
+  //    m_compiler_type.GetOpaqueQualType());
+  m_value.SetCompilerType(m_compiler_type);
+  lldb::addr_t load_address = m_address.GetLoadAddress(target_sp.get());
+  if (load_address != LLDB_INVALID_ADDRESS) {
+    m_value.SetValueType(Value::eValueTypeLoadAddress);
+    m_value.GetScalar() = load_address;
+  } else {
+    lldb::addr_t file_address = m_address.GetFileAddress();
+    if (file_address != LLDB_INVALID_ADDRESS) {
+      m_value.SetValueType(Value::eValueTypeFileAddress);
+      m_value.GetScalar() = file_address;
+    } else {
+      m_value.GetScalar() = m_address.GetOffset();
+      m_value.SetValueType(Value::eValueTypeScalar);
+    }
+  }
+}
+
+ValueObjectMemory::~ValueObjectMemory() {}
+
+CompilerType ValueObjectMemory::GetCompilerTypeImpl() {
+  if (m_type_sp)
+    return m_type_sp->GetForwardCompilerType();
+  return m_compiler_type;
+}
+
+ConstString ValueObjectMemory::GetTypeName() {
+  if (m_type_sp)
+    return m_type_sp->GetName();
+  return m_compiler_type.GetConstTypeName();
+}
+
+ConstString ValueObjectMemory::GetDisplayTypeName() {
+  if (m_type_sp)
+    return m_type_sp->GetForwardCompilerType().GetDisplayTypeName();
+  return m_compiler_type.GetDisplayTypeName();
+}
+
+size_t ValueObjectMemory::CalculateNumChildren(uint32_t max) {
+  if (m_type_sp) {
+    auto child_count = m_type_sp->GetNumChildren(true);
     return child_count <= max ? child_count : max;
-}
+  }
 
-uint64_t
-ValueObjectMemory::GetByteSize()
-{
-    if (m_type_sp)
-        return m_type_sp->GetByteSize();
-    return m_compiler_type.GetByteSize (nullptr);
-}
-
-lldb::ValueType
-ValueObjectMemory::GetValueType() const
-{
-    // RETHINK: Should this be inherited from somewhere?
-    return lldb::eValueTypeVariableGlobal;
-}
-
-bool
-ValueObjectMemory::UpdateValue ()
-{
-    SetValueIsValid (false);
-    m_error.Clear();
-
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    
-    Target *target = exe_ctx.GetTargetPtr();
-    if (target)
-    {
-        m_data.SetByteOrder(target->GetArchitecture().GetByteOrder());
-        m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
-    }
+  const bool omit_empty_base_classes = true;
+  auto child_count = m_compiler_type.GetNumChildren(omit_empty_base_classes);
+  return child_count <= max ? child_count : max;
+}
+
+uint64_t ValueObjectMemory::GetByteSize() {
+  if (m_type_sp)
+    return m_type_sp->GetByteSize();
+  return m_compiler_type.GetByteSize(nullptr);
+}
+
+lldb::ValueType ValueObjectMemory::GetValueType() const {
+  // RETHINK: Should this be inherited from somewhere?
+  return lldb::eValueTypeVariableGlobal;
+}
+
+bool ValueObjectMemory::UpdateValue() {
+  SetValueIsValid(false);
+  m_error.Clear();
+
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+
+  Target *target = exe_ctx.GetTargetPtr();
+  if (target) {
+    m_data.SetByteOrder(target->GetArchitecture().GetByteOrder());
+    m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
+  }
+
+  Value old_value(m_value);
+  if (m_address.IsValid()) {
+    Value::ValueType value_type = m_value.GetValueType();
+
+    switch (value_type) {
+    default:
+      assert(!"Unhandled expression result value kind...");
+      break;
+
+    case Value::eValueTypeScalar:
+      // The variable value is in the Scalar value inside the m_value.
+      // We can point our m_data right to it.
+      m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+      break;
+
+    case Value::eValueTypeFileAddress:
+    case Value::eValueTypeLoadAddress:
+    case Value::eValueTypeHostAddress:
+      // The DWARF expression result was an address in the inferior
+      // process. If this variable is an aggregate type, we just need
+      // the address as the main value as all child variable objects
+      // will rely upon this location and add an offset and then read
+      // their own values as needed. If this variable is a simple
+      // type, we read all data for it into m_data.
+      // Make sure this type has a value before we try and read it
+
+      // If we have a file address, convert it to a load address if we can.
+      if (value_type == Value::eValueTypeFileAddress &&
+          exe_ctx.GetProcessPtr()) {
+        lldb::addr_t load_addr = m_address.GetLoadAddress(target);
+        if (load_addr != LLDB_INVALID_ADDRESS) {
+          m_value.SetValueType(Value::eValueTypeLoadAddress);
+          m_value.GetScalar() = load_addr;
+        }
+      }
 
-    Value old_value(m_value);
-    if (m_address.IsValid())
-    {
-        Value::ValueType value_type = m_value.GetValueType();
-
-        switch (value_type)
-        {
-        default:
-            assert(!"Unhandled expression result value kind...");
-            break;
-
-        case Value::eValueTypeScalar:
-            // The variable value is in the Scalar value inside the m_value.
-            // We can point our m_data right to it.
-            m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
-            break;
-
-        case Value::eValueTypeFileAddress:
-        case Value::eValueTypeLoadAddress:
-        case Value::eValueTypeHostAddress:
-            // The DWARF expression result was an address in the inferior
-            // process. If this variable is an aggregate type, we just need
-            // the address as the main value as all child variable objects
-            // will rely upon this location and add an offset and then read
-            // their own values as needed. If this variable is a simple
-            // type, we read all data for it into m_data.
-            // Make sure this type has a value before we try and read it
-
-            // If we have a file address, convert it to a load address if we can.
-            if (value_type == Value::eValueTypeFileAddress && exe_ctx.GetProcessPtr())
-            {
-                lldb::addr_t load_addr = m_address.GetLoadAddress(target);
-                if (load_addr != LLDB_INVALID_ADDRESS)
-                {
-                    m_value.SetValueType(Value::eValueTypeLoadAddress);
-                    m_value.GetScalar() = load_addr;
-                }
-            }
-
-            if (!CanProvideValue())
-            {
-                // this value object represents an aggregate type whose
-                // children have values, but this object does not. So we
-                // say we are changed if our location has changed.
-                SetValueDidChange (value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
-            }
-            else
-            {
-                // Copy the Value and set the context to use our Variable
-                // so it can extract read its value into m_data appropriately
-                Value value(m_value);
-                if (m_type_sp)
-                    value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
-                else
-                {
-                    //value.SetContext(Value::eContextTypeClangType, m_compiler_type.GetOpaqueQualType());
-                    value.SetCompilerType(m_compiler_type);
-                }
-
-                m_error = value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
-            }
-            break;
+      if (!CanProvideValue()) {
+        // this value object represents an aggregate type whose
+        // children have values, but this object does not. So we
+        // say we are changed if our location has changed.
+        SetValueDidChange(value_type != old_value.GetValueType() ||
+                          m_value.GetScalar() != old_value.GetScalar());
+      } else {
+        // Copy the Value and set the context to use our Variable
+        // so it can extract read its value into m_data appropriately
+        Value value(m_value);
+        if (m_type_sp)
+          value.SetContext(Value::eContextTypeLLDBType, m_type_sp.get());
+        else {
+          // value.SetContext(Value::eContextTypeClangType,
+          // m_compiler_type.GetOpaqueQualType());
+          value.SetCompilerType(m_compiler_type);
         }
 
-        SetValueIsValid (m_error.Success());
+        m_error = value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+      }
+      break;
     }
-    return m_error.Success();
-}
-
 
-
-bool
-ValueObjectMemory::IsInScope ()
-{
-    // FIXME: Maybe try to read the memory address, and if that works, then
-    // we are in scope?
-    return true;
+    SetValueIsValid(m_error.Success());
+  }
+  return m_error.Success();
 }
 
-
-lldb::ModuleSP
-ValueObjectMemory::GetModule()
-{
-    return m_address.GetModule();
+bool ValueObjectMemory::IsInScope() {
+  // FIXME: Maybe try to read the memory address, and if that works, then
+  // we are in scope?
+  return true;
 }
 
-
+lldb::ModuleSP ValueObjectMemory::GetModule() { return m_address.GetModule(); }

Modified: lldb/trunk/source/Core/ValueObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectRegister.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectRegister.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectRegister.cpp Tue Sep  6 15:57:50 2016
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #include "lldb/Core/ValueObjectRegister.h"
 
 // C Includes
@@ -15,8 +14,8 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Module.h"
-#include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/TypeList.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
@@ -29,418 +28,321 @@ using namespace lldb_private;
 
 #pragma mark ValueObjectRegisterContext
 
-ValueObjectRegisterContext::ValueObjectRegisterContext (ValueObject &parent, RegisterContextSP &reg_ctx) :
-    ValueObject (parent),
-    m_reg_ctx_sp (reg_ctx)
-{
-    assert (reg_ctx);
-    m_name.SetCString("Registers");
-    SetValueIsValid (true);
+ValueObjectRegisterContext::ValueObjectRegisterContext(
+    ValueObject &parent, RegisterContextSP &reg_ctx)
+    : ValueObject(parent), m_reg_ctx_sp(reg_ctx) {
+  assert(reg_ctx);
+  m_name.SetCString("Registers");
+  SetValueIsValid(true);
 }
 
-ValueObjectRegisterContext::~ValueObjectRegisterContext()
-{
-}
+ValueObjectRegisterContext::~ValueObjectRegisterContext() {}
 
-CompilerType
-ValueObjectRegisterContext::GetCompilerTypeImpl ()
-{
-    return CompilerType();
+CompilerType ValueObjectRegisterContext::GetCompilerTypeImpl() {
+  return CompilerType();
 }
 
-ConstString
-ValueObjectRegisterContext::GetTypeName()
-{
-    return ConstString();
-}
+ConstString ValueObjectRegisterContext::GetTypeName() { return ConstString(); }
 
-ConstString
-ValueObjectRegisterContext::GetDisplayTypeName()
-{
-    return ConstString();
+ConstString ValueObjectRegisterContext::GetDisplayTypeName() {
+  return ConstString();
 }
 
-ConstString
-ValueObjectRegisterContext::GetQualifiedTypeName()
-{
-    return ConstString();
-}
-
-size_t
-ValueObjectRegisterContext::CalculateNumChildren(uint32_t max)
-{
-    auto reg_set_count = m_reg_ctx_sp->GetRegisterSetCount();
-    return reg_set_count <= max ? reg_set_count : max;
-}
-
-uint64_t
-ValueObjectRegisterContext::GetByteSize()
-{
-    return 0;
-}
-
-bool
-ValueObjectRegisterContext::UpdateValue ()
-{
-    m_error.Clear();
-    ExecutionContext exe_ctx(GetExecutionContextRef());
-    StackFrame *frame = exe_ctx.GetFramePtr();
-    if (frame)
-        m_reg_ctx_sp = frame->GetRegisterContext();
-    else
-        m_reg_ctx_sp.reset();
-
-    if (m_reg_ctx_sp.get() == NULL)
-    {
-        SetValueIsValid (false);
-        m_error.SetErrorToGenericError();
-    }
-    else
-        SetValueIsValid (true);
-        
-    return m_error.Success();
-}
-
-ValueObject *
-ValueObjectRegisterContext::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index)
-{
-    ValueObject *new_valobj = NULL;
-    
-    const size_t num_children = GetNumChildren();
-    if (idx < num_children)
-    {
-        ExecutionContext exe_ctx(GetExecutionContextRef());
-        new_valobj = new ValueObjectRegisterSet(exe_ctx.GetBestExecutionContextScope(), m_reg_ctx_sp, idx);
-    }
-    
-    return new_valobj;
+ConstString ValueObjectRegisterContext::GetQualifiedTypeName() {
+  return ConstString();
 }
 
-
-#pragma mark -
-#pragma mark ValueObjectRegisterSet
-
-ValueObjectSP
-ValueObjectRegisterSet::Create (ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx_sp, uint32_t set_idx)
-{
-    return (new ValueObjectRegisterSet (exe_scope, reg_ctx_sp, set_idx))->GetSP();
+size_t ValueObjectRegisterContext::CalculateNumChildren(uint32_t max) {
+  auto reg_set_count = m_reg_ctx_sp->GetRegisterSetCount();
+  return reg_set_count <= max ? reg_set_count : max;
 }
 
+uint64_t ValueObjectRegisterContext::GetByteSize() { return 0; }
 
-ValueObjectRegisterSet::ValueObjectRegisterSet (ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx, uint32_t reg_set_idx) :
-    ValueObject (exe_scope),
-    m_reg_ctx_sp (reg_ctx),
-    m_reg_set (NULL),
-    m_reg_set_idx (reg_set_idx)
-{
-    assert (reg_ctx);
-    m_reg_set = reg_ctx->GetRegisterSet(m_reg_set_idx);
-    if (m_reg_set)
-    {
-        m_name.SetCString (m_reg_set->name);
-    }
-}
+bool ValueObjectRegisterContext::UpdateValue() {
+  m_error.Clear();
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  StackFrame *frame = exe_ctx.GetFramePtr();
+  if (frame)
+    m_reg_ctx_sp = frame->GetRegisterContext();
+  else
+    m_reg_ctx_sp.reset();
 
-ValueObjectRegisterSet::~ValueObjectRegisterSet()
-{
-}
+  if (m_reg_ctx_sp.get() == NULL) {
+    SetValueIsValid(false);
+    m_error.SetErrorToGenericError();
+  } else
+    SetValueIsValid(true);
 
-CompilerType
-ValueObjectRegisterSet::GetCompilerTypeImpl ()
-{
-    return CompilerType();
+  return m_error.Success();
 }
 
-ConstString
-ValueObjectRegisterSet::GetTypeName()
-{
-    return ConstString();
-}
+ValueObject *ValueObjectRegisterContext::CreateChildAtIndex(
+    size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
+  ValueObject *new_valobj = NULL;
 
-ConstString
-ValueObjectRegisterSet::GetQualifiedTypeName()
-{
-    return ConstString();
-}
+  const size_t num_children = GetNumChildren();
+  if (idx < num_children) {
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    new_valobj = new ValueObjectRegisterSet(
+        exe_ctx.GetBestExecutionContextScope(), m_reg_ctx_sp, idx);
+  }
 
-size_t
-ValueObjectRegisterSet::CalculateNumChildren(uint32_t max)
-{
-    const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet(m_reg_set_idx);
-    if (reg_set)
-    {
-        auto reg_count = reg_set->num_registers;
-        return reg_count <= max ? reg_count : max;
-    }
-    return 0;
+  return new_valobj;
 }
 
-uint64_t
-ValueObjectRegisterSet::GetByteSize()
-{
-    return 0;
-}
+#pragma mark -
+#pragma mark ValueObjectRegisterSet
 
-bool
-ValueObjectRegisterSet::UpdateValue ()
-{
-    m_error.Clear();
-    SetValueDidChange (false);
-    ExecutionContext exe_ctx(GetExecutionContextRef());
-    StackFrame *frame = exe_ctx.GetFramePtr();
-    if (frame == NULL)
+ValueObjectSP
+ValueObjectRegisterSet::Create(ExecutionContextScope *exe_scope,
+                               lldb::RegisterContextSP &reg_ctx_sp,
+                               uint32_t set_idx) {
+  return (new ValueObjectRegisterSet(exe_scope, reg_ctx_sp, set_idx))->GetSP();
+}
+
+ValueObjectRegisterSet::ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
+                                               lldb::RegisterContextSP &reg_ctx,
+                                               uint32_t reg_set_idx)
+    : ValueObject(exe_scope), m_reg_ctx_sp(reg_ctx), m_reg_set(NULL),
+      m_reg_set_idx(reg_set_idx) {
+  assert(reg_ctx);
+  m_reg_set = reg_ctx->GetRegisterSet(m_reg_set_idx);
+  if (m_reg_set) {
+    m_name.SetCString(m_reg_set->name);
+  }
+}
+
+ValueObjectRegisterSet::~ValueObjectRegisterSet() {}
+
+CompilerType ValueObjectRegisterSet::GetCompilerTypeImpl() {
+  return CompilerType();
+}
+
+ConstString ValueObjectRegisterSet::GetTypeName() { return ConstString(); }
+
+ConstString ValueObjectRegisterSet::GetQualifiedTypeName() {
+  return ConstString();
+}
+
+size_t ValueObjectRegisterSet::CalculateNumChildren(uint32_t max) {
+  const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet(m_reg_set_idx);
+  if (reg_set) {
+    auto reg_count = reg_set->num_registers;
+    return reg_count <= max ? reg_count : max;
+  }
+  return 0;
+}
+
+uint64_t ValueObjectRegisterSet::GetByteSize() { return 0; }
+
+bool ValueObjectRegisterSet::UpdateValue() {
+  m_error.Clear();
+  SetValueDidChange(false);
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  StackFrame *frame = exe_ctx.GetFramePtr();
+  if (frame == NULL)
+    m_reg_ctx_sp.reset();
+  else {
+    m_reg_ctx_sp = frame->GetRegisterContext();
+    if (m_reg_ctx_sp) {
+      const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet(m_reg_set_idx);
+      if (reg_set == NULL)
         m_reg_ctx_sp.reset();
-    else
-    {
-        m_reg_ctx_sp = frame->GetRegisterContext ();
-        if (m_reg_ctx_sp)
-        {
-            const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet (m_reg_set_idx);
-            if (reg_set == NULL)
-                m_reg_ctx_sp.reset();
-            else if (m_reg_set != reg_set)
-            {
-                SetValueDidChange (true);
-                m_name.SetCString(reg_set->name);
-            }
-        }
-    }
-    if (m_reg_ctx_sp)
-    {
-        SetValueIsValid (true);
-    }
-    else
-    {
-        SetValueIsValid (false);
-        m_error.SetErrorToGenericError ();
-        m_children.Clear();
-    }
-    return m_error.Success();
-}
-
-
-ValueObject *
-ValueObjectRegisterSet::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index)
-{
-    ValueObject *valobj = NULL;
-    if (m_reg_ctx_sp && m_reg_set)
-    {
-        const size_t num_children = GetNumChildren();
-        if (idx < num_children)
-            valobj = new ValueObjectRegister(*this, m_reg_ctx_sp, m_reg_set->registers[idx]);
-    }
-    return valobj;
+      else if (m_reg_set != reg_set) {
+        SetValueDidChange(true);
+        m_name.SetCString(reg_set->name);
+      }
+    }
+  }
+  if (m_reg_ctx_sp) {
+    SetValueIsValid(true);
+  } else {
+    SetValueIsValid(false);
+    m_error.SetErrorToGenericError();
+    m_children.Clear();
+  }
+  return m_error.Success();
+}
+
+ValueObject *ValueObjectRegisterSet::CreateChildAtIndex(
+    size_t idx, bool synthetic_array_member, int32_t synthetic_index) {
+  ValueObject *valobj = NULL;
+  if (m_reg_ctx_sp && m_reg_set) {
+    const size_t num_children = GetNumChildren();
+    if (idx < num_children)
+      valobj = new ValueObjectRegister(*this, m_reg_ctx_sp,
+                                       m_reg_set->registers[idx]);
+  }
+  return valobj;
 }
 
 lldb::ValueObjectSP
-ValueObjectRegisterSet::GetChildMemberWithName (const ConstString &name, bool can_create)
-{
-    ValueObject *valobj = NULL;
-    if (m_reg_ctx_sp && m_reg_set)
-    {
-        const RegisterInfo *reg_info = m_reg_ctx_sp->GetRegisterInfoByName (name.AsCString());
-        if (reg_info != NULL)
-            valobj = new ValueObjectRegister(*this, m_reg_ctx_sp, reg_info->kinds[eRegisterKindLLDB]);
-    }
-    if (valobj)
-        return valobj->GetSP();
-    else
-        return ValueObjectSP();
+ValueObjectRegisterSet::GetChildMemberWithName(const ConstString &name,
+                                               bool can_create) {
+  ValueObject *valobj = NULL;
+  if (m_reg_ctx_sp && m_reg_set) {
+    const RegisterInfo *reg_info =
+        m_reg_ctx_sp->GetRegisterInfoByName(name.AsCString());
+    if (reg_info != NULL)
+      valobj = new ValueObjectRegister(*this, m_reg_ctx_sp,
+                                       reg_info->kinds[eRegisterKindLLDB]);
+  }
+  if (valobj)
+    return valobj->GetSP();
+  else
+    return ValueObjectSP();
 }
 
 size_t
-ValueObjectRegisterSet::GetIndexOfChildWithName (const ConstString &name)
-{
-    if (m_reg_ctx_sp && m_reg_set)
-    {
-        const RegisterInfo *reg_info = m_reg_ctx_sp->GetRegisterInfoByName (name.AsCString());
-        if (reg_info != NULL)
-            return reg_info->kinds[eRegisterKindLLDB];
-    }
-    return UINT32_MAX;
+ValueObjectRegisterSet::GetIndexOfChildWithName(const ConstString &name) {
+  if (m_reg_ctx_sp && m_reg_set) {
+    const RegisterInfo *reg_info =
+        m_reg_ctx_sp->GetRegisterInfoByName(name.AsCString());
+    if (reg_info != NULL)
+      return reg_info->kinds[eRegisterKindLLDB];
+  }
+  return UINT32_MAX;
 }
 
 #pragma mark -
 #pragma mark ValueObjectRegister
 
-void
-ValueObjectRegister::ConstructObject (uint32_t reg_num)
-{
-    const RegisterInfo *reg_info = m_reg_ctx_sp->GetRegisterInfoAtIndex (reg_num);
-    if (reg_info)
-    {
-        m_reg_info = *reg_info;
-        if (reg_info->name)
-            m_name.SetCString(reg_info->name);
-        else if (reg_info->alt_name)
-            m_name.SetCString(reg_info->alt_name);
-    }
-}
-
-ValueObjectRegister::ValueObjectRegister (ValueObject &parent, lldb::RegisterContextSP &reg_ctx_sp, uint32_t reg_num) :
-    ValueObject (parent),
-    m_reg_ctx_sp (reg_ctx_sp),
-    m_reg_info (),
-    m_reg_value (),
-    m_type_name (),
-    m_compiler_type ()
-{
-    assert (reg_ctx_sp.get());
-    ConstructObject(reg_num);
-}
-
-ValueObjectSP
-ValueObjectRegister::Create (ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx_sp, uint32_t reg_num)
-{
-    return (new ValueObjectRegister (exe_scope, reg_ctx_sp, reg_num))->GetSP();
-}
-
-ValueObjectRegister::ValueObjectRegister (ExecutionContextScope *exe_scope, lldb::RegisterContextSP &reg_ctx, uint32_t reg_num) :
-    ValueObject (exe_scope),
-    m_reg_ctx_sp (reg_ctx),
-    m_reg_info (),
-    m_reg_value (),
-    m_type_name (),
-    m_compiler_type ()
-{
-    assert (reg_ctx);
-    ConstructObject(reg_num);
-}
-
-ValueObjectRegister::~ValueObjectRegister()
-{
-}
-
-CompilerType
-ValueObjectRegister::GetCompilerTypeImpl ()
-{
-    if (!m_compiler_type.IsValid())
-    {
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        Target *target = exe_ctx.GetTargetPtr();
-        if (target)
-        {
-            Module *exe_module = target->GetExecutableModulePointer();
-            if (exe_module)
-            {
-                TypeSystem *type_system = exe_module->GetTypeSystemForLanguage (eLanguageTypeC);
-                if (type_system)
-                    m_compiler_type = type_system->GetBuiltinTypeForEncodingAndBitSize (m_reg_info.encoding,
-                                                                                     m_reg_info.byte_size * 8);
-            }
-        }
-    }
-    return m_compiler_type;
+void ValueObjectRegister::ConstructObject(uint32_t reg_num) {
+  const RegisterInfo *reg_info = m_reg_ctx_sp->GetRegisterInfoAtIndex(reg_num);
+  if (reg_info) {
+    m_reg_info = *reg_info;
+    if (reg_info->name)
+      m_name.SetCString(reg_info->name);
+    else if (reg_info->alt_name)
+      m_name.SetCString(reg_info->alt_name);
+  }
+}
+
+ValueObjectRegister::ValueObjectRegister(ValueObject &parent,
+                                         lldb::RegisterContextSP &reg_ctx_sp,
+                                         uint32_t reg_num)
+    : ValueObject(parent), m_reg_ctx_sp(reg_ctx_sp), m_reg_info(),
+      m_reg_value(), m_type_name(), m_compiler_type() {
+  assert(reg_ctx_sp.get());
+  ConstructObject(reg_num);
+}
+
+ValueObjectSP ValueObjectRegister::Create(ExecutionContextScope *exe_scope,
+                                          lldb::RegisterContextSP &reg_ctx_sp,
+                                          uint32_t reg_num) {
+  return (new ValueObjectRegister(exe_scope, reg_ctx_sp, reg_num))->GetSP();
+}
+
+ValueObjectRegister::ValueObjectRegister(ExecutionContextScope *exe_scope,
+                                         lldb::RegisterContextSP &reg_ctx,
+                                         uint32_t reg_num)
+    : ValueObject(exe_scope), m_reg_ctx_sp(reg_ctx), m_reg_info(),
+      m_reg_value(), m_type_name(), m_compiler_type() {
+  assert(reg_ctx);
+  ConstructObject(reg_num);
 }
 
-ConstString
-ValueObjectRegister::GetTypeName()
-{
-    if (m_type_name.IsEmpty())
-        m_type_name = GetCompilerType().GetConstTypeName ();
-    return m_type_name;
-}
+ValueObjectRegister::~ValueObjectRegister() {}
 
-size_t
-ValueObjectRegister::CalculateNumChildren(uint32_t max)
-{
-    auto children_count = GetCompilerType().GetNumChildren (true);
-    return children_count <= max ? children_count : max;
-}
-
-uint64_t
-ValueObjectRegister::GetByteSize()
-{
-    return m_reg_info.byte_size;
-}
-
-bool
-ValueObjectRegister::UpdateValue ()
-{
-    m_error.Clear();
+CompilerType ValueObjectRegister::GetCompilerTypeImpl() {
+  if (!m_compiler_type.IsValid()) {
     ExecutionContext exe_ctx(GetExecutionContextRef());
-    StackFrame *frame = exe_ctx.GetFramePtr();
-    if (frame == NULL)
-    {
-        m_reg_ctx_sp.reset();
-        m_reg_value.Clear();
-    }
-
-
-    if (m_reg_ctx_sp)
-    {
-        RegisterValue m_old_reg_value(m_reg_value);
-        if (m_reg_ctx_sp->ReadRegister (&m_reg_info, m_reg_value))
-        {
-            if (m_reg_value.GetData (m_data))
-            {
-                Process *process = exe_ctx.GetProcessPtr();
-                if (process)
-                    m_data.SetAddressByteSize(process->GetAddressByteSize());
-                m_value.SetContext(Value::eContextTypeRegisterInfo, (void *)&m_reg_info);
-                m_value.SetValueType(Value::eValueTypeHostAddress);
-                m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
-                SetValueIsValid (true);
-                SetValueDidChange(!(m_old_reg_value == m_reg_value));
-                return true;
-            }
-        }
-    }
-    
-    SetValueIsValid (false);
-    m_error.SetErrorToGenericError ();
+    Target *target = exe_ctx.GetTargetPtr();
+    if (target) {
+      Module *exe_module = target->GetExecutableModulePointer();
+      if (exe_module) {
+        TypeSystem *type_system =
+            exe_module->GetTypeSystemForLanguage(eLanguageTypeC);
+        if (type_system)
+          m_compiler_type = type_system->GetBuiltinTypeForEncodingAndBitSize(
+              m_reg_info.encoding, m_reg_info.byte_size * 8);
+      }
+    }
+  }
+  return m_compiler_type;
+}
+
+ConstString ValueObjectRegister::GetTypeName() {
+  if (m_type_name.IsEmpty())
+    m_type_name = GetCompilerType().GetConstTypeName();
+  return m_type_name;
+}
+
+size_t ValueObjectRegister::CalculateNumChildren(uint32_t max) {
+  auto children_count = GetCompilerType().GetNumChildren(true);
+  return children_count <= max ? children_count : max;
+}
+
+uint64_t ValueObjectRegister::GetByteSize() { return m_reg_info.byte_size; }
+
+bool ValueObjectRegister::UpdateValue() {
+  m_error.Clear();
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  StackFrame *frame = exe_ctx.GetFramePtr();
+  if (frame == NULL) {
+    m_reg_ctx_sp.reset();
+    m_reg_value.Clear();
+  }
+
+  if (m_reg_ctx_sp) {
+    RegisterValue m_old_reg_value(m_reg_value);
+    if (m_reg_ctx_sp->ReadRegister(&m_reg_info, m_reg_value)) {
+      if (m_reg_value.GetData(m_data)) {
+        Process *process = exe_ctx.GetProcessPtr();
+        if (process)
+          m_data.SetAddressByteSize(process->GetAddressByteSize());
+        m_value.SetContext(Value::eContextTypeRegisterInfo,
+                           (void *)&m_reg_info);
+        m_value.SetValueType(Value::eValueTypeHostAddress);
+        m_value.GetScalar() = (uintptr_t)m_data.GetDataStart();
+        SetValueIsValid(true);
+        SetValueDidChange(!(m_old_reg_value == m_reg_value));
+        return true;
+      }
+    }
+  }
+
+  SetValueIsValid(false);
+  m_error.SetErrorToGenericError();
+  return false;
+}
+
+bool ValueObjectRegister::SetValueFromCString(const char *value_str,
+                                              Error &error) {
+  // The new value will be in the m_data.  Copy that into our register value.
+  error = m_reg_value.SetValueFromCString(&m_reg_info, value_str);
+  if (error.Success()) {
+    if (m_reg_ctx_sp->WriteRegister(&m_reg_info, m_reg_value)) {
+      SetNeedsUpdate();
+      return true;
+    } else
+      return false;
+  } else
     return false;
 }
 
-bool
-ValueObjectRegister::SetValueFromCString (const char *value_str, Error& error)
-{
-    // The new value will be in the m_data.  Copy that into our register value.
-    error = m_reg_value.SetValueFromCString (&m_reg_info, value_str);
-    if (error.Success())
-    {
-        if (m_reg_ctx_sp->WriteRegister (&m_reg_info, m_reg_value))
-        {
-            SetNeedsUpdate();
-            return true;
-        }
-        else
-            return false;
-    }
-    else
-        return false;
-}
-
-bool
-ValueObjectRegister::SetData (DataExtractor &data, Error &error)
-{
-    error = m_reg_value.SetValueFromData(&m_reg_info, data, 0, false);
-    if (error.Success())
-    {
-        if (m_reg_ctx_sp->WriteRegister (&m_reg_info, m_reg_value))
-        {
-            SetNeedsUpdate();
-            return true;
-        }
-        else
-            return false;
-    }
-    else
-        return false;
-}
-
-bool
-ValueObjectRegister::ResolveValue (Scalar &scalar)
-{
-    if (UpdateValueIfNeeded(false)) // make sure that you are up to date before returning anything
-        return m_reg_value.GetScalarValue(scalar);
+bool ValueObjectRegister::SetData(DataExtractor &data, Error &error) {
+  error = m_reg_value.SetValueFromData(&m_reg_info, data, 0, false);
+  if (error.Success()) {
+    if (m_reg_ctx_sp->WriteRegister(&m_reg_info, m_reg_value)) {
+      SetNeedsUpdate();
+      return true;
+    } else
+      return false;
+  } else
     return false;
 }
 
-void
-ValueObjectRegister::GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat epformat)
-{
-    s.Printf("$%s", m_reg_info.name);
+bool ValueObjectRegister::ResolveValue(Scalar &scalar) {
+  if (UpdateValueIfNeeded(
+          false)) // make sure that you are up to date before returning anything
+    return m_reg_value.GetScalarValue(scalar);
+  return false;
 }
 
-
+void ValueObjectRegister::GetExpressionPath(Stream &s,
+                                            bool qualify_cxx_base_classes,
+                                            GetExpressionPathFormat epformat) {
+  s.Printf("$%s", m_reg_info.name);
+}

Modified: lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectSyntheticFilter.cpp Tue Sep  6 15:57:50 2016
@@ -19,437 +19,361 @@
 
 using namespace lldb_private;
 
-class DummySyntheticFrontEnd : public SyntheticChildrenFrontEnd
-{
+class DummySyntheticFrontEnd : public SyntheticChildrenFrontEnd {
 public:
-    DummySyntheticFrontEnd(ValueObject &backend) :
-    SyntheticChildrenFrontEnd(backend)
-    {}
-
-    size_t
-    CalculateNumChildren() override
-    {
-        return m_backend.GetNumChildren();
-    }
-    
-    lldb::ValueObjectSP
-    GetChildAtIndex(size_t idx) override
-    {
-        return m_backend.GetChildAtIndex(idx, true);
-    }
+  DummySyntheticFrontEnd(ValueObject &backend)
+      : SyntheticChildrenFrontEnd(backend) {}
 
-    size_t
-    GetIndexOfChildWithName(const ConstString &name) override
-    {
-        return m_backend.GetIndexOfChildWithName(name);
-    }
-    
-    bool
-    MightHaveChildren() override
-    {
-        return true;
-    }
-    
-    bool
-    Update() override
-    {
-        return false;
-    }
+  size_t CalculateNumChildren() override { return m_backend.GetNumChildren(); }
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+    return m_backend.GetChildAtIndex(idx, true);
+  }
+
+  size_t GetIndexOfChildWithName(const ConstString &name) override {
+    return m_backend.GetIndexOfChildWithName(name);
+  }
+
+  bool MightHaveChildren() override { return true; }
+
+  bool Update() override { return false; }
 };
 
-ValueObjectSynthetic::ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter) :
-    ValueObject(parent),
-    m_synth_sp(filter),
-    m_children_byindex(),
-    m_name_toindex(),
-    m_synthetic_children_count(UINT32_MAX),
-    m_synthetic_children_cache(),
-    m_parent_type_name(parent.GetTypeName()),
-    m_might_have_children(eLazyBoolCalculate),
-    m_provides_value(eLazyBoolCalculate)
-{
-    SetName(parent.GetName());
-    CopyValueData(m_parent);
-    CreateSynthFilter();
+ValueObjectSynthetic::ValueObjectSynthetic(ValueObject &parent,
+                                           lldb::SyntheticChildrenSP filter)
+    : ValueObject(parent), m_synth_sp(filter), m_children_byindex(),
+      m_name_toindex(), m_synthetic_children_count(UINT32_MAX),
+      m_synthetic_children_cache(), m_parent_type_name(parent.GetTypeName()),
+      m_might_have_children(eLazyBoolCalculate),
+      m_provides_value(eLazyBoolCalculate) {
+  SetName(parent.GetName());
+  CopyValueData(m_parent);
+  CreateSynthFilter();
 }
 
 ValueObjectSynthetic::~ValueObjectSynthetic() = default;
 
-CompilerType
-ValueObjectSynthetic::GetCompilerTypeImpl ()
-{
-    return m_parent->GetCompilerType();
-}
-
-ConstString
-ValueObjectSynthetic::GetTypeName()
-{
-    return m_parent->GetTypeName();
-}
-
-ConstString
-ValueObjectSynthetic::GetQualifiedTypeName()
-{
-    return m_parent->GetQualifiedTypeName();
-}
-
-ConstString
-ValueObjectSynthetic::GetDisplayTypeName()
-{
-    if (ConstString synth_name = m_synth_filter_ap->GetSyntheticTypeName())
-        return synth_name;
-
-    return m_parent->GetDisplayTypeName();
-}
-
-size_t
-ValueObjectSynthetic::CalculateNumChildren(uint32_t max)
-{
-    Log* log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
-    
-    UpdateValueIfNeeded();
-    if (m_synthetic_children_count < UINT32_MAX)
-        return m_synthetic_children_count <= max ? m_synthetic_children_count : max;
-
-    if (max < UINT32_MAX)
-    {
-        size_t num_children = m_synth_filter_ap->CalculateNumChildren(max);
-        if (log)
-            log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name %s and type %s, the filter returned %zu child values",
-                        GetName().AsCString(),
-                        GetTypeName().AsCString(),
-                        num_children);
-        return num_children;
-    }
-    else
-    {
-        size_t num_children = (m_synthetic_children_count = m_synth_filter_ap->CalculateNumChildren(max));
-        if (log)
-            log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name %s and type %s, the filter returned %zu child values",
-                        GetName().AsCString(),
-                        GetTypeName().AsCString(),
-                        num_children);
-        return num_children;
-    }
+CompilerType ValueObjectSynthetic::GetCompilerTypeImpl() {
+  return m_parent->GetCompilerType();
 }
 
-lldb::ValueObjectSP
-ValueObjectSynthetic::GetDynamicValue (lldb::DynamicValueType valueType)
-{
-    if (!m_parent)
-        return lldb::ValueObjectSP();
-    if (IsDynamic() && GetDynamicValueType() == valueType)
-        return GetSP();
-    return m_parent->GetDynamicValue(valueType);
-}
-
-bool
-ValueObjectSynthetic::MightHaveChildren()
-{
-    if (m_might_have_children == eLazyBoolCalculate)
-        m_might_have_children = (m_synth_filter_ap->MightHaveChildren() ? eLazyBoolYes : eLazyBoolNo);
-    return (m_might_have_children == eLazyBoolNo ? false : true);
-}
-
-uint64_t
-ValueObjectSynthetic::GetByteSize()
-{
-    return m_parent->GetByteSize();
-}
-
-lldb::ValueType
-ValueObjectSynthetic::GetValueType() const
-{
-    return m_parent->GetValueType();
-}
-
-void
-ValueObjectSynthetic::CreateSynthFilter ()
-{
-    m_synth_filter_ap = (m_synth_sp->GetFrontEnd(*m_parent));
-    if (!m_synth_filter_ap.get())
-        m_synth_filter_ap.reset(new DummySyntheticFrontEnd(*m_parent));
-}
-
-bool
-ValueObjectSynthetic::UpdateValue ()
-{
-    Log* log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
-    
-    SetValueIsValid (false);
-    m_error.Clear();
-
-    if (!m_parent->UpdateValueIfNeeded(false))
-    {
-        // our parent could not update.. as we are meaningless without a parent, just stop
-        if (m_parent->GetError().Fail())
-            m_error = m_parent->GetError();
-        return false;
-    }
-    
-    // regenerate the synthetic filter if our typename changes
-    // <rdar://problem/12424824>
-    ConstString new_parent_type_name = m_parent->GetTypeName();
-    if (new_parent_type_name != m_parent_type_name)
-    {
-        if (log)
-            log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, type changed from %s to %s, recomputing synthetic filter",
-                        GetName().AsCString(),
-                        m_parent_type_name.AsCString(),
-                        new_parent_type_name.AsCString());
-        m_parent_type_name = new_parent_type_name;
-        CreateSynthFilter();
-    }
+ConstString ValueObjectSynthetic::GetTypeName() {
+  return m_parent->GetTypeName();
+}
 
-    // let our backend do its update
-    if (m_synth_filter_ap->Update() == false)
-    {
-        if (log)
-            log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic filter said caches are stale - clearing", GetName().AsCString());
-        // filter said that cached values are stale
-        m_children_byindex.Clear();
-        m_name_toindex.Clear();
-        // usually, an object's value can change but this does not alter its children count
-        // for a synthetic VO that might indeed happen, so we need to tell the upper echelons
-        // that they need to come back to us asking for children
-        m_children_count_valid = false;
-        m_synthetic_children_cache.Clear();
-        m_synthetic_children_count = UINT32_MAX;
-        m_might_have_children = eLazyBoolCalculate;
-    }
-    else
-    {
-        if (log)
-            log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic filter said caches are still valid", GetName().AsCString());
-    }
-    
-    m_provides_value = eLazyBoolCalculate;
-    
-    lldb::ValueObjectSP synth_val(m_synth_filter_ap->GetSyntheticValue());
-    
-    if (synth_val && synth_val->CanProvideValue())
-    {
-        if (log)
-            log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic filter said it can provide a value", GetName().AsCString());
+ConstString ValueObjectSynthetic::GetQualifiedTypeName() {
+  return m_parent->GetQualifiedTypeName();
+}
 
-        m_provides_value = eLazyBoolYes;
-        CopyValueData(synth_val.get());
-    }
-    else
-    {
-        if (log)
-            log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic filter said it will not provide a value", GetName().AsCString());
+ConstString ValueObjectSynthetic::GetDisplayTypeName() {
+  if (ConstString synth_name = m_synth_filter_ap->GetSyntheticTypeName())
+    return synth_name;
 
-        m_provides_value = eLazyBoolNo;
-        CopyValueData(m_parent);
-    }
-    
-    SetValueIsValid(true);
-    return true;
+  return m_parent->GetDisplayTypeName();
+}
+
+size_t ValueObjectSynthetic::CalculateNumChildren(uint32_t max) {
+  Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
+
+  UpdateValueIfNeeded();
+  if (m_synthetic_children_count < UINT32_MAX)
+    return m_synthetic_children_count <= max ? m_synthetic_children_count : max;
+
+  if (max < UINT32_MAX) {
+    size_t num_children = m_synth_filter_ap->CalculateNumChildren(max);
+    if (log)
+      log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
+                  "%s and type %s, the filter returned %zu child values",
+                  GetName().AsCString(), GetTypeName().AsCString(),
+                  num_children);
+    return num_children;
+  } else {
+    size_t num_children = (m_synthetic_children_count =
+                               m_synth_filter_ap->CalculateNumChildren(max));
+    if (log)
+      log->Printf("[ValueObjectSynthetic::CalculateNumChildren] for VO of name "
+                  "%s and type %s, the filter returned %zu child values",
+                  GetName().AsCString(), GetTypeName().AsCString(),
+                  num_children);
+    return num_children;
+  }
 }
 
 lldb::ValueObjectSP
-ValueObjectSynthetic::GetChildAtIndex (size_t idx, bool can_create)
-{
-    Log* log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
-    
+ValueObjectSynthetic::GetDynamicValue(lldb::DynamicValueType valueType) {
+  if (!m_parent)
+    return lldb::ValueObjectSP();
+  if (IsDynamic() && GetDynamicValueType() == valueType)
+    return GetSP();
+  return m_parent->GetDynamicValue(valueType);
+}
+
+bool ValueObjectSynthetic::MightHaveChildren() {
+  if (m_might_have_children == eLazyBoolCalculate)
+    m_might_have_children =
+        (m_synth_filter_ap->MightHaveChildren() ? eLazyBoolYes : eLazyBoolNo);
+  return (m_might_have_children == eLazyBoolNo ? false : true);
+}
+
+uint64_t ValueObjectSynthetic::GetByteSize() { return m_parent->GetByteSize(); }
+
+lldb::ValueType ValueObjectSynthetic::GetValueType() const {
+  return m_parent->GetValueType();
+}
+
+void ValueObjectSynthetic::CreateSynthFilter() {
+  m_synth_filter_ap = (m_synth_sp->GetFrontEnd(*m_parent));
+  if (!m_synth_filter_ap.get())
+    m_synth_filter_ap.reset(new DummySyntheticFrontEnd(*m_parent));
+}
+
+bool ValueObjectSynthetic::UpdateValue() {
+  Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
+
+  SetValueIsValid(false);
+  m_error.Clear();
+
+  if (!m_parent->UpdateValueIfNeeded(false)) {
+    // our parent could not update.. as we are meaningless without a parent,
+    // just stop
+    if (m_parent->GetError().Fail())
+      m_error = m_parent->GetError();
+    return false;
+  }
+
+  // regenerate the synthetic filter if our typename changes
+  // <rdar://problem/12424824>
+  ConstString new_parent_type_name = m_parent->GetTypeName();
+  if (new_parent_type_name != m_parent_type_name) {
     if (log)
-        log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving child at index %zu",
-                    GetName().AsCString(),
-                    idx);
-    
-    UpdateValueIfNeeded();
-    
-    ValueObject *valobj;
-    if (m_children_byindex.GetValueForKey(idx, valobj) == false)
-    {
-        if (can_create && m_synth_filter_ap.get() != nullptr)
-        {
-            if (log)
-                log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index %zu not cached and will be created",
-                            GetName().AsCString(),
-                            idx);
-
-            lldb::ValueObjectSP synth_guy = m_synth_filter_ap->GetChildAtIndex (idx);
-
-            if (log)
-                log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index %zu created as %p (is "
-                            "synthetic: %s)",
-                            GetName().AsCString(), idx, static_cast<void *>(synth_guy.get()),
-                            synth_guy.get() ? (synth_guy->IsSyntheticChildrenGenerated() ? "yes" : "no") : "no");
-
-            if (!synth_guy)
-                return synth_guy;
-            
-            if (synth_guy->IsSyntheticChildrenGenerated())
-                m_synthetic_children_cache.AppendObject(synth_guy);
-            m_children_byindex.SetValueForKey(idx, synth_guy.get());
-            synth_guy->SetPreferredDisplayLanguageIfNeeded(GetPreferredDisplayLanguage());
-            return synth_guy;
-        }
-        else
-        {
-            if (log)
-                log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index %zu not cached and cannot "
-                            "be created (can_create = %s, synth_filter = %p)",
-                            GetName().AsCString(), idx, can_create ? "yes" : "no",
-                            static_cast<void *>(m_synth_filter_ap.get()));
+      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, type changed "
+                  "from %s to %s, recomputing synthetic filter",
+                  GetName().AsCString(), m_parent_type_name.AsCString(),
+                  new_parent_type_name.AsCString());
+    m_parent_type_name = new_parent_type_name;
+    CreateSynthFilter();
+  }
 
-            return lldb::ValueObjectSP();
-        }
-    }
-    else
-    {
-        if (log)
-            log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index %zu cached as %p",
-                        GetName().AsCString(), idx, static_cast<void *>(valobj));
+  // let our backend do its update
+  if (m_synth_filter_ap->Update() == false) {
+    if (log)
+      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
+                  "filter said caches are stale - clearing",
+                  GetName().AsCString());
+    // filter said that cached values are stale
+    m_children_byindex.Clear();
+    m_name_toindex.Clear();
+    // usually, an object's value can change but this does not alter its
+    // children count
+    // for a synthetic VO that might indeed happen, so we need to tell the upper
+    // echelons
+    // that they need to come back to us asking for children
+    m_children_count_valid = false;
+    m_synthetic_children_cache.Clear();
+    m_synthetic_children_count = UINT32_MAX;
+    m_might_have_children = eLazyBoolCalculate;
+  } else {
+    if (log)
+      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
+                  "filter said caches are still valid",
+                  GetName().AsCString());
+  }
+
+  m_provides_value = eLazyBoolCalculate;
+
+  lldb::ValueObjectSP synth_val(m_synth_filter_ap->GetSyntheticValue());
+
+  if (synth_val && synth_val->CanProvideValue()) {
+    if (log)
+      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
+                  "filter said it can provide a value",
+                  GetName().AsCString());
+
+    m_provides_value = eLazyBoolYes;
+    CopyValueData(synth_val.get());
+  } else {
+    if (log)
+      log->Printf("[ValueObjectSynthetic::UpdateValue] name=%s, synthetic "
+                  "filter said it will not provide a value",
+                  GetName().AsCString());
+
+    m_provides_value = eLazyBoolNo;
+    CopyValueData(m_parent);
+  }
 
-        return valobj->GetSP();
+  SetValueIsValid(true);
+  return true;
+}
+
+lldb::ValueObjectSP ValueObjectSynthetic::GetChildAtIndex(size_t idx,
+                                                          bool can_create) {
+  Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS);
+
+  if (log)
+    log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, retrieving "
+                "child at index %zu",
+                GetName().AsCString(), idx);
+
+  UpdateValueIfNeeded();
+
+  ValueObject *valobj;
+  if (m_children_byindex.GetValueForKey(idx, valobj) == false) {
+    if (can_create && m_synth_filter_ap.get() != nullptr) {
+      if (log)
+        log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
+                    "index %zu not cached and will be created",
+                    GetName().AsCString(), idx);
+
+      lldb::ValueObjectSP synth_guy = m_synth_filter_ap->GetChildAtIndex(idx);
+
+      if (log)
+        log->Printf(
+            "[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at index "
+            "%zu created as %p (is "
+            "synthetic: %s)",
+            GetName().AsCString(), idx, static_cast<void *>(synth_guy.get()),
+            synth_guy.get()
+                ? (synth_guy->IsSyntheticChildrenGenerated() ? "yes" : "no")
+                : "no");
+
+      if (!synth_guy)
+        return synth_guy;
+
+      if (synth_guy->IsSyntheticChildrenGenerated())
+        m_synthetic_children_cache.AppendObject(synth_guy);
+      m_children_byindex.SetValueForKey(idx, synth_guy.get());
+      synth_guy->SetPreferredDisplayLanguageIfNeeded(
+          GetPreferredDisplayLanguage());
+      return synth_guy;
+    } else {
+      if (log)
+        log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
+                    "index %zu not cached and cannot "
+                    "be created (can_create = %s, synth_filter = %p)",
+                    GetName().AsCString(), idx, can_create ? "yes" : "no",
+                    static_cast<void *>(m_synth_filter_ap.get()));
+
+      return lldb::ValueObjectSP();
     }
+  } else {
+    if (log)
+      log->Printf("[ValueObjectSynthetic::GetChildAtIndex] name=%s, child at "
+                  "index %zu cached as %p",
+                  GetName().AsCString(), idx, static_cast<void *>(valobj));
+
+    return valobj->GetSP();
+  }
 }
 
 lldb::ValueObjectSP
-ValueObjectSynthetic::GetChildMemberWithName (const ConstString &name, bool can_create)
-{
-    UpdateValueIfNeeded();
+ValueObjectSynthetic::GetChildMemberWithName(const ConstString &name,
+                                             bool can_create) {
+  UpdateValueIfNeeded();
+
+  uint32_t index = GetIndexOfChildWithName(name);
+
+  if (index == UINT32_MAX)
+    return lldb::ValueObjectSP();
+
+  return GetChildAtIndex(index, can_create);
+}
+
+size_t ValueObjectSynthetic::GetIndexOfChildWithName(const ConstString &name) {
+  UpdateValueIfNeeded();
 
-    uint32_t index = GetIndexOfChildWithName(name);
-    
+  uint32_t found_index = UINT32_MAX;
+  bool did_find = m_name_toindex.GetValueForKey(name.GetCString(), found_index);
+
+  if (!did_find && m_synth_filter_ap.get() != nullptr) {
+    uint32_t index = m_synth_filter_ap->GetIndexOfChildWithName(name);
     if (index == UINT32_MAX)
-        return lldb::ValueObjectSP();
-    
-    return GetChildAtIndex(index, can_create);
-}
-
-size_t
-ValueObjectSynthetic::GetIndexOfChildWithName (const ConstString &name)
-{
-    UpdateValueIfNeeded();
-    
-    uint32_t found_index = UINT32_MAX;
-    bool did_find = m_name_toindex.GetValueForKey(name.GetCString(), found_index);
-    
-    if (!did_find && m_synth_filter_ap.get() != nullptr)
-    {
-        uint32_t index = m_synth_filter_ap->GetIndexOfChildWithName (name);
-        if (index == UINT32_MAX)
-            return index;
-        m_name_toindex.SetValueForKey(name.GetCString(), index);
-        return index;
-    }
-    else if (!did_find && m_synth_filter_ap.get() == nullptr)
-        return UINT32_MAX;
-    else /*if (iter != m_name_toindex.end())*/
-        return found_index;
+      return index;
+    m_name_toindex.SetValueForKey(name.GetCString(), index);
+    return index;
+  } else if (!did_find && m_synth_filter_ap.get() == nullptr)
+    return UINT32_MAX;
+  else /*if (iter != m_name_toindex.end())*/
+    return found_index;
 }
 
-bool
-ValueObjectSynthetic::IsInScope ()
-{
-    return m_parent->IsInScope();
+bool ValueObjectSynthetic::IsInScope() { return m_parent->IsInScope(); }
+
+lldb::ValueObjectSP ValueObjectSynthetic::GetNonSyntheticValue() {
+  return m_parent->GetSP();
 }
 
-lldb::ValueObjectSP
-ValueObjectSynthetic::GetNonSyntheticValue ()
-{
-    return m_parent->GetSP();
-}
-
-void
-ValueObjectSynthetic::CopyValueData (ValueObject *source)
-{
-    m_value = (source->UpdateValueIfNeeded(), source->GetValue());
-    ExecutionContext exe_ctx (GetExecutionContextRef());
-    m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
-}
-
-bool
-ValueObjectSynthetic::CanProvideValue ()
-{
-    if (!UpdateValueIfNeeded())
-        return false;
-    if (m_provides_value == eLazyBoolYes)
-        return true;
-    return m_parent->CanProvideValue();
-}
-
-bool
-ValueObjectSynthetic::SetValueFromCString (const char *value_str, Error& error)
-{
-    return m_parent->SetValueFromCString(value_str, error);
-}
-
-void
-ValueObjectSynthetic::SetFormat (lldb::Format format)
-{
-    if (m_parent)
-    {
-        m_parent->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
-        m_parent->SetFormat(format);
-    }
-    this->ValueObject::SetFormat(format);
-    this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
+void ValueObjectSynthetic::CopyValueData(ValueObject *source) {
+  m_value = (source->UpdateValueIfNeeded(), source->GetValue());
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+  m_error = m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
 }
 
-void
-ValueObjectSynthetic::SetPreferredDisplayLanguage (lldb::LanguageType lang)
-{
-    this->ValueObject::SetPreferredDisplayLanguage(lang);
-    if (m_parent)
-        m_parent->SetPreferredDisplayLanguage(lang);
+bool ValueObjectSynthetic::CanProvideValue() {
+  if (!UpdateValueIfNeeded())
+    return false;
+  if (m_provides_value == eLazyBoolYes)
+    return true;
+  return m_parent->CanProvideValue();
 }
 
-lldb::LanguageType
-ValueObjectSynthetic::GetPreferredDisplayLanguage ()
-{
-    if (m_preferred_display_language == lldb::eLanguageTypeUnknown)
-    {
-        if (m_parent)
-            return m_parent->GetPreferredDisplayLanguage();
-        return lldb::eLanguageTypeUnknown;
-    }
-    else
-        return m_preferred_display_language;
+bool ValueObjectSynthetic::SetValueFromCString(const char *value_str,
+                                               Error &error) {
+  return m_parent->SetValueFromCString(value_str, error);
 }
 
-bool
-ValueObjectSynthetic::IsSyntheticChildrenGenerated ()
-{
-    if (m_parent)
-        return m_parent->IsSyntheticChildrenGenerated();
-    return false;
+void ValueObjectSynthetic::SetFormat(lldb::Format format) {
+  if (m_parent) {
+    m_parent->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
+    m_parent->SetFormat(format);
+  }
+  this->ValueObject::SetFormat(format);
+  this->ClearUserVisibleData(eClearUserVisibleDataItemsAll);
 }
 
-void
-ValueObjectSynthetic::SetSyntheticChildrenGenerated (bool b)
-{
-    if (m_parent)
-        m_parent->SetSyntheticChildrenGenerated(b);
-    this->ValueObject::SetSyntheticChildrenGenerated(b);
+void ValueObjectSynthetic::SetPreferredDisplayLanguage(
+    lldb::LanguageType lang) {
+  this->ValueObject::SetPreferredDisplayLanguage(lang);
+  if (m_parent)
+    m_parent->SetPreferredDisplayLanguage(lang);
 }
 
-bool
-ValueObjectSynthetic::GetDeclaration (Declaration &decl)
-{
+lldb::LanguageType ValueObjectSynthetic::GetPreferredDisplayLanguage() {
+  if (m_preferred_display_language == lldb::eLanguageTypeUnknown) {
     if (m_parent)
-        return m_parent->GetDeclaration(decl);
+      return m_parent->GetPreferredDisplayLanguage();
+    return lldb::eLanguageTypeUnknown;
+  } else
+    return m_preferred_display_language;
+}
 
-    return ValueObject::GetDeclaration(decl);
+bool ValueObjectSynthetic::IsSyntheticChildrenGenerated() {
+  if (m_parent)
+    return m_parent->IsSyntheticChildrenGenerated();
+  return false;
 }
 
-uint64_t
-ValueObjectSynthetic::GetLanguageFlags ()
-{
-    if (m_parent)
-        return m_parent->GetLanguageFlags();
-    return this->ValueObject::GetLanguageFlags();
+void ValueObjectSynthetic::SetSyntheticChildrenGenerated(bool b) {
+  if (m_parent)
+    m_parent->SetSyntheticChildrenGenerated(b);
+  this->ValueObject::SetSyntheticChildrenGenerated(b);
 }
 
-void
-ValueObjectSynthetic::SetLanguageFlags (uint64_t flags)
-{
-    if (m_parent)
-        m_parent->SetLanguageFlags(flags);
-    else
-        this->ValueObject::SetLanguageFlags(flags);
+bool ValueObjectSynthetic::GetDeclaration(Declaration &decl) {
+  if (m_parent)
+    return m_parent->GetDeclaration(decl);
+
+  return ValueObject::GetDeclaration(decl);
+}
+
+uint64_t ValueObjectSynthetic::GetLanguageFlags() {
+  if (m_parent)
+    return m_parent->GetLanguageFlags();
+  return this->ValueObject::GetLanguageFlags();
+}
+
+void ValueObjectSynthetic::SetLanguageFlags(uint64_t flags) {
+  if (m_parent)
+    m_parent->SetLanguageFlags(flags);
+  else
+    this->ValueObject::SetLanguageFlags(flags);
 }

Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp Tue Sep  6 15:57:50 2016
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 #include "lldb/Core/ValueObjectVariable.h"
 
 // C Includes
@@ -16,8 +15,8 @@
 // Project includes
 #include "lldb/Core/Module.h"
 #include "lldb/Core/RegisterValue.h"
-#include "lldb/Core/ValueObjectList.h"
 #include "lldb/Core/Value.h"
+#include "lldb/Core/ValueObjectList.h"
 
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"
@@ -32,422 +31,357 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 
-
 using namespace lldb_private;
 
 lldb::ValueObjectSP
-ValueObjectVariable::Create (ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
-{
-    return (new ValueObjectVariable (exe_scope, var_sp))->GetSP();
-}
-
-ValueObjectVariable::ValueObjectVariable (ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp) :
-    ValueObject(exe_scope),
-    m_variable_sp(var_sp)
-{
-    // Do not attempt to construct one of these objects with no variable!
-    assert (m_variable_sp.get() != NULL);
-    m_name = var_sp->GetName();
-}
-
-ValueObjectVariable::~ValueObjectVariable()
-{
-}
-
-CompilerType
-ValueObjectVariable::GetCompilerTypeImpl ()
-{
-    Type *var_type = m_variable_sp->GetType();
-    if (var_type)
-        return var_type->GetForwardCompilerType ();
-    return CompilerType();
-}
-
-ConstString
-ValueObjectVariable::GetTypeName()
-{
-    Type * var_type = m_variable_sp->GetType();
-    if (var_type)
-        return var_type->GetName();
-    return ConstString();
-}
-
-ConstString
-ValueObjectVariable::GetDisplayTypeName()
-{
-    Type * var_type = m_variable_sp->GetType();
-    if (var_type)
-        return var_type->GetForwardCompilerType ().GetDisplayTypeName();
-    return ConstString();
-}
-
-ConstString
-ValueObjectVariable::GetQualifiedTypeName()
-{
-    Type * var_type = m_variable_sp->GetType();
-    if (var_type)
-        return var_type->GetQualifiedName();
-    return ConstString();
-}
-
-size_t
-ValueObjectVariable::CalculateNumChildren(uint32_t max)
-{    
-    CompilerType type(GetCompilerType());
-    
-    if (!type.IsValid())
-        return 0;
-    
-    const bool omit_empty_base_classes = true;
-    auto child_count = type.GetNumChildren(omit_empty_base_classes);
-    return child_count <= max ? child_count : max;
-}
-
-uint64_t
-ValueObjectVariable::GetByteSize()
-{
-    ExecutionContext exe_ctx(GetExecutionContextRef());
-    
-    CompilerType type(GetCompilerType());
-    
-    if (!type.IsValid())
-        return 0;
-    
-    return type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
-}
-
-lldb::ValueType
-ValueObjectVariable::GetValueType() const
-{
-    if (m_variable_sp)
-        return m_variable_sp->GetScope();
-    return lldb::eValueTypeInvalid;
-}
-
-bool
-ValueObjectVariable::UpdateValue ()
-{
-    SetValueIsValid (false);
-    m_error.Clear();
-
-    Variable *variable = m_variable_sp.get();
-    DWARFExpression &expr = variable->LocationExpression();
-    
-    if (variable->GetLocationIsConstantValueData())
-    {
-        // expr doesn't contain DWARF bytes, it contains the constant variable
-        // value bytes themselves...
-        if (expr.GetExpressionData(m_data))
-            m_value.SetContext(Value::eContextTypeVariable, variable);
-        else
-            m_error.SetErrorString ("empty constant data");
-        // constant bytes can't be edited - sorry
-        m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL);
-    }
-    else
-    {
-        lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
-        ExecutionContext exe_ctx (GetExecutionContextRef());
-        
-        Target *target = exe_ctx.GetTargetPtr();
-        if (target)
-        {
-            m_data.SetByteOrder(target->GetArchitecture().GetByteOrder());
-            m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
-        }
+ValueObjectVariable::Create(ExecutionContextScope *exe_scope,
+                            const lldb::VariableSP &var_sp) {
+  return (new ValueObjectVariable(exe_scope, var_sp))->GetSP();
+}
 
-        if (expr.IsLocationList())
-        {
-            SymbolContext sc;
-            variable->CalculateSymbolContext (&sc);
-            if (sc.function)
-                loclist_base_load_addr = sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress (target);
-        }
-        Value old_value(m_value);
-        if (expr.Evaluate (&exe_ctx,
-                           nullptr,
-                           nullptr,
-                           nullptr,
-                           loclist_base_load_addr,
-                           nullptr,
-                           nullptr,
-                           m_value,
-                           &m_error))
-        {
-            m_resolved_value = m_value;
-            m_value.SetContext(Value::eContextTypeVariable, variable);
-            
-            CompilerType compiler_type = GetCompilerType();
-            if (compiler_type.IsValid())
-                m_value.SetCompilerType(compiler_type);
-
-            Value::ValueType value_type = m_value.GetValueType();
-
-            Process *process = exe_ctx.GetProcessPtr();
-            const bool process_is_alive = process && process->IsAlive();
-            const uint32_t type_info = compiler_type.GetTypeInfo();
-            const bool is_pointer_or_ref = (type_info & (lldb::eTypeIsPointer | lldb::eTypeIsReference)) != 0;
-
-            switch (value_type)
-            {
-                case Value::eValueTypeFileAddress:
-                    // If this type is a pointer, then its children will be considered load addresses
-                    // if the pointer or reference is dereferenced, but only if the process is alive.
-                    //
-                    // There could be global variables like in the following code:
-                    // struct LinkedListNode { Foo* foo; LinkedListNode* next; };
-                    // Foo g_foo1;
-                    // Foo g_foo2;
-                    // LinkedListNode g_second_node = { &g_foo2, NULL };
-                    // LinkedListNode g_first_node = { &g_foo1, &g_second_node };
-                    //
-                    // When we aren't running, we should be able to look at these variables using
-                    // the "target variable" command. Children of the "g_first_node" always will
-                    // be of the same address type as the parent. But children of the "next" member of
-                    // LinkedListNode will become load addresses if we have a live process, or remain
-                    // what a file address if it what a file address.
-                    if (process_is_alive && is_pointer_or_ref)
-                        SetAddressTypeOfChildren(eAddressTypeLoad);
-                    else
-                        SetAddressTypeOfChildren(eAddressTypeFile);
-                    break;
-                case Value::eValueTypeHostAddress:
-                    // Same as above for load addresses, except children of pointer or refs are always
-                    // load addresses. Host addresses are used to store freeze dried variables. If this
-                    // type is a struct, the entire struct contents will be copied into the heap of the
-                    // LLDB process, but we do not currrently follow any pointers.
-                    if (is_pointer_or_ref)
-                        SetAddressTypeOfChildren(eAddressTypeLoad);
-                    else
-                        SetAddressTypeOfChildren(eAddressTypeHost);
-                    break;
-                case Value::eValueTypeLoadAddress:
-                case Value::eValueTypeScalar:
-                case Value::eValueTypeVector:
-                    SetAddressTypeOfChildren(eAddressTypeLoad);
-                    break;
-            }
+ValueObjectVariable::ValueObjectVariable(ExecutionContextScope *exe_scope,
+                                         const lldb::VariableSP &var_sp)
+    : ValueObject(exe_scope), m_variable_sp(var_sp) {
+  // Do not attempt to construct one of these objects with no variable!
+  assert(m_variable_sp.get() != NULL);
+  m_name = var_sp->GetName();
+}
 
-            switch (value_type)
-            {
-            case Value::eValueTypeVector:
-                    // fall through
-            case Value::eValueTypeScalar:
-                // The variable value is in the Scalar value inside the m_value.
-                // We can point our m_data right to it.
-                m_error = m_value.GetValueAsData (&exe_ctx, m_data, 0, GetModule().get());
-                break;
-
-            case Value::eValueTypeFileAddress:
-            case Value::eValueTypeLoadAddress:
-            case Value::eValueTypeHostAddress:
-                // The DWARF expression result was an address in the inferior
-                // process. If this variable is an aggregate type, we just need
-                // the address as the main value as all child variable objects
-                // will rely upon this location and add an offset and then read
-                // their own values as needed. If this variable is a simple
-                // type, we read all data for it into m_data.
-                // Make sure this type has a value before we try and read it
-
-                // If we have a file address, convert it to a load address if we can.
-                if (value_type == Value::eValueTypeFileAddress && process_is_alive)
-                {
-                    lldb::addr_t file_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
-                    if (file_addr != LLDB_INVALID_ADDRESS)
-                    {
-                        SymbolContext var_sc;
-                        variable->CalculateSymbolContext(&var_sc);
-                        if (var_sc.module_sp)
-                        {
-                            ObjectFile *objfile = var_sc.module_sp->GetObjectFile();
-                            if (objfile)
-                            {
-                                Address so_addr(file_addr, objfile->GetSectionList());
-                                lldb::addr_t load_addr = so_addr.GetLoadAddress (target);
-                                if (load_addr != LLDB_INVALID_ADDRESS)
-                                {
-                                    m_value.SetValueType(Value::eValueTypeLoadAddress);
-                                    m_value.GetScalar() = load_addr;
-                                }
-                            }
-                        }
-                    }
-                }
+ValueObjectVariable::~ValueObjectVariable() {}
 
-                if (!CanProvideValue())
-                {
-                    // this value object represents an aggregate type whose
-                    // children have values, but this object does not. So we
-                    // say we are changed if our location has changed.
-                    SetValueDidChange (value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
-                }
-                else
-                {
-                    // Copy the Value and set the context to use our Variable
-                    // so it can extract read its value into m_data appropriately
-                    Value value(m_value);
-                    value.SetContext(Value::eContextTypeVariable, variable);
-                    m_error = value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
-                    
-                    SetValueDidChange (value_type != old_value.GetValueType() || m_value.GetScalar() != old_value.GetScalar());
-                }
-                break;
-            }
+CompilerType ValueObjectVariable::GetCompilerTypeImpl() {
+  Type *var_type = m_variable_sp->GetType();
+  if (var_type)
+    return var_type->GetForwardCompilerType();
+  return CompilerType();
+}
 
-            SetValueIsValid (m_error.Success());
-        }
-        else
-        {
-            // could not find location, won't allow editing
-            m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL);
-        }
-    }
-    return m_error.Success();
+ConstString ValueObjectVariable::GetTypeName() {
+  Type *var_type = m_variable_sp->GetType();
+  if (var_type)
+    return var_type->GetName();
+  return ConstString();
 }
 
+ConstString ValueObjectVariable::GetDisplayTypeName() {
+  Type *var_type = m_variable_sp->GetType();
+  if (var_type)
+    return var_type->GetForwardCompilerType().GetDisplayTypeName();
+  return ConstString();
+}
 
+ConstString ValueObjectVariable::GetQualifiedTypeName() {
+  Type *var_type = m_variable_sp->GetType();
+  if (var_type)
+    return var_type->GetQualifiedName();
+  return ConstString();
+}
 
-bool
-ValueObjectVariable::IsInScope ()
-{
-    const ExecutionContextRef &exe_ctx_ref = GetExecutionContextRef();
-    if (exe_ctx_ref.HasFrameRef())
-    {
-        ExecutionContext exe_ctx (exe_ctx_ref);
-        StackFrame *frame = exe_ctx.GetFramePtr();
-        if (frame)
-        {
-            return m_variable_sp->IsInScope (frame);
-        }
+size_t ValueObjectVariable::CalculateNumChildren(uint32_t max) {
+  CompilerType type(GetCompilerType());
+
+  if (!type.IsValid())
+    return 0;
+
+  const bool omit_empty_base_classes = true;
+  auto child_count = type.GetNumChildren(omit_empty_base_classes);
+  return child_count <= max ? child_count : max;
+}
+
+uint64_t ValueObjectVariable::GetByteSize() {
+  ExecutionContext exe_ctx(GetExecutionContextRef());
+
+  CompilerType type(GetCompilerType());
+
+  if (!type.IsValid())
+    return 0;
+
+  return type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
+}
+
+lldb::ValueType ValueObjectVariable::GetValueType() const {
+  if (m_variable_sp)
+    return m_variable_sp->GetScope();
+  return lldb::eValueTypeInvalid;
+}
+
+bool ValueObjectVariable::UpdateValue() {
+  SetValueIsValid(false);
+  m_error.Clear();
+
+  Variable *variable = m_variable_sp.get();
+  DWARFExpression &expr = variable->LocationExpression();
+
+  if (variable->GetLocationIsConstantValueData()) {
+    // expr doesn't contain DWARF bytes, it contains the constant variable
+    // value bytes themselves...
+    if (expr.GetExpressionData(m_data))
+      m_value.SetContext(Value::eContextTypeVariable, variable);
+    else
+      m_error.SetErrorString("empty constant data");
+    // constant bytes can't be edited - sorry
+    m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL);
+  } else {
+    lldb::addr_t loclist_base_load_addr = LLDB_INVALID_ADDRESS;
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+
+    Target *target = exe_ctx.GetTargetPtr();
+    if (target) {
+      m_data.SetByteOrder(target->GetArchitecture().GetByteOrder());
+      m_data.SetAddressByteSize(target->GetArchitecture().GetAddressByteSize());
+    }
+
+    if (expr.IsLocationList()) {
+      SymbolContext sc;
+      variable->CalculateSymbolContext(&sc);
+      if (sc.function)
+        loclist_base_load_addr =
+            sc.function->GetAddressRange().GetBaseAddress().GetLoadAddress(
+                target);
+    }
+    Value old_value(m_value);
+    if (expr.Evaluate(&exe_ctx, nullptr, nullptr, nullptr,
+                      loclist_base_load_addr, nullptr, nullptr, m_value,
+                      &m_error)) {
+      m_resolved_value = m_value;
+      m_value.SetContext(Value::eContextTypeVariable, variable);
+
+      CompilerType compiler_type = GetCompilerType();
+      if (compiler_type.IsValid())
+        m_value.SetCompilerType(compiler_type);
+
+      Value::ValueType value_type = m_value.GetValueType();
+
+      Process *process = exe_ctx.GetProcessPtr();
+      const bool process_is_alive = process && process->IsAlive();
+      const uint32_t type_info = compiler_type.GetTypeInfo();
+      const bool is_pointer_or_ref =
+          (type_info & (lldb::eTypeIsPointer | lldb::eTypeIsReference)) != 0;
+
+      switch (value_type) {
+      case Value::eValueTypeFileAddress:
+        // If this type is a pointer, then its children will be considered load
+        // addresses
+        // if the pointer or reference is dereferenced, but only if the process
+        // is alive.
+        //
+        // There could be global variables like in the following code:
+        // struct LinkedListNode { Foo* foo; LinkedListNode* next; };
+        // Foo g_foo1;
+        // Foo g_foo2;
+        // LinkedListNode g_second_node = { &g_foo2, NULL };
+        // LinkedListNode g_first_node = { &g_foo1, &g_second_node };
+        //
+        // When we aren't running, we should be able to look at these variables
+        // using
+        // the "target variable" command. Children of the "g_first_node" always
+        // will
+        // be of the same address type as the parent. But children of the "next"
+        // member of
+        // LinkedListNode will become load addresses if we have a live process,
+        // or remain
+        // what a file address if it what a file address.
+        if (process_is_alive && is_pointer_or_ref)
+          SetAddressTypeOfChildren(eAddressTypeLoad);
         else
-        {
-            // This ValueObject had a frame at one time, but now we
-            // can't locate it, so return false since we probably aren't
-            // in scope.
-            return false;
+          SetAddressTypeOfChildren(eAddressTypeFile);
+        break;
+      case Value::eValueTypeHostAddress:
+        // Same as above for load addresses, except children of pointer or refs
+        // are always
+        // load addresses. Host addresses are used to store freeze dried
+        // variables. If this
+        // type is a struct, the entire struct contents will be copied into the
+        // heap of the
+        // LLDB process, but we do not currrently follow any pointers.
+        if (is_pointer_or_ref)
+          SetAddressTypeOfChildren(eAddressTypeLoad);
+        else
+          SetAddressTypeOfChildren(eAddressTypeHost);
+        break;
+      case Value::eValueTypeLoadAddress:
+      case Value::eValueTypeScalar:
+      case Value::eValueTypeVector:
+        SetAddressTypeOfChildren(eAddressTypeLoad);
+        break;
+      }
+
+      switch (value_type) {
+      case Value::eValueTypeVector:
+      // fall through
+      case Value::eValueTypeScalar:
+        // The variable value is in the Scalar value inside the m_value.
+        // We can point our m_data right to it.
+        m_error =
+            m_value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+        break;
+
+      case Value::eValueTypeFileAddress:
+      case Value::eValueTypeLoadAddress:
+      case Value::eValueTypeHostAddress:
+        // The DWARF expression result was an address in the inferior
+        // process. If this variable is an aggregate type, we just need
+        // the address as the main value as all child variable objects
+        // will rely upon this location and add an offset and then read
+        // their own values as needed. If this variable is a simple
+        // type, we read all data for it into m_data.
+        // Make sure this type has a value before we try and read it
+
+        // If we have a file address, convert it to a load address if we can.
+        if (value_type == Value::eValueTypeFileAddress && process_is_alive) {
+          lldb::addr_t file_addr =
+              m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
+          if (file_addr != LLDB_INVALID_ADDRESS) {
+            SymbolContext var_sc;
+            variable->CalculateSymbolContext(&var_sc);
+            if (var_sc.module_sp) {
+              ObjectFile *objfile = var_sc.module_sp->GetObjectFile();
+              if (objfile) {
+                Address so_addr(file_addr, objfile->GetSectionList());
+                lldb::addr_t load_addr = so_addr.GetLoadAddress(target);
+                if (load_addr != LLDB_INVALID_ADDRESS) {
+                  m_value.SetValueType(Value::eValueTypeLoadAddress);
+                  m_value.GetScalar() = load_addr;
+                }
+              }
+            }
+          }
         }
+
+        if (!CanProvideValue()) {
+          // this value object represents an aggregate type whose
+          // children have values, but this object does not. So we
+          // say we are changed if our location has changed.
+          SetValueDidChange(value_type != old_value.GetValueType() ||
+                            m_value.GetScalar() != old_value.GetScalar());
+        } else {
+          // Copy the Value and set the context to use our Variable
+          // so it can extract read its value into m_data appropriately
+          Value value(m_value);
+          value.SetContext(Value::eContextTypeVariable, variable);
+          m_error =
+              value.GetValueAsData(&exe_ctx, m_data, 0, GetModule().get());
+
+          SetValueDidChange(value_type != old_value.GetValueType() ||
+                            m_value.GetScalar() != old_value.GetScalar());
+        }
+        break;
+      }
+
+      SetValueIsValid(m_error.Success());
+    } else {
+      // could not find location, won't allow editing
+      m_resolved_value.SetContext(Value::eContextTypeInvalid, NULL);
     }
-    // We have a variable that wasn't tied to a frame, which
-    // means it is a global and is always in scope.
-    return true;
-         
+  }
+  return m_error.Success();
 }
 
-lldb::ModuleSP
-ValueObjectVariable::GetModule()
-{
-    if (m_variable_sp)
-    {
-        SymbolContextScope *sc_scope = m_variable_sp->GetSymbolContextScope();
-        if (sc_scope)
-        {
-            return sc_scope->CalculateSymbolContextModule();
-        }
+bool ValueObjectVariable::IsInScope() {
+  const ExecutionContextRef &exe_ctx_ref = GetExecutionContextRef();
+  if (exe_ctx_ref.HasFrameRef()) {
+    ExecutionContext exe_ctx(exe_ctx_ref);
+    StackFrame *frame = exe_ctx.GetFramePtr();
+    if (frame) {
+      return m_variable_sp->IsInScope(frame);
+    } else {
+      // This ValueObject had a frame at one time, but now we
+      // can't locate it, so return false since we probably aren't
+      // in scope.
+      return false;
     }
-    return lldb::ModuleSP();
+  }
+  // We have a variable that wasn't tied to a frame, which
+  // means it is a global and is always in scope.
+  return true;
 }
 
-SymbolContextScope *
-ValueObjectVariable::GetSymbolContextScope()
-{
-    if (m_variable_sp)
-        return m_variable_sp->GetSymbolContextScope();
-    return NULL;
-}
-
-bool
-ValueObjectVariable::GetDeclaration (Declaration &decl)
-{
-    if (m_variable_sp)
-    {
-        decl = m_variable_sp->GetDeclaration();
-        return true;
+lldb::ModuleSP ValueObjectVariable::GetModule() {
+  if (m_variable_sp) {
+    SymbolContextScope *sc_scope = m_variable_sp->GetSymbolContextScope();
+    if (sc_scope) {
+      return sc_scope->CalculateSymbolContextModule();
     }
-    return false;
+  }
+  return lldb::ModuleSP();
 }
 
-const char *
-ValueObjectVariable::GetLocationAsCString ()
-{
-    if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo)
-        return GetLocationAsCStringImpl(m_resolved_value,
-                                        m_data);
-    else
-        return ValueObject::GetLocationAsCString();
+SymbolContextScope *ValueObjectVariable::GetSymbolContextScope() {
+  if (m_variable_sp)
+    return m_variable_sp->GetSymbolContextScope();
+  return NULL;
+}
+
+bool ValueObjectVariable::GetDeclaration(Declaration &decl) {
+  if (m_variable_sp) {
+    decl = m_variable_sp->GetDeclaration();
+    return true;
+  }
+  return false;
 }
 
-bool
-ValueObjectVariable::SetValueFromCString (const char *value_str, Error& error)
-{
-    if (!UpdateValueIfNeeded())
-    {
-        error.SetErrorString("unable to update value before writing");
-        return false;
+const char *ValueObjectVariable::GetLocationAsCString() {
+  if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo)
+    return GetLocationAsCStringImpl(m_resolved_value, m_data);
+  else
+    return ValueObject::GetLocationAsCString();
+}
+
+bool ValueObjectVariable::SetValueFromCString(const char *value_str,
+                                              Error &error) {
+  if (!UpdateValueIfNeeded()) {
+    error.SetErrorString("unable to update value before writing");
+    return false;
+  }
+
+  if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo) {
+    RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo();
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
+    RegisterValue reg_value;
+    if (!reg_info || !reg_ctx) {
+      error.SetErrorString("unable to retrieve register info");
+      return false;
     }
-    
-    if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo)
-    {
-        RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo();
-        ExecutionContext exe_ctx(GetExecutionContextRef());
-        RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
-        RegisterValue reg_value;
-        if (!reg_info || !reg_ctx)
-        {
-            error.SetErrorString("unable to retrieve register info");
-            return false;
-        }
-        error = reg_value.SetValueFromCString(reg_info, value_str);
-        if (error.Fail())
-            return false;
-        if (reg_ctx->WriteRegister (reg_info, reg_value))
-        {
-            SetNeedsUpdate();
-            return true;
-        }
-        else
-        {
-            error.SetErrorString("unable to write back to register");
-            return false;
-        }
+    error = reg_value.SetValueFromCString(reg_info, value_str);
+    if (error.Fail())
+      return false;
+    if (reg_ctx->WriteRegister(reg_info, reg_value)) {
+      SetNeedsUpdate();
+      return true;
+    } else {
+      error.SetErrorString("unable to write back to register");
+      return false;
     }
-    else
-        return ValueObject::SetValueFromCString(value_str, error);
+  } else
+    return ValueObject::SetValueFromCString(value_str, error);
 }
 
-bool
-ValueObjectVariable::SetData (DataExtractor &data, Error &error)
-{
-    if (!UpdateValueIfNeeded())
-    {
-        error.SetErrorString("unable to update value before writing");
-        return false;
+bool ValueObjectVariable::SetData(DataExtractor &data, Error &error) {
+  if (!UpdateValueIfNeeded()) {
+    error.SetErrorString("unable to update value before writing");
+    return false;
+  }
+
+  if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo) {
+    RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo();
+    ExecutionContext exe_ctx(GetExecutionContextRef());
+    RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
+    RegisterValue reg_value;
+    if (!reg_info || !reg_ctx) {
+      error.SetErrorString("unable to retrieve register info");
+      return false;
     }
-    
-    if (m_resolved_value.GetContextType() == Value::eContextTypeRegisterInfo)
-    {
-        RegisterInfo *reg_info = m_resolved_value.GetRegisterInfo();
-        ExecutionContext exe_ctx(GetExecutionContextRef());
-        RegisterContext *reg_ctx = exe_ctx.GetRegisterContext();
-        RegisterValue reg_value;
-        if (!reg_info || !reg_ctx)
-        {
-            error.SetErrorString("unable to retrieve register info");
-            return false;
-        }
-        error = reg_value.SetValueFromData(reg_info, data, 0, true);
-        if (error.Fail())
-            return false;
-        if (reg_ctx->WriteRegister (reg_info, reg_value))
-        {
-            SetNeedsUpdate();
-            return true;
-        }
-        else
-        {
-            error.SetErrorString("unable to write back to register");
-            return false;
-        }
+    error = reg_value.SetValueFromData(reg_info, data, 0, true);
+    if (error.Fail())
+      return false;
+    if (reg_ctx->WriteRegister(reg_info, reg_value)) {
+      SetNeedsUpdate();
+      return true;
+    } else {
+      error.SetErrorString("unable to write back to register");
+      return false;
     }
-    else
-        return ValueObject::SetData(data, error);
+  } else
+    return ValueObject::SetData(data, error);
 }

Modified: lldb/trunk/source/DataFormatters/CXXFunctionPointer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/CXXFunctionPointer.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/CXXFunctionPointer.cpp (original)
+++ lldb/trunk/source/DataFormatters/CXXFunctionPointer.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- CXXFormatterFunctions.cpp---------------------------------*- C++ -*-===//
+//===-- CXXFormatterFunctions.cpp---------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -20,47 +21,38 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-bool
-lldb_private::formatters::CXXFunctionPointerSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
-    std::string destination;
-    StreamString sstr;
-    AddressType func_ptr_address_type = eAddressTypeInvalid;
-    addr_t func_ptr_address = valobj.GetPointerValue (&func_ptr_address_type);
-    if (func_ptr_address != 0 && func_ptr_address != LLDB_INVALID_ADDRESS)
-    {
-        switch (func_ptr_address_type)
-        {
-            case eAddressTypeInvalid:
-            case eAddressTypeFile:
-            case eAddressTypeHost:
-                break;
-                
-            case eAddressTypeLoad:
-            {
-                ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
-                
-                Address so_addr;
-                Target *target = exe_ctx.GetTargetPtr();
-                if (target && target->GetSectionLoadList().IsEmpty() == false)
-                {
-                    if (target->GetSectionLoadList().ResolveLoadAddress(func_ptr_address, so_addr))
-                    {
-                        so_addr.Dump (&sstr,
-                                      exe_ctx.GetBestExecutionContextScope(),
-                                      Address::DumpStyleResolvedDescription,
-                                      Address::DumpStyleSectionNameOffset);
-                    }
-                }
-            }
-                break;
+bool lldb_private::formatters::CXXFunctionPointerSummaryProvider(
+    ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
+  std::string destination;
+  StreamString sstr;
+  AddressType func_ptr_address_type = eAddressTypeInvalid;
+  addr_t func_ptr_address = valobj.GetPointerValue(&func_ptr_address_type);
+  if (func_ptr_address != 0 && func_ptr_address != LLDB_INVALID_ADDRESS) {
+    switch (func_ptr_address_type) {
+    case eAddressTypeInvalid:
+    case eAddressTypeFile:
+    case eAddressTypeHost:
+      break;
+
+    case eAddressTypeLoad: {
+      ExecutionContext exe_ctx(valobj.GetExecutionContextRef());
+
+      Address so_addr;
+      Target *target = exe_ctx.GetTargetPtr();
+      if (target && target->GetSectionLoadList().IsEmpty() == false) {
+        if (target->GetSectionLoadList().ResolveLoadAddress(func_ptr_address,
+                                                            so_addr)) {
+          so_addr.Dump(&sstr, exe_ctx.GetBestExecutionContextScope(),
+                       Address::DumpStyleResolvedDescription,
+                       Address::DumpStyleSectionNameOffset);
         }
+      }
+    } break;
     }
-    if (sstr.GetSize() > 0)
-    {
-        stream.Printf("(%s)", sstr.GetData());
-        return true;
-    }
-    else
-        return false;
+  }
+  if (sstr.GetSize() > 0) {
+    stream.Printf("(%s)", sstr.GetData());
+    return true;
+  } else
+    return false;
 }

Modified: lldb/trunk/source/DataFormatters/DataVisualization.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/DataVisualization.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/DataVisualization.cpp (original)
+++ lldb/trunk/source/DataFormatters/DataVisualization.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- DataVisualization.cpp ---------------------------------------*- C++ -*-===//
+//===-- DataVisualization.cpp ---------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -17,264 +18,209 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static FormatManager&
-GetFormatManager()
-{
-    static FormatManager g_format_manager;
-    return g_format_manager;
+static FormatManager &GetFormatManager() {
+  static FormatManager g_format_manager;
+  return g_format_manager;
 }
 
-void
-DataVisualization::ForceUpdate ()
-{
-    GetFormatManager().Changed();
-}
+void DataVisualization::ForceUpdate() { GetFormatManager().Changed(); }
 
-uint32_t
-DataVisualization::GetCurrentRevision ()
-{
-    return GetFormatManager().GetCurrentRevision();
+uint32_t DataVisualization::GetCurrentRevision() {
+  return GetFormatManager().GetCurrentRevision();
 }
 
-bool
-DataVisualization::ShouldPrintAsOneLiner (ValueObject& valobj)
-{
-    return GetFormatManager().ShouldPrintAsOneLiner(valobj);
+bool DataVisualization::ShouldPrintAsOneLiner(ValueObject &valobj) {
+  return GetFormatManager().ShouldPrintAsOneLiner(valobj);
 }
 
 lldb::TypeFormatImplSP
-DataVisualization::GetFormat (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
-{
-    return GetFormatManager().GetFormat(valobj, use_dynamic);
+DataVisualization::GetFormat(ValueObject &valobj,
+                             lldb::DynamicValueType use_dynamic) {
+  return GetFormatManager().GetFormat(valobj, use_dynamic);
 }
 
 lldb::TypeFormatImplSP
-DataVisualization::GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    return GetFormatManager().GetFormatForType(type_sp);
+DataVisualization::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  return GetFormatManager().GetFormatForType(type_sp);
 }
 
 lldb::TypeSummaryImplSP
-DataVisualization::GetSummaryFormat (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
-{
-    return GetFormatManager().GetSummaryFormat(valobj, use_dynamic);
+DataVisualization::GetSummaryFormat(ValueObject &valobj,
+                                    lldb::DynamicValueType use_dynamic) {
+  return GetFormatManager().GetSummaryFormat(valobj, use_dynamic);
 }
 
 lldb::TypeSummaryImplSP
-DataVisualization::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    return GetFormatManager().GetSummaryForType(type_sp);
+DataVisualization::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  return GetFormatManager().GetSummaryForType(type_sp);
 }
 
 #ifndef LLDB_DISABLE_PYTHON
 lldb::SyntheticChildrenSP
-DataVisualization::GetSyntheticChildren (ValueObject& valobj,
-                                         lldb::DynamicValueType use_dynamic)
-{
-    return GetFormatManager().GetSyntheticChildren(valobj, use_dynamic);
+DataVisualization::GetSyntheticChildren(ValueObject &valobj,
+                                        lldb::DynamicValueType use_dynamic) {
+  return GetFormatManager().GetSyntheticChildren(valobj, use_dynamic);
 }
 #endif
 
 #ifndef LLDB_DISABLE_PYTHON
-lldb::SyntheticChildrenSP
-DataVisualization::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    return GetFormatManager().GetSyntheticChildrenForType(type_sp);
+lldb::SyntheticChildrenSP DataVisualization::GetSyntheticChildrenForType(
+    lldb::TypeNameSpecifierImplSP type_sp) {
+  return GetFormatManager().GetSyntheticChildrenForType(type_sp);
 }
 #endif
 
 lldb::TypeFilterImplSP
-DataVisualization::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    return GetFormatManager().GetFilterForType(type_sp);
+DataVisualization::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  return GetFormatManager().GetFilterForType(type_sp);
 }
 
 #ifndef LLDB_DISABLE_PYTHON
 lldb::ScriptedSyntheticChildrenSP
-DataVisualization::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    return GetFormatManager().GetSyntheticForType(type_sp);
+DataVisualization::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  return GetFormatManager().GetSyntheticForType(type_sp);
 }
 #endif
 
 lldb::TypeValidatorImplSP
-DataVisualization::GetValidator (ValueObject& valobj, lldb::DynamicValueType use_dynamic)
-{
-    return GetFormatManager().GetValidator(valobj, use_dynamic);
+DataVisualization::GetValidator(ValueObject &valobj,
+                                lldb::DynamicValueType use_dynamic) {
+  return GetFormatManager().GetValidator(valobj, use_dynamic);
 }
 
 lldb::TypeValidatorImplSP
-DataVisualization::GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    return GetFormatManager().GetValidatorForType(type_sp);
-}
-
-bool
-DataVisualization::AnyMatches (ConstString type_name,
-                               TypeCategoryImpl::FormatCategoryItems items,
-                               bool only_enabled,
-                               const char** matching_category,
-                               TypeCategoryImpl::FormatCategoryItems* matching_type)
-{
-    return GetFormatManager().AnyMatches(type_name,
-                                         items,
-                                         only_enabled,
-                                         matching_category,
-                                         matching_type);
-}
-
-bool
-DataVisualization::Categories::GetCategory (const ConstString &category, lldb::TypeCategoryImplSP &entry,
-                                            bool allow_create)
-{
-    entry = GetFormatManager().GetCategory(category, allow_create);
-    return (entry.get() != NULL);
-}
-
-bool
-DataVisualization::Categories::GetCategory (lldb::LanguageType language, lldb::TypeCategoryImplSP &entry)
-{
-    if (LanguageCategory *lang_category = GetFormatManager().GetCategoryForLanguage(language))
-        entry = lang_category->GetCategory();
-    return (entry.get() != nullptr);
-}
-
-void
-DataVisualization::Categories::Add (const ConstString &category)
-{
-    GetFormatManager().GetCategory(category);
-}
-
-bool
-DataVisualization::Categories::Delete (const ConstString &category)
-{
-    GetFormatManager().DisableCategory(category);
-    return GetFormatManager().DeleteCategory(category);
+DataVisualization::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  return GetFormatManager().GetValidatorForType(type_sp);
+}
+
+bool DataVisualization::AnyMatches(
+    ConstString type_name, TypeCategoryImpl::FormatCategoryItems items,
+    bool only_enabled, const char **matching_category,
+    TypeCategoryImpl::FormatCategoryItems *matching_type) {
+  return GetFormatManager().AnyMatches(type_name, items, only_enabled,
+                                       matching_category, matching_type);
+}
+
+bool DataVisualization::Categories::GetCategory(const ConstString &category,
+                                                lldb::TypeCategoryImplSP &entry,
+                                                bool allow_create) {
+  entry = GetFormatManager().GetCategory(category, allow_create);
+  return (entry.get() != NULL);
+}
+
+bool DataVisualization::Categories::GetCategory(
+    lldb::LanguageType language, lldb::TypeCategoryImplSP &entry) {
+  if (LanguageCategory *lang_category =
+          GetFormatManager().GetCategoryForLanguage(language))
+    entry = lang_category->GetCategory();
+  return (entry.get() != nullptr);
 }
 
-void
-DataVisualization::Categories::Clear ()
-{
-    GetFormatManager().ClearCategories();
+void DataVisualization::Categories::Add(const ConstString &category) {
+  GetFormatManager().GetCategory(category);
 }
 
-void
-DataVisualization::Categories::Clear (const ConstString &category)
-{
-    GetFormatManager().GetCategory(category)->Clear(eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
+bool DataVisualization::Categories::Delete(const ConstString &category) {
+  GetFormatManager().DisableCategory(category);
+  return GetFormatManager().DeleteCategory(category);
 }
 
-void
-DataVisualization::Categories::Enable (const ConstString& category,
-                                       TypeCategoryMap::Position pos)
-{
-    if (GetFormatManager().GetCategory(category)->IsEnabled())
-        GetFormatManager().DisableCategory(category);
-    GetFormatManager().EnableCategory(category, pos, std::initializer_list<lldb::LanguageType>());
+void DataVisualization::Categories::Clear() {
+  GetFormatManager().ClearCategories();
 }
 
-void
-DataVisualization::Categories::Enable (lldb::LanguageType lang_type)
-{
-    if (LanguageCategory* lang_category = GetFormatManager().GetCategoryForLanguage(lang_type))
-        lang_category->Enable();
+void DataVisualization::Categories::Clear(const ConstString &category) {
+  GetFormatManager().GetCategory(category)->Clear(
+      eFormatCategoryItemSummary | eFormatCategoryItemRegexSummary);
 }
 
-void
-DataVisualization::Categories::Disable (const ConstString& category)
-{
-    if (GetFormatManager().GetCategory(category)->IsEnabled() == true)
-        GetFormatManager().DisableCategory(category);
+void DataVisualization::Categories::Enable(const ConstString &category,
+                                           TypeCategoryMap::Position pos) {
+  if (GetFormatManager().GetCategory(category)->IsEnabled())
+    GetFormatManager().DisableCategory(category);
+  GetFormatManager().EnableCategory(
+      category, pos, std::initializer_list<lldb::LanguageType>());
 }
 
-void
-DataVisualization::Categories::Disable (lldb::LanguageType lang_type)
-{
-    if (LanguageCategory* lang_category = GetFormatManager().GetCategoryForLanguage(lang_type))
-        lang_category->Disable();
+void DataVisualization::Categories::Enable(lldb::LanguageType lang_type) {
+  if (LanguageCategory *lang_category =
+          GetFormatManager().GetCategoryForLanguage(lang_type))
+    lang_category->Enable();
 }
 
-void
-DataVisualization::Categories::Enable (const lldb::TypeCategoryImplSP& category,
-                                       TypeCategoryMap::Position pos)
-{
-    if (category.get())
-    {
-        if (category->IsEnabled())
-            GetFormatManager().DisableCategory(category);
-        GetFormatManager().EnableCategory(category, pos);
-    }
+void DataVisualization::Categories::Disable(const ConstString &category) {
+  if (GetFormatManager().GetCategory(category)->IsEnabled() == true)
+    GetFormatManager().DisableCategory(category);
 }
 
-void
-DataVisualization::Categories::Disable (const lldb::TypeCategoryImplSP& category)
-{
-    if (category.get() && category->IsEnabled() == true)
-        GetFormatManager().DisableCategory(category);
+void DataVisualization::Categories::Disable(lldb::LanguageType lang_type) {
+  if (LanguageCategory *lang_category =
+          GetFormatManager().GetCategoryForLanguage(lang_type))
+    lang_category->Disable();
+}
+
+void DataVisualization::Categories::Enable(
+    const lldb::TypeCategoryImplSP &category, TypeCategoryMap::Position pos) {
+  if (category.get()) {
+    if (category->IsEnabled())
+      GetFormatManager().DisableCategory(category);
+    GetFormatManager().EnableCategory(category, pos);
+  }
+}
+
+void DataVisualization::Categories::Disable(
+    const lldb::TypeCategoryImplSP &category) {
+  if (category.get() && category->IsEnabled() == true)
+    GetFormatManager().DisableCategory(category);
 }
 
-void
-DataVisualization::Categories::EnableStar ()
-{
-    GetFormatManager().EnableAllCategories ();
+void DataVisualization::Categories::EnableStar() {
+  GetFormatManager().EnableAllCategories();
 }
 
-void
-DataVisualization::Categories::DisableStar ()
-{
-    GetFormatManager().DisableAllCategories();
+void DataVisualization::Categories::DisableStar() {
+  GetFormatManager().DisableAllCategories();
 }
 
-void
-DataVisualization::Categories::ForEach (TypeCategoryMap::ForEachCallback callback)
-{
-    GetFormatManager().ForEachCategory(callback);
+void DataVisualization::Categories::ForEach(
+    TypeCategoryMap::ForEachCallback callback) {
+  GetFormatManager().ForEachCategory(callback);
 }
 
-uint32_t
-DataVisualization::Categories::GetCount ()
-{
-    return GetFormatManager().GetCategoriesCount();
+uint32_t DataVisualization::Categories::GetCount() {
+  return GetFormatManager().GetCategoriesCount();
 }
 
 lldb::TypeCategoryImplSP
-DataVisualization::Categories::GetCategoryAtIndex (size_t index)
-{
-    return GetFormatManager().GetCategoryAtIndex(index);
+DataVisualization::Categories::GetCategoryAtIndex(size_t index) {
+  return GetFormatManager().GetCategoryAtIndex(index);
 }
 
-bool
-DataVisualization::NamedSummaryFormats::GetSummaryFormat (const ConstString &type, lldb::TypeSummaryImplSP &entry)
-{
-    return GetFormatManager().GetNamedSummaryContainer().Get(type,entry);
+bool DataVisualization::NamedSummaryFormats::GetSummaryFormat(
+    const ConstString &type, lldb::TypeSummaryImplSP &entry) {
+  return GetFormatManager().GetNamedSummaryContainer().Get(type, entry);
 }
 
-void
-DataVisualization::NamedSummaryFormats::Add (const ConstString &type, const lldb::TypeSummaryImplSP &entry)
-{
-    GetFormatManager().GetNamedSummaryContainer().Add(FormatManager::GetValidTypeName(type),entry);
+void DataVisualization::NamedSummaryFormats::Add(
+    const ConstString &type, const lldb::TypeSummaryImplSP &entry) {
+  GetFormatManager().GetNamedSummaryContainer().Add(
+      FormatManager::GetValidTypeName(type), entry);
 }
 
-bool
-DataVisualization::NamedSummaryFormats::Delete (const ConstString &type)
-{
-    return GetFormatManager().GetNamedSummaryContainer().Delete(type);
+bool DataVisualization::NamedSummaryFormats::Delete(const ConstString &type) {
+  return GetFormatManager().GetNamedSummaryContainer().Delete(type);
 }
 
-void
-DataVisualization::NamedSummaryFormats::Clear ()
-{
-    GetFormatManager().GetNamedSummaryContainer().Clear();
+void DataVisualization::NamedSummaryFormats::Clear() {
+  GetFormatManager().GetNamedSummaryContainer().Clear();
 }
 
-void
-DataVisualization::NamedSummaryFormats::ForEach (std::function<bool(ConstString, const lldb::TypeSummaryImplSP&)> callback)
-{
-    GetFormatManager().GetNamedSummaryContainer().ForEach(callback);
+void DataVisualization::NamedSummaryFormats::ForEach(
+    std::function<bool(ConstString, const lldb::TypeSummaryImplSP &)>
+        callback) {
+  GetFormatManager().GetNamedSummaryContainer().ForEach(callback);
 }
 
-uint32_t
-DataVisualization::NamedSummaryFormats::GetCount ()
-{
-    return GetFormatManager().GetNamedSummaryContainer().GetCount();
+uint32_t DataVisualization::NamedSummaryFormats::GetCount() {
+  return GetFormatManager().GetNamedSummaryContainer().GetCount();
 }

Modified: lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp (original)
+++ lldb/trunk/source/DataFormatters/DumpValueObjectOptions.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- DumpValueObjectOptions.cpp -----------------------------------*- C++ -*-===//
+//===-- DumpValueObjectOptions.cpp -----------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -18,234 +19,182 @@
 using namespace lldb;
 using namespace lldb_private;
 
-DumpValueObjectOptions::DumpValueObjectOptions() :
-    m_summary_sp(),
-    m_root_valobj_name(),
-    m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default,0}),
-    m_decl_printing_helper(),
-    m_use_synthetic(true),
-    m_scope_already_checked(false),
-    m_flat_output(false),
-    m_ignore_cap(false),
-    m_show_types(false),
-    m_show_location(false),
-    m_use_objc(false),
-    m_hide_root_type(false),
-    m_hide_name(false),
-    m_hide_value(false),
-    m_run_validator(false),
-    m_use_type_display_name(true),
-    m_allow_oneliner_mode(true),
-    m_hide_pointer_value(false),
-    m_reveal_empty_aggregates(true)
-{}
-
-
-DumpValueObjectOptions::DumpValueObjectOptions (ValueObject& valobj) :
-    DumpValueObjectOptions()
-{
-    m_use_dynamic = valobj.GetDynamicValueType();
-    m_use_synthetic = valobj.IsSynthetic();
-    m_varformat_language = valobj.GetPreferredDisplayLanguage();
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth)
-{
-    m_max_ptr_depth = depth;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetMaximumDepth(uint32_t depth)
-{
-    m_max_depth = depth;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper)
-{
-    m_decl_printing_helper = helper;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetShowTypes(bool show)
-{
-    m_show_types = show;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetShowLocation(bool show)
-{
-    m_show_location = show;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetUseObjectiveC(bool use)
-{
-    m_use_objc = use;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetShowSummary(bool show)
-{
-    if (show == false)
-        SetOmitSummaryDepth(UINT32_MAX);
-    else
-        SetOmitSummaryDepth(0);
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn)
-{
-    m_use_dynamic = dyn;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic)
-{
-    m_use_synthetic = use_synthetic;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetScopeChecked(bool check)
-{
-    m_scope_already_checked = check;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetFlatOutput(bool flat)
-{
-    m_flat_output = flat;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth)
-{
-    m_omit_summary_depth = depth;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetIgnoreCap(bool ignore)
-{
-    m_ignore_cap = ignore;
-    return *this;
-}
-
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetRawDisplay()
-{
-    SetUseSyntheticValue(false);
+DumpValueObjectOptions::DumpValueObjectOptions()
+    : m_summary_sp(), m_root_valobj_name(),
+      m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default, 0}),
+      m_decl_printing_helper(), m_use_synthetic(true),
+      m_scope_already_checked(false), m_flat_output(false), m_ignore_cap(false),
+      m_show_types(false), m_show_location(false), m_use_objc(false),
+      m_hide_root_type(false), m_hide_name(false), m_hide_value(false),
+      m_run_validator(false), m_use_type_display_name(true),
+      m_allow_oneliner_mode(true), m_hide_pointer_value(false),
+      m_reveal_empty_aggregates(true) {}
+
+DumpValueObjectOptions::DumpValueObjectOptions(ValueObject &valobj)
+    : DumpValueObjectOptions() {
+  m_use_dynamic = valobj.GetDynamicValueType();
+  m_use_synthetic = valobj.IsSynthetic();
+  m_varformat_language = valobj.GetPreferredDisplayLanguage();
+}
+
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetMaximumPointerDepth(PointerDepth depth) {
+  m_max_ptr_depth = depth;
+  return *this;
+}
+
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetMaximumDepth(uint32_t depth) {
+  m_max_depth = depth;
+  return *this;
+}
+
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetDeclPrintingHelper(DeclPrintingHelper helper) {
+  m_decl_printing_helper = helper;
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetShowTypes(bool show) {
+  m_show_types = show;
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetShowLocation(bool show) {
+  m_show_location = show;
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetUseObjectiveC(bool use) {
+  m_use_objc = use;
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetShowSummary(bool show) {
+  if (show == false)
     SetOmitSummaryDepth(UINT32_MAX);
-    SetIgnoreCap(true);
-    SetHideName(false);
-    SetHideValue(false);
-    SetUseTypeDisplayName(false);
-    SetAllowOnelinerMode(false);
-    return *this;
+  else
+    SetOmitSummaryDepth(0);
+  return *this;
+}
+
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetUseDynamicType(lldb::DynamicValueType dyn) {
+  m_use_dynamic = dyn;
+  return *this;
+}
+
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetUseSyntheticValue(bool use_synthetic) {
+  m_use_synthetic = use_synthetic;
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetScopeChecked(bool check) {
+  m_scope_already_checked = check;
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetFlatOutput(bool flat) {
+  m_flat_output = flat;
+  return *this;
+}
+
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetOmitSummaryDepth(uint32_t depth) {
+  m_omit_summary_depth = depth;
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetIgnoreCap(bool ignore) {
+  m_ignore_cap = ignore;
+  return *this;
+}
+
+DumpValueObjectOptions &DumpValueObjectOptions::SetRawDisplay() {
+  SetUseSyntheticValue(false);
+  SetOmitSummaryDepth(UINT32_MAX);
+  SetIgnoreCap(true);
+  SetHideName(false);
+  SetHideValue(false);
+  SetUseTypeDisplayName(false);
+  SetAllowOnelinerMode(false);
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetFormat (lldb::Format format)
-{
-    m_format = format;
-    return *this;
+DumpValueObjectOptions &DumpValueObjectOptions::SetFormat(lldb::Format format) {
+  m_format = format;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetSummary (lldb::TypeSummaryImplSP summary)
-{
-    m_summary_sp = summary;
-    return *this;
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetSummary(lldb::TypeSummaryImplSP summary) {
+  m_summary_sp = summary;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetRootValueObjectName (const char* name)
-{
-    if (name)
-        m_root_valobj_name.assign(name);
-    else
-        m_root_valobj_name.clear();
-    return *this;
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetRootValueObjectName(const char *name) {
+  if (name)
+    m_root_valobj_name.assign(name);
+  else
+    m_root_valobj_name.clear();
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetHideRootType (bool hide_root_type)
-{
-    m_hide_root_type = hide_root_type;
-    return *this;
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetHideRootType(bool hide_root_type) {
+  m_hide_root_type = hide_root_type;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetHideName (bool hide_name)
-{
-    m_hide_name = hide_name;
-    return *this;
+DumpValueObjectOptions &DumpValueObjectOptions::SetHideName(bool hide_name) {
+  m_hide_name = hide_name;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetHideValue (bool hide_value)
-{
-    m_hide_value = hide_value;
-    return *this;
+DumpValueObjectOptions &DumpValueObjectOptions::SetHideValue(bool hide_value) {
+  m_hide_value = hide_value;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetHidePointerValue (bool hide)
-{
-    m_hide_pointer_value = hide;
-    return *this;
+DumpValueObjectOptions &DumpValueObjectOptions::SetHidePointerValue(bool hide) {
+  m_hide_pointer_value = hide;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetVariableFormatDisplayLanguage (lldb::LanguageType lang)
-{
-    m_varformat_language = lang;
-    return *this;
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetVariableFormatDisplayLanguage(
+    lldb::LanguageType lang) {
+  m_varformat_language = lang;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetRunValidator (bool run)
-{
-    m_run_validator = run;
-    return *this;
+DumpValueObjectOptions &DumpValueObjectOptions::SetRunValidator(bool run) {
+  m_run_validator = run;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetUseTypeDisplayName (bool dis)
-{
-    m_use_type_display_name = dis;
-    return *this;
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetUseTypeDisplayName(bool dis) {
+  m_use_type_display_name = dis;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetAllowOnelinerMode (bool oneliner)
-{
-    m_allow_oneliner_mode = oneliner;
-    return *this;
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetAllowOnelinerMode(bool oneliner) {
+  m_allow_oneliner_mode = oneliner;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetRevealEmptyAggregates (bool reveal)
-{
-    m_reveal_empty_aggregates = reveal;
-    return *this;
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetRevealEmptyAggregates(bool reveal) {
+  m_reveal_empty_aggregates = reveal;
+  return *this;
 }
 
-DumpValueObjectOptions&
-DumpValueObjectOptions::SetElementCount (uint32_t element_count)
-{
-    m_element_count = element_count;
-    return *this;
+DumpValueObjectOptions &
+DumpValueObjectOptions::SetElementCount(uint32_t element_count) {
+  m_element_count = element_count;
+  return *this;
 }

Modified: lldb/trunk/source/DataFormatters/FormatCache.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatCache.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatCache.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatCache.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- FormatCache.cpp ------------------------------------------*- C++ -*-===//
+//===-- FormatCache.cpp ------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -19,279 +20,205 @@
 using namespace lldb;
 using namespace lldb_private;
 
-FormatCache::Entry::Entry () :
-m_format_cached(false),
-m_summary_cached(false),
-m_synthetic_cached(false),
-m_validator_cached(false),
-m_format_sp(),
-m_summary_sp(),
-m_synthetic_sp(),
-m_validator_sp()
-{}
-
-FormatCache::Entry::Entry (lldb::TypeFormatImplSP format_sp) :
-m_summary_cached(false),
-m_synthetic_cached(false),
-m_validator_cached(false),
-m_summary_sp(),
-m_synthetic_sp(),
-m_validator_sp()
-{
-    SetFormat (format_sp);
-}
+FormatCache::Entry::Entry()
+    : m_format_cached(false), m_summary_cached(false),
+      m_synthetic_cached(false), m_validator_cached(false), m_format_sp(),
+      m_summary_sp(), m_synthetic_sp(), m_validator_sp() {}
 
-FormatCache::Entry::Entry (lldb::TypeSummaryImplSP summary_sp) :
-m_format_cached(false),
-m_synthetic_cached(false),
-m_validator_cached(false),
-m_format_sp(),
-m_synthetic_sp(),
-m_validator_sp()
-{
-    SetSummary (summary_sp);
+FormatCache::Entry::Entry(lldb::TypeFormatImplSP format_sp)
+    : m_summary_cached(false), m_synthetic_cached(false),
+      m_validator_cached(false), m_summary_sp(), m_synthetic_sp(),
+      m_validator_sp() {
+  SetFormat(format_sp);
 }
 
-FormatCache::Entry::Entry (lldb::SyntheticChildrenSP synthetic_sp) :
-m_format_cached(false),
-m_summary_cached(false),
-m_validator_cached(false),
-m_format_sp(),
-m_summary_sp(),
-m_validator_sp()
-{
-    SetSynthetic (synthetic_sp);
+FormatCache::Entry::Entry(lldb::TypeSummaryImplSP summary_sp)
+    : m_format_cached(false), m_synthetic_cached(false),
+      m_validator_cached(false), m_format_sp(), m_synthetic_sp(),
+      m_validator_sp() {
+  SetSummary(summary_sp);
 }
 
-FormatCache::Entry::Entry (lldb::TypeValidatorImplSP validator_sp) :
-m_format_cached(false),
-m_summary_cached(false),
-m_synthetic_cached(false),
-m_format_sp(),
-m_summary_sp(),
-m_synthetic_sp()
-{
-    SetValidator (validator_sp);
+FormatCache::Entry::Entry(lldb::SyntheticChildrenSP synthetic_sp)
+    : m_format_cached(false), m_summary_cached(false),
+      m_validator_cached(false), m_format_sp(), m_summary_sp(),
+      m_validator_sp() {
+  SetSynthetic(synthetic_sp);
 }
 
-FormatCache::Entry::Entry (lldb::TypeFormatImplSP format_sp, lldb::TypeSummaryImplSP summary_sp, lldb::SyntheticChildrenSP synthetic_sp, lldb::TypeValidatorImplSP validator_sp)
-{
-    SetFormat (format_sp);
-    SetSummary (summary_sp);
-    SetSynthetic (synthetic_sp);
-    SetValidator (validator_sp);
+FormatCache::Entry::Entry(lldb::TypeValidatorImplSP validator_sp)
+    : m_format_cached(false), m_summary_cached(false),
+      m_synthetic_cached(false), m_format_sp(), m_summary_sp(),
+      m_synthetic_sp() {
+  SetValidator(validator_sp);
 }
 
-bool
-FormatCache::Entry::IsFormatCached ()
-{
-    return m_format_cached;
+FormatCache::Entry::Entry(lldb::TypeFormatImplSP format_sp,
+                          lldb::TypeSummaryImplSP summary_sp,
+                          lldb::SyntheticChildrenSP synthetic_sp,
+                          lldb::TypeValidatorImplSP validator_sp) {
+  SetFormat(format_sp);
+  SetSummary(summary_sp);
+  SetSynthetic(synthetic_sp);
+  SetValidator(validator_sp);
 }
 
-bool
-FormatCache::Entry::IsSummaryCached ()
-{
-    return m_summary_cached;
-}
+bool FormatCache::Entry::IsFormatCached() { return m_format_cached; }
 
-bool
-FormatCache::Entry::IsSyntheticCached ()
-{
-    return m_synthetic_cached;
-}
+bool FormatCache::Entry::IsSummaryCached() { return m_summary_cached; }
 
-bool
-FormatCache::Entry::IsValidatorCached ()
-{
-    return m_validator_cached;
-}
+bool FormatCache::Entry::IsSyntheticCached() { return m_synthetic_cached; }
 
-lldb::TypeFormatImplSP
-FormatCache::Entry::GetFormat ()
-{
-    return m_format_sp;
-}
+bool FormatCache::Entry::IsValidatorCached() { return m_validator_cached; }
 
-lldb::TypeSummaryImplSP
-FormatCache::Entry::GetSummary ()
-{
-    return m_summary_sp;
+lldb::TypeFormatImplSP FormatCache::Entry::GetFormat() { return m_format_sp; }
+
+lldb::TypeSummaryImplSP FormatCache::Entry::GetSummary() {
+  return m_summary_sp;
 }
 
-lldb::SyntheticChildrenSP
-FormatCache::Entry::GetSynthetic ()
-{
-    return m_synthetic_sp;
+lldb::SyntheticChildrenSP FormatCache::Entry::GetSynthetic() {
+  return m_synthetic_sp;
 }
 
-lldb::TypeValidatorImplSP
-FormatCache::Entry::GetValidator ()
-{
-    return m_validator_sp;
+lldb::TypeValidatorImplSP FormatCache::Entry::GetValidator() {
+  return m_validator_sp;
 }
 
-void
-FormatCache::Entry::SetFormat (lldb::TypeFormatImplSP format_sp)
-{
-    m_format_cached = true;
-    m_format_sp = format_sp;
+void FormatCache::Entry::SetFormat(lldb::TypeFormatImplSP format_sp) {
+  m_format_cached = true;
+  m_format_sp = format_sp;
 }
 
-void
-FormatCache::Entry::SetSummary (lldb::TypeSummaryImplSP summary_sp)
-{
-    m_summary_cached = true;
-    m_summary_sp = summary_sp;
+void FormatCache::Entry::SetSummary(lldb::TypeSummaryImplSP summary_sp) {
+  m_summary_cached = true;
+  m_summary_sp = summary_sp;
 }
 
-void
-FormatCache::Entry::SetSynthetic (lldb::SyntheticChildrenSP synthetic_sp)
-{
-    m_synthetic_cached = true;
-    m_synthetic_sp = synthetic_sp;
+void FormatCache::Entry::SetSynthetic(lldb::SyntheticChildrenSP synthetic_sp) {
+  m_synthetic_cached = true;
+  m_synthetic_sp = synthetic_sp;
 }
 
-void
-FormatCache::Entry::SetValidator (lldb::TypeValidatorImplSP validator_sp)
-{
-    m_validator_cached = true;
-    m_validator_sp = validator_sp;
+void FormatCache::Entry::SetValidator(lldb::TypeValidatorImplSP validator_sp) {
+  m_validator_cached = true;
+  m_validator_sp = validator_sp;
 }
 
 FormatCache::FormatCache()
-    : m_map(),
-      m_mutex()
+    : m_map(), m_mutex()
 #ifdef LLDB_CONFIGURATION_DEBUG
       ,
-      m_cache_hits(0),
-      m_cache_misses(0)
+      m_cache_hits(0), m_cache_misses(0)
 #endif
 {
 }
 
-FormatCache::Entry&
-FormatCache::GetEntry (const ConstString& type)
-{
-    auto i = m_map.find(type),
-    e = m_map.end();
-    if (i != e)
-        return i->second;
-    m_map[type] = FormatCache::Entry();
-    return m_map[type];
+FormatCache::Entry &FormatCache::GetEntry(const ConstString &type) {
+  auto i = m_map.find(type), e = m_map.end();
+  if (i != e)
+    return i->second;
+  m_map[type] = FormatCache::Entry();
+  return m_map[type];
 }
 
-bool
-FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    auto entry = GetEntry(type);
-    if (entry.IsFormatCached())
-    {
+bool FormatCache::GetFormat(const ConstString &type,
+                            lldb::TypeFormatImplSP &format_sp) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  auto entry = GetEntry(type);
+  if (entry.IsFormatCached()) {
 #ifdef LLDB_CONFIGURATION_DEBUG
-        m_cache_hits++;
+    m_cache_hits++;
 #endif
-        format_sp = entry.GetFormat();
-        return true;
-    }
+    format_sp = entry.GetFormat();
+    return true;
+  }
 #ifdef LLDB_CONFIGURATION_DEBUG
-    m_cache_misses++;
+  m_cache_misses++;
 #endif
-    format_sp.reset();
-    return false;
+  format_sp.reset();
+  return false;
 }
 
-bool
-FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    auto entry = GetEntry(type);
-    if (entry.IsSummaryCached())
-    {
+bool FormatCache::GetSummary(const ConstString &type,
+                             lldb::TypeSummaryImplSP &summary_sp) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  auto entry = GetEntry(type);
+  if (entry.IsSummaryCached()) {
 #ifdef LLDB_CONFIGURATION_DEBUG
-        m_cache_hits++;
+    m_cache_hits++;
 #endif
-        summary_sp = entry.GetSummary();
-        return true;
-    }
+    summary_sp = entry.GetSummary();
+    return true;
+  }
 #ifdef LLDB_CONFIGURATION_DEBUG
-    m_cache_misses++;
+  m_cache_misses++;
 #endif
-    summary_sp.reset();
-    return false;
+  summary_sp.reset();
+  return false;
 }
 
-bool
-FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    auto entry = GetEntry(type);
-    if (entry.IsSyntheticCached())
-    {
+bool FormatCache::GetSynthetic(const ConstString &type,
+                               lldb::SyntheticChildrenSP &synthetic_sp) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  auto entry = GetEntry(type);
+  if (entry.IsSyntheticCached()) {
 #ifdef LLDB_CONFIGURATION_DEBUG
-        m_cache_hits++;
+    m_cache_hits++;
 #endif
-        synthetic_sp = entry.GetSynthetic();
-        return true;
-    }
+    synthetic_sp = entry.GetSynthetic();
+    return true;
+  }
 #ifdef LLDB_CONFIGURATION_DEBUG
-    m_cache_misses++;
+  m_cache_misses++;
 #endif
-    synthetic_sp.reset();
-    return false;
+  synthetic_sp.reset();
+  return false;
 }
 
-bool
-FormatCache::GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    auto entry = GetEntry(type);
-    if (entry.IsValidatorCached())
-    {
+bool FormatCache::GetValidator(const ConstString &type,
+                               lldb::TypeValidatorImplSP &validator_sp) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  auto entry = GetEntry(type);
+  if (entry.IsValidatorCached()) {
 #ifdef LLDB_CONFIGURATION_DEBUG
-        m_cache_hits++;
+    m_cache_hits++;
 #endif
-        validator_sp = entry.GetValidator();
-        return true;
-    }
+    validator_sp = entry.GetValidator();
+    return true;
+  }
 #ifdef LLDB_CONFIGURATION_DEBUG
-    m_cache_misses++;
+  m_cache_misses++;
 #endif
-    validator_sp.reset();
-    return false;
+  validator_sp.reset();
+  return false;
 }
 
-void
-FormatCache::SetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    GetEntry(type).SetFormat(format_sp);
+void FormatCache::SetFormat(const ConstString &type,
+                            lldb::TypeFormatImplSP &format_sp) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  GetEntry(type).SetFormat(format_sp);
 }
 
-void
-FormatCache::SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    GetEntry(type).SetSummary(summary_sp);
+void FormatCache::SetSummary(const ConstString &type,
+                             lldb::TypeSummaryImplSP &summary_sp) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  GetEntry(type).SetSummary(summary_sp);
 }
 
-void
-FormatCache::SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    GetEntry(type).SetSynthetic(synthetic_sp);
+void FormatCache::SetSynthetic(const ConstString &type,
+                               lldb::SyntheticChildrenSP &synthetic_sp) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  GetEntry(type).SetSynthetic(synthetic_sp);
 }
 
-void
-FormatCache::SetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    GetEntry(type).SetValidator(validator_sp);
+void FormatCache::SetValidator(const ConstString &type,
+                               lldb::TypeValidatorImplSP &validator_sp) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  GetEntry(type).SetValidator(validator_sp);
 }
 
-void
-FormatCache::Clear ()
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    m_map.clear();
+void FormatCache::Clear() {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  m_map.clear();
 }
-

Modified: lldb/trunk/source/DataFormatters/FormatClasses.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatClasses.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatClasses.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatClasses.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- FormatClasses.cpp ----------------------------------------*- C++ -*-===//
+//===-- FormatClasses.cpp ----------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -22,48 +23,32 @@
 using namespace lldb;
 using namespace lldb_private;
 
-FormattersMatchData::FormattersMatchData (ValueObject& valobj, lldb::DynamicValueType use_dynamic) :
-    m_valobj(valobj),
-    m_dynamic_value_type(use_dynamic),
-    m_formatters_match_vector({},false),
-    m_type_for_cache(),
-    m_candidate_languages()
-{
-    m_type_for_cache = FormatManager::GetTypeForCache(valobj, use_dynamic);
-    m_candidate_languages = FormatManager::GetCandidateLanguages(valobj);
+FormattersMatchData::FormattersMatchData(ValueObject &valobj,
+                                         lldb::DynamicValueType use_dynamic)
+    : m_valobj(valobj), m_dynamic_value_type(use_dynamic),
+      m_formatters_match_vector({}, false), m_type_for_cache(),
+      m_candidate_languages() {
+  m_type_for_cache = FormatManager::GetTypeForCache(valobj, use_dynamic);
+  m_candidate_languages = FormatManager::GetCandidateLanguages(valobj);
 }
 
-FormattersMatchVector
-FormattersMatchData::GetMatchesVector ()
-{
-    if (!m_formatters_match_vector.second)
-    {
-        m_formatters_match_vector.second = true;
-        m_formatters_match_vector.first = FormatManager::GetPossibleMatches(m_valobj, m_dynamic_value_type);
-    }
-    return m_formatters_match_vector.first;
+FormattersMatchVector FormattersMatchData::GetMatchesVector() {
+  if (!m_formatters_match_vector.second) {
+    m_formatters_match_vector.second = true;
+    m_formatters_match_vector.first =
+        FormatManager::GetPossibleMatches(m_valobj, m_dynamic_value_type);
+  }
+  return m_formatters_match_vector.first;
 }
 
-ConstString
-FormattersMatchData::GetTypeForCache ()
-{
-    return m_type_for_cache;
-}
+ConstString FormattersMatchData::GetTypeForCache() { return m_type_for_cache; }
 
-CandidateLanguagesVector
-FormattersMatchData::GetCandidateLanguages ()
-{
-    return m_candidate_languages;
+CandidateLanguagesVector FormattersMatchData::GetCandidateLanguages() {
+  return m_candidate_languages;
 }
 
-ValueObject&
-FormattersMatchData::GetValueObject ()
-{
-    return m_valobj;
-}
+ValueObject &FormattersMatchData::GetValueObject() { return m_valobj; }
 
-lldb::DynamicValueType
-FormattersMatchData::GetDynamicValueType ()
-{
-    return m_dynamic_value_type;
+lldb::DynamicValueType FormattersMatchData::GetDynamicValueType() {
+  return m_dynamic_value_type;
 }

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- FormatManager.cpp -------------------------------------------*- C++ -*-===//
+//===-- FormatManager.cpp -------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -27,1176 +28,1059 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-struct FormatInfo
-{
-    Format format;
-    const char format_char; // One or more format characters that can be used for this format.
-    const char *format_name;    // Long format name that can be used to specify the current format
+struct FormatInfo {
+  Format format;
+  const char format_char;  // One or more format characters that can be used for
+                           // this format.
+  const char *format_name; // Long format name that can be used to specify the
+                           // current format
 };
 
-static FormatInfo 
-g_format_infos[] = 
-{
-    { eFormatDefault        , '\0'  , "default"             },
-    { eFormatBoolean        , 'B'   , "boolean"             },
-    { eFormatBinary         , 'b'   , "binary"              },
-    { eFormatBytes          , 'y'   , "bytes"               },
-    { eFormatBytesWithASCII , 'Y'   , "bytes with ASCII"    },
-    { eFormatChar           , 'c'   , "character"           },
-    { eFormatCharPrintable  , 'C'   , "printable character" },
-    { eFormatComplexFloat   , 'F'   , "complex float"       },
-    { eFormatCString        , 's'   , "c-string"            },
-    { eFormatDecimal        , 'd'   , "decimal"             },
-    { eFormatEnum           , 'E'   , "enumeration"         },
-    { eFormatHex            , 'x'   , "hex"                 },
-    { eFormatHexUppercase   , 'X'   , "uppercase hex"       },
-    { eFormatFloat          , 'f'   , "float"               },
-    { eFormatOctal          , 'o'   , "octal"               },
-    { eFormatOSType         , 'O'   , "OSType"              },
-    { eFormatUnicode16      , 'U'   , "unicode16"           },
-    { eFormatUnicode32      , '\0'  , "unicode32"           },
-    { eFormatUnsigned       , 'u'   , "unsigned decimal"    },
-    { eFormatPointer        , 'p'   , "pointer"             },
-    { eFormatVectorOfChar   , '\0'  , "char[]"              },
-    { eFormatVectorOfSInt8  , '\0'  , "int8_t[]"            },
-    { eFormatVectorOfUInt8  , '\0'  , "uint8_t[]"           },
-    { eFormatVectorOfSInt16 , '\0'  , "int16_t[]"           },
-    { eFormatVectorOfUInt16 , '\0'  , "uint16_t[]"          },
-    { eFormatVectorOfSInt32 , '\0'  , "int32_t[]"           },
-    { eFormatVectorOfUInt32 , '\0'  , "uint32_t[]"          },
-    { eFormatVectorOfSInt64 , '\0'  , "int64_t[]"           },
-    { eFormatVectorOfUInt64 , '\0'  , "uint64_t[]"          },
-    { eFormatVectorOfFloat16, '\0'  , "float16[]"           },
-    { eFormatVectorOfFloat32, '\0'  , "float32[]"           },
-    { eFormatVectorOfFloat64, '\0'  , "float64[]"           },
-    { eFormatVectorOfUInt128, '\0'  , "uint128_t[]"         },
-    { eFormatComplexInteger , 'I'   , "complex integer"     },
-    { eFormatCharArray      , 'a'   , "character array"     },
-    { eFormatAddressInfo    , 'A'   , "address"             },
-    { eFormatHexFloat       , '\0'  , "hex float"           },
-    { eFormatInstruction    , 'i'   , "instruction"         },
-    { eFormatVoid           , 'v'   , "void"                }
-};
+static FormatInfo g_format_infos[] = {
+    {eFormatDefault, '\0', "default"},
+    {eFormatBoolean, 'B', "boolean"},
+    {eFormatBinary, 'b', "binary"},
+    {eFormatBytes, 'y', "bytes"},
+    {eFormatBytesWithASCII, 'Y', "bytes with ASCII"},
+    {eFormatChar, 'c', "character"},
+    {eFormatCharPrintable, 'C', "printable character"},
+    {eFormatComplexFloat, 'F', "complex float"},
+    {eFormatCString, 's', "c-string"},
+    {eFormatDecimal, 'd', "decimal"},
+    {eFormatEnum, 'E', "enumeration"},
+    {eFormatHex, 'x', "hex"},
+    {eFormatHexUppercase, 'X', "uppercase hex"},
+    {eFormatFloat, 'f', "float"},
+    {eFormatOctal, 'o', "octal"},
+    {eFormatOSType, 'O', "OSType"},
+    {eFormatUnicode16, 'U', "unicode16"},
+    {eFormatUnicode32, '\0', "unicode32"},
+    {eFormatUnsigned, 'u', "unsigned decimal"},
+    {eFormatPointer, 'p', "pointer"},
+    {eFormatVectorOfChar, '\0', "char[]"},
+    {eFormatVectorOfSInt8, '\0', "int8_t[]"},
+    {eFormatVectorOfUInt8, '\0', "uint8_t[]"},
+    {eFormatVectorOfSInt16, '\0', "int16_t[]"},
+    {eFormatVectorOfUInt16, '\0', "uint16_t[]"},
+    {eFormatVectorOfSInt32, '\0', "int32_t[]"},
+    {eFormatVectorOfUInt32, '\0', "uint32_t[]"},
+    {eFormatVectorOfSInt64, '\0', "int64_t[]"},
+    {eFormatVectorOfUInt64, '\0', "uint64_t[]"},
+    {eFormatVectorOfFloat16, '\0', "float16[]"},
+    {eFormatVectorOfFloat32, '\0', "float32[]"},
+    {eFormatVectorOfFloat64, '\0', "float64[]"},
+    {eFormatVectorOfUInt128, '\0', "uint128_t[]"},
+    {eFormatComplexInteger, 'I', "complex integer"},
+    {eFormatCharArray, 'a', "character array"},
+    {eFormatAddressInfo, 'A', "address"},
+    {eFormatHexFloat, '\0', "hex float"},
+    {eFormatInstruction, 'i', "instruction"},
+    {eFormatVoid, 'v', "void"}};
 
 static uint32_t g_num_format_infos = llvm::array_lengthof(g_format_infos);
 
-static bool
-GetFormatFromFormatChar (char format_char, Format &format)
-{
-    for (uint32_t i=0; i<g_num_format_infos; ++i)
-    {
-        if (g_format_infos[i].format_char == format_char)
-        {
-            format = g_format_infos[i].format;
-            return true;
-        }
-    }
+static bool GetFormatFromFormatChar(char format_char, Format &format) {
+  for (uint32_t i = 0; i < g_num_format_infos; ++i) {
+    if (g_format_infos[i].format_char == format_char) {
+      format = g_format_infos[i].format;
+      return true;
+    }
+  }
+  format = eFormatInvalid;
+  return false;
+}
+
+static bool GetFormatFromFormatName(const char *format_name,
+                                    bool partial_match_ok, Format &format) {
+  uint32_t i;
+  for (i = 0; i < g_num_format_infos; ++i) {
+    if (strcasecmp(g_format_infos[i].format_name, format_name) == 0) {
+      format = g_format_infos[i].format;
+      return true;
+    }
+  }
+
+  if (partial_match_ok) {
+    for (i = 0; i < g_num_format_infos; ++i) {
+      if (strcasestr(g_format_infos[i].format_name, format_name) ==
+          g_format_infos[i].format_name) {
+        format = g_format_infos[i].format;
+        return true;
+      }
+    }
+  }
+  format = eFormatInvalid;
+  return false;
+}
+
+void FormatManager::Changed() {
+  ++m_last_revision;
+  m_format_cache.Clear();
+  std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
+  for (auto &iter : m_language_categories_map) {
+    if (iter.second)
+      iter.second->GetFormatCache().Clear();
+  }
+}
+
+bool FormatManager::GetFormatFromCString(const char *format_cstr,
+                                         bool partial_match_ok,
+                                         lldb::Format &format) {
+  bool success = false;
+  if (format_cstr && format_cstr[0]) {
+    if (format_cstr[1] == '\0') {
+      success = GetFormatFromFormatChar(format_cstr[0], format);
+      if (success)
+        return true;
+    }
+
+    success = GetFormatFromFormatName(format_cstr, partial_match_ok, format);
+  }
+  if (!success)
     format = eFormatInvalid;
-    return false;
+  return success;
 }
 
-static bool
-GetFormatFromFormatName (const char *format_name, bool partial_match_ok, Format &format)
-{
-    uint32_t i;
-    for (i=0; i<g_num_format_infos; ++i)
-    {
-        if (strcasecmp (g_format_infos[i].format_name, format_name) == 0)
-        {
-            format = g_format_infos[i].format;
-            return true;
-        }
-    }
-    
-    if (partial_match_ok)
-    {
-        for (i=0; i<g_num_format_infos; ++i)
-        {
-            if (strcasestr (g_format_infos[i].format_name, format_name) == g_format_infos[i].format_name)
-            {
-                format = g_format_infos[i].format;
-                return true;
-            }
-        }
-    }
-    format = eFormatInvalid;
-    return false;
-}
-
-void
-FormatManager::Changed ()
-{
-    ++m_last_revision;
-    m_format_cache.Clear ();
-    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
-    for (auto& iter : m_language_categories_map)
-    {
-        if (iter.second)
-            iter.second->GetFormatCache().Clear();
-    }
-}
-
-bool
-FormatManager::GetFormatFromCString (const char *format_cstr,
-                                     bool partial_match_ok,
-                                     lldb::Format &format)
-{
-    bool success = false;
-    if (format_cstr && format_cstr[0])
-    {
-        if (format_cstr[1] == '\0')
-        {
-            success = GetFormatFromFormatChar (format_cstr[0], format);
-            if (success)
-                return true;
-        }
-        
-        success = GetFormatFromFormatName (format_cstr, partial_match_ok, format);
-    }
-    if (!success)
-        format = eFormatInvalid;
-    return success;
-}
-
-char
-FormatManager::GetFormatAsFormatChar (lldb::Format format)
-{
-    for (uint32_t i=0; i<g_num_format_infos; ++i)
-    {
-        if (g_format_infos[i].format == format)
-            return g_format_infos[i].format_char;
-    }
-    return '\0';
-}
-
-const char *
-FormatManager::GetFormatAsCString (Format format)
-{
-    if (format >= eFormatDefault && format < kNumFormats)
-        return g_format_infos[format].format_name;
-    return NULL;
-}
-
-void
-FormatManager::EnableAllCategories ()
-{
-    m_categories_map.EnableAllCategories ();
-    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
-    for (auto& iter : m_language_categories_map)
-    {
-        if (iter.second)
-            iter.second->Enable();
-    }
-}
-
-void
-FormatManager::DisableAllCategories ()
-{
-    m_categories_map.DisableAllCategories ();
-    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
-    for (auto& iter : m_language_categories_map)
-    {
-        if (iter.second)
-            iter.second->Disable();
-    }
-}
-
-void
-FormatManager::GetPossibleMatches (ValueObject& valobj,
-                                   CompilerType compiler_type,
-                                   uint32_t reason,
-                                   lldb::DynamicValueType use_dynamic,
-                                   FormattersMatchVector& entries,
-                                   bool did_strip_ptr,
-                                   bool did_strip_ref,
-                                   bool did_strip_typedef,
-                                   bool root_level)
-{
-    compiler_type = compiler_type.GetTypeForFormatters();
-    ConstString type_name(compiler_type.GetConstTypeName());
-    if (valobj.GetBitfieldBitSize() > 0)
-    {
-        StreamString sstring;
-        sstring.Printf("%s:%d",type_name.AsCString(),valobj.GetBitfieldBitSize());
-        ConstString bitfieldname = ConstString(sstring.GetData());
-        entries.push_back({bitfieldname,0,did_strip_ptr,did_strip_ref,did_strip_typedef});
-        reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;
-    }
-
-    if (!compiler_type.IsMeaninglessWithoutDynamicResolution())
-    {
-        entries.push_back({type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef});
-
-        ConstString display_type_name(compiler_type.GetDisplayTypeName());
-        if (display_type_name != type_name)
-            entries.push_back({display_type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef});
-    }
-
-    for (bool is_rvalue_ref = true, j = true; j && compiler_type.IsReferenceType(nullptr, &is_rvalue_ref); j = false)
-    {
-        CompilerType non_ref_type = compiler_type.GetNonReferenceType();
-        GetPossibleMatches(valobj,
-                           non_ref_type,
-                           reason | lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
-                           use_dynamic,
-                           entries,
-                           did_strip_ptr,
-                           true,
-                           did_strip_typedef);
-        if (non_ref_type.IsTypedefType())
-        {
-            CompilerType deffed_referenced_type = non_ref_type.GetTypedefedType();
-            deffed_referenced_type = is_rvalue_ref ? deffed_referenced_type.GetRValueReferenceType() : deffed_referenced_type.GetLValueReferenceType();
-            GetPossibleMatches(valobj,
-                               deffed_referenced_type,
-                               reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
-                               use_dynamic,
-                               entries,
-                               did_strip_ptr,
-                               did_strip_ref,
-                               true); // this is not exactly the usual meaning of stripping typedefs
-        }
-    }
-    
-    if (compiler_type.IsPointerType())
-    {
-        CompilerType non_ptr_type = compiler_type.GetPointeeType();
-        GetPossibleMatches(valobj,
-                           non_ptr_type,
-                           reason | lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
-                           use_dynamic,
-                           entries,
-                           true,
-                           did_strip_ref,
+char FormatManager::GetFormatAsFormatChar(lldb::Format format) {
+  for (uint32_t i = 0; i < g_num_format_infos; ++i) {
+    if (g_format_infos[i].format == format)
+      return g_format_infos[i].format_char;
+  }
+  return '\0';
+}
+
+const char *FormatManager::GetFormatAsCString(Format format) {
+  if (format >= eFormatDefault && format < kNumFormats)
+    return g_format_infos[format].format_name;
+  return NULL;
+}
+
+void FormatManager::EnableAllCategories() {
+  m_categories_map.EnableAllCategories();
+  std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
+  for (auto &iter : m_language_categories_map) {
+    if (iter.second)
+      iter.second->Enable();
+  }
+}
+
+void FormatManager::DisableAllCategories() {
+  m_categories_map.DisableAllCategories();
+  std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
+  for (auto &iter : m_language_categories_map) {
+    if (iter.second)
+      iter.second->Disable();
+  }
+}
+
+void FormatManager::GetPossibleMatches(
+    ValueObject &valobj, CompilerType compiler_type, uint32_t reason,
+    lldb::DynamicValueType use_dynamic, FormattersMatchVector &entries,
+    bool did_strip_ptr, bool did_strip_ref, bool did_strip_typedef,
+    bool root_level) {
+  compiler_type = compiler_type.GetTypeForFormatters();
+  ConstString type_name(compiler_type.GetConstTypeName());
+  if (valobj.GetBitfieldBitSize() > 0) {
+    StreamString sstring;
+    sstring.Printf("%s:%d", type_name.AsCString(), valobj.GetBitfieldBitSize());
+    ConstString bitfieldname = ConstString(sstring.GetData());
+    entries.push_back(
+        {bitfieldname, 0, did_strip_ptr, did_strip_ref, did_strip_typedef});
+    reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField;
+  }
+
+  if (!compiler_type.IsMeaninglessWithoutDynamicResolution()) {
+    entries.push_back(
+        {type_name, reason, did_strip_ptr, did_strip_ref, did_strip_typedef});
+
+    ConstString display_type_name(compiler_type.GetDisplayTypeName());
+    if (display_type_name != type_name)
+      entries.push_back({display_type_name, reason, did_strip_ptr,
+                         did_strip_ref, did_strip_typedef});
+  }
+
+  for (bool is_rvalue_ref = true, j = true;
+       j && compiler_type.IsReferenceType(nullptr, &is_rvalue_ref); j = false) {
+    CompilerType non_ref_type = compiler_type.GetNonReferenceType();
+    GetPossibleMatches(
+        valobj, non_ref_type,
+        reason |
+            lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
+        use_dynamic, entries, did_strip_ptr, true, did_strip_typedef);
+    if (non_ref_type.IsTypedefType()) {
+      CompilerType deffed_referenced_type = non_ref_type.GetTypedefedType();
+      deffed_referenced_type =
+          is_rvalue_ref ? deffed_referenced_type.GetRValueReferenceType()
+                        : deffed_referenced_type.GetLValueReferenceType();
+      GetPossibleMatches(
+          valobj, deffed_referenced_type,
+          reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
+          use_dynamic, entries, did_strip_ptr, did_strip_ref,
+          true); // this is not exactly the usual meaning of stripping typedefs
+    }
+  }
+
+  if (compiler_type.IsPointerType()) {
+    CompilerType non_ptr_type = compiler_type.GetPointeeType();
+    GetPossibleMatches(
+        valobj, non_ptr_type,
+        reason |
+            lldb_private::eFormatterChoiceCriterionStrippedPointerReference,
+        use_dynamic, entries, true, did_strip_ref, did_strip_typedef);
+    if (non_ptr_type.IsTypedefType()) {
+      CompilerType deffed_pointed_type =
+          non_ptr_type.GetTypedefedType().GetPointerType();
+      GetPossibleMatches(
+          valobj, deffed_pointed_type,
+          reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
+          use_dynamic, entries, did_strip_ptr, did_strip_ref,
+          true); // this is not exactly the usual meaning of stripping typedefs
+    }
+  }
+
+  for (lldb::LanguageType language_type : GetCandidateLanguages(valobj)) {
+    if (Language *language = Language::FindPlugin(language_type)) {
+      for (ConstString candidate :
+           language->GetPossibleFormattersMatches(valobj, use_dynamic)) {
+        entries.push_back(
+            {candidate,
+             reason | lldb_private::eFormatterChoiceCriterionLanguagePlugin,
+             did_strip_ptr, did_strip_ref, did_strip_typedef});
+      }
+    }
+  }
+
+  // try to strip typedef chains
+  if (compiler_type.IsTypedefType()) {
+    CompilerType deffed_type = compiler_type.GetTypedefedType();
+    GetPossibleMatches(
+        valobj, deffed_type,
+        reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
+        use_dynamic, entries, did_strip_ptr, did_strip_ref, true);
+  }
+
+  if (root_level) {
+    do {
+      if (!compiler_type.IsValid())
+        break;
+
+      CompilerType unqual_compiler_ast_type =
+          compiler_type.GetFullyUnqualifiedType();
+      if (!unqual_compiler_ast_type.IsValid())
+        break;
+      if (unqual_compiler_ast_type.GetOpaqueQualType() !=
+          compiler_type.GetOpaqueQualType())
+        GetPossibleMatches(valobj, unqual_compiler_ast_type, reason,
+                           use_dynamic, entries, did_strip_ptr, did_strip_ref,
                            did_strip_typedef);
-        if (non_ptr_type.IsTypedefType())
-        {
-            CompilerType deffed_pointed_type = non_ptr_type.GetTypedefedType().GetPointerType();
-            GetPossibleMatches(valobj,
-                               deffed_pointed_type,
-                               reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
-                               use_dynamic,
-                               entries,
-                               did_strip_ptr,
-                               did_strip_ref,
-                               true); // this is not exactly the usual meaning of stripping typedefs
-        }
-    }
-    
-    for (lldb::LanguageType language_type : GetCandidateLanguages(valobj))
-    {
-        if (Language* language = Language::FindPlugin(language_type))
-        {
-            for (ConstString candidate : language->GetPossibleFormattersMatches(valobj, use_dynamic))
-            {
-                entries.push_back({candidate,
-                                   reason | lldb_private::eFormatterChoiceCriterionLanguagePlugin,
-                                   did_strip_ptr,
-                                   did_strip_ref,
-                                   did_strip_typedef});
-            }
-        }
-    }
-        
-    // try to strip typedef chains
-    if (compiler_type.IsTypedefType())
-    {
-        CompilerType deffed_type = compiler_type.GetTypedefedType();
-        GetPossibleMatches(valobj,
-                           deffed_type,
-                           reason | lldb_private::eFormatterChoiceCriterionNavigatedTypedefs,
-                           use_dynamic,
-                           entries,
-                           did_strip_ptr,
-                           did_strip_ref,
-                           true);
-    }
-    
-    if (root_level)
-    {
-        do {
-            if (!compiler_type.IsValid())
-                break;
-            
-            CompilerType unqual_compiler_ast_type = compiler_type.GetFullyUnqualifiedType();
-            if (!unqual_compiler_ast_type.IsValid())
-                break;
-            if (unqual_compiler_ast_type.GetOpaqueQualType() != compiler_type.GetOpaqueQualType())
-                GetPossibleMatches (valobj,
-                                    unqual_compiler_ast_type,
-                                    reason,
-                                    use_dynamic,
-                                    entries,
-                                    did_strip_ptr,
-                                    did_strip_ref,
-                                    did_strip_typedef);
-        } while(false);
-        
-        
-        // if all else fails, go to static type
-        if (valobj.IsDynamic())
-        {
-            lldb::ValueObjectSP static_value_sp(valobj.GetStaticValue());
-            if (static_value_sp)
-                GetPossibleMatches(*static_value_sp.get(),
-                                   static_value_sp->GetCompilerType(),
-                                   reason | lldb_private::eFormatterChoiceCriterionWentToStaticValue,
-                                   use_dynamic,
-                                   entries,
-                                   did_strip_ptr,
-                                   did_strip_ref,
-                                   did_strip_typedef,
-                                   true);
-        }
+    } while (false);
+
+    // if all else fails, go to static type
+    if (valobj.IsDynamic()) {
+      lldb::ValueObjectSP static_value_sp(valobj.GetStaticValue());
+      if (static_value_sp)
+        GetPossibleMatches(
+            *static_value_sp.get(), static_value_sp->GetCompilerType(),
+            reason | lldb_private::eFormatterChoiceCriterionWentToStaticValue,
+            use_dynamic, entries, did_strip_ptr, did_strip_ref,
+            did_strip_typedef, true);
     }
+  }
 }
 
 lldb::TypeFormatImplSP
-FormatManager::GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    if (!type_sp)
-        return lldb::TypeFormatImplSP();
-    lldb::TypeFormatImplSP format_chosen_sp;
-    uint32_t num_categories = m_categories_map.GetCount();
-    lldb::TypeCategoryImplSP category_sp;
-    uint32_t prio_category = UINT32_MAX;
-    for (uint32_t category_id = 0;
-         category_id < num_categories;
-         category_id++)
-    {
-        category_sp = GetCategoryAtIndex(category_id);
-        if (category_sp->IsEnabled() == false)
-            continue;
-        lldb::TypeFormatImplSP format_current_sp = category_sp->GetFormatForType(type_sp);
-        if (format_current_sp && (format_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
-        {
-            prio_category = category_sp->GetEnabledPosition();
-            format_chosen_sp = format_current_sp;
-        }
+FormatManager::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  if (!type_sp)
+    return lldb::TypeFormatImplSP();
+  lldb::TypeFormatImplSP format_chosen_sp;
+  uint32_t num_categories = m_categories_map.GetCount();
+  lldb::TypeCategoryImplSP category_sp;
+  uint32_t prio_category = UINT32_MAX;
+  for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
+    category_sp = GetCategoryAtIndex(category_id);
+    if (category_sp->IsEnabled() == false)
+      continue;
+    lldb::TypeFormatImplSP format_current_sp =
+        category_sp->GetFormatForType(type_sp);
+    if (format_current_sp &&
+        (format_chosen_sp.get() == NULL ||
+         (prio_category > category_sp->GetEnabledPosition()))) {
+      prio_category = category_sp->GetEnabledPosition();
+      format_chosen_sp = format_current_sp;
     }
-    return format_chosen_sp;
+  }
+  return format_chosen_sp;
 }
 
 lldb::TypeSummaryImplSP
-FormatManager::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    if (!type_sp)
-        return lldb::TypeSummaryImplSP();
-    lldb::TypeSummaryImplSP summary_chosen_sp;
-    uint32_t num_categories = m_categories_map.GetCount();
-    lldb::TypeCategoryImplSP category_sp;
-    uint32_t prio_category = UINT32_MAX;
-    for (uint32_t category_id = 0;
-         category_id < num_categories;
-         category_id++)
-    {
-        category_sp = GetCategoryAtIndex(category_id);
-        if (category_sp->IsEnabled() == false)
-            continue;
-        lldb::TypeSummaryImplSP summary_current_sp = category_sp->GetSummaryForType(type_sp);
-        if (summary_current_sp && (summary_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
-        {
-            prio_category = category_sp->GetEnabledPosition();
-            summary_chosen_sp = summary_current_sp;
-        }
+FormatManager::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  if (!type_sp)
+    return lldb::TypeSummaryImplSP();
+  lldb::TypeSummaryImplSP summary_chosen_sp;
+  uint32_t num_categories = m_categories_map.GetCount();
+  lldb::TypeCategoryImplSP category_sp;
+  uint32_t prio_category = UINT32_MAX;
+  for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
+    category_sp = GetCategoryAtIndex(category_id);
+    if (category_sp->IsEnabled() == false)
+      continue;
+    lldb::TypeSummaryImplSP summary_current_sp =
+        category_sp->GetSummaryForType(type_sp);
+    if (summary_current_sp &&
+        (summary_chosen_sp.get() == NULL ||
+         (prio_category > category_sp->GetEnabledPosition()))) {
+      prio_category = category_sp->GetEnabledPosition();
+      summary_chosen_sp = summary_current_sp;
     }
-    return summary_chosen_sp;
+  }
+  return summary_chosen_sp;
 }
 
 lldb::TypeFilterImplSP
-FormatManager::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    if (!type_sp)
-        return lldb::TypeFilterImplSP();
-    lldb::TypeFilterImplSP filter_chosen_sp;
-    uint32_t num_categories = m_categories_map.GetCount();
-    lldb::TypeCategoryImplSP category_sp;
-    uint32_t prio_category = UINT32_MAX;
-    for (uint32_t category_id = 0;
-         category_id < num_categories;
-         category_id++)
-    {
-        category_sp = GetCategoryAtIndex(category_id);
-        if (category_sp->IsEnabled() == false)
-            continue;
-        lldb::TypeFilterImplSP filter_current_sp((TypeFilterImpl*)category_sp->GetFilterForType(type_sp).get());
-        if (filter_current_sp && (filter_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
-        {
-            prio_category = category_sp->GetEnabledPosition();
-            filter_chosen_sp = filter_current_sp;
-        }
+FormatManager::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  if (!type_sp)
+    return lldb::TypeFilterImplSP();
+  lldb::TypeFilterImplSP filter_chosen_sp;
+  uint32_t num_categories = m_categories_map.GetCount();
+  lldb::TypeCategoryImplSP category_sp;
+  uint32_t prio_category = UINT32_MAX;
+  for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
+    category_sp = GetCategoryAtIndex(category_id);
+    if (category_sp->IsEnabled() == false)
+      continue;
+    lldb::TypeFilterImplSP filter_current_sp(
+        (TypeFilterImpl *)category_sp->GetFilterForType(type_sp).get());
+    if (filter_current_sp &&
+        (filter_chosen_sp.get() == NULL ||
+         (prio_category > category_sp->GetEnabledPosition()))) {
+      prio_category = category_sp->GetEnabledPosition();
+      filter_chosen_sp = filter_current_sp;
     }
-    return filter_chosen_sp;
+  }
+  return filter_chosen_sp;
 }
 
 #ifndef LLDB_DISABLE_PYTHON
 lldb::ScriptedSyntheticChildrenSP
-FormatManager::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    if (!type_sp)
-        return lldb::ScriptedSyntheticChildrenSP();
-    lldb::ScriptedSyntheticChildrenSP synth_chosen_sp;
-    uint32_t num_categories = m_categories_map.GetCount();
-    lldb::TypeCategoryImplSP category_sp;
-    uint32_t prio_category = UINT32_MAX;
-    for (uint32_t category_id = 0;
-         category_id < num_categories;
-         category_id++)
-    {
-        category_sp = GetCategoryAtIndex(category_id);
-        if (category_sp->IsEnabled() == false)
-            continue;
-        lldb::ScriptedSyntheticChildrenSP synth_current_sp((ScriptedSyntheticChildren*)category_sp->GetSyntheticForType(type_sp).get());
-        if (synth_current_sp && (synth_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
-        {
-            prio_category = category_sp->GetEnabledPosition();
-            synth_chosen_sp = synth_current_sp;
-        }
+FormatManager::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  if (!type_sp)
+    return lldb::ScriptedSyntheticChildrenSP();
+  lldb::ScriptedSyntheticChildrenSP synth_chosen_sp;
+  uint32_t num_categories = m_categories_map.GetCount();
+  lldb::TypeCategoryImplSP category_sp;
+  uint32_t prio_category = UINT32_MAX;
+  for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
+    category_sp = GetCategoryAtIndex(category_id);
+    if (category_sp->IsEnabled() == false)
+      continue;
+    lldb::ScriptedSyntheticChildrenSP synth_current_sp(
+        (ScriptedSyntheticChildren *)category_sp->GetSyntheticForType(type_sp)
+            .get());
+    if (synth_current_sp &&
+        (synth_chosen_sp.get() == NULL ||
+         (prio_category > category_sp->GetEnabledPosition()))) {
+      prio_category = category_sp->GetEnabledPosition();
+      synth_chosen_sp = synth_current_sp;
     }
-    return synth_chosen_sp;
+  }
+  return synth_chosen_sp;
 }
 #endif
 
 #ifndef LLDB_DISABLE_PYTHON
-lldb::SyntheticChildrenSP
-FormatManager::GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    if (!type_sp)
-        return lldb::SyntheticChildrenSP();
-    lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
-    lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp);
-    if (filter_sp->GetRevision() > synth_sp->GetRevision())
-        return lldb::SyntheticChildrenSP(filter_sp.get());
-    else
-        return lldb::SyntheticChildrenSP(synth_sp.get());
+lldb::SyntheticChildrenSP FormatManager::GetSyntheticChildrenForType(
+    lldb::TypeNameSpecifierImplSP type_sp) {
+  if (!type_sp)
+    return lldb::SyntheticChildrenSP();
+  lldb::TypeFilterImplSP filter_sp = GetFilterForType(type_sp);
+  lldb::ScriptedSyntheticChildrenSP synth_sp = GetSyntheticForType(type_sp);
+  if (filter_sp->GetRevision() > synth_sp->GetRevision())
+    return lldb::SyntheticChildrenSP(filter_sp.get());
+  else
+    return lldb::SyntheticChildrenSP(synth_sp.get());
 }
 #endif
 
 lldb::TypeValidatorImplSP
-FormatManager::GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    if (!type_sp)
-        return lldb::TypeValidatorImplSP();
-    lldb::TypeValidatorImplSP validator_chosen_sp;
-    uint32_t num_categories = m_categories_map.GetCount();
-    lldb::TypeCategoryImplSP category_sp;
-    uint32_t prio_category = UINT32_MAX;
-    for (uint32_t category_id = 0;
-         category_id < num_categories;
-         category_id++)
-    {
-        category_sp = GetCategoryAtIndex(category_id);
-        if (category_sp->IsEnabled() == false)
-            continue;
-        lldb::TypeValidatorImplSP validator_current_sp(category_sp->GetValidatorForType(type_sp).get());
-        if (validator_current_sp && (validator_chosen_sp.get() == NULL || (prio_category > category_sp->GetEnabledPosition())))
-        {
-            prio_category = category_sp->GetEnabledPosition();
-            validator_chosen_sp = validator_current_sp;
-        }
-    }
-    return validator_chosen_sp;
-}
-
-void
-FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback)
-{
-    m_categories_map.ForEach(callback);
-    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
-    for (const auto& entry : m_language_categories_map)
-    {
-        if (auto category_sp = entry.second->GetCategory())
-        {
-            if (!callback(category_sp))
-                break;
-        }
+FormatManager::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  if (!type_sp)
+    return lldb::TypeValidatorImplSP();
+  lldb::TypeValidatorImplSP validator_chosen_sp;
+  uint32_t num_categories = m_categories_map.GetCount();
+  lldb::TypeCategoryImplSP category_sp;
+  uint32_t prio_category = UINT32_MAX;
+  for (uint32_t category_id = 0; category_id < num_categories; category_id++) {
+    category_sp = GetCategoryAtIndex(category_id);
+    if (category_sp->IsEnabled() == false)
+      continue;
+    lldb::TypeValidatorImplSP validator_current_sp(
+        category_sp->GetValidatorForType(type_sp).get());
+    if (validator_current_sp &&
+        (validator_chosen_sp.get() == NULL ||
+         (prio_category > category_sp->GetEnabledPosition()))) {
+      prio_category = category_sp->GetEnabledPosition();
+      validator_chosen_sp = validator_current_sp;
+    }
+  }
+  return validator_chosen_sp;
+}
+
+void FormatManager::ForEachCategory(TypeCategoryMap::ForEachCallback callback) {
+  m_categories_map.ForEach(callback);
+  std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
+  for (const auto &entry : m_language_categories_map) {
+    if (auto category_sp = entry.second->GetCategory()) {
+      if (!callback(category_sp))
+        break;
     }
+  }
 }
 
 lldb::TypeCategoryImplSP
-FormatManager::GetCategory (const ConstString& category_name,
-                            bool can_create)
-{
-    if (!category_name)
-        return GetCategory(m_default_category_name);
-    lldb::TypeCategoryImplSP category;
-    if (m_categories_map.Get(category_name, category))
-        return category;
-    
-    if (!can_create)
-        return lldb::TypeCategoryImplSP();
-    
-    m_categories_map.Add(category_name,lldb::TypeCategoryImplSP(new TypeCategoryImpl(this, category_name)));
-    return GetCategory(category_name);
-}
-
-lldb::Format
-FormatManager::GetSingleItemFormat(lldb::Format vector_format)
-{
-    switch(vector_format)
-    {
-        case eFormatVectorOfChar:
-            return eFormatCharArray;
-            
-        case eFormatVectorOfSInt8:
-        case eFormatVectorOfSInt16:
-        case eFormatVectorOfSInt32:
-        case eFormatVectorOfSInt64:
-            return eFormatDecimal;
-            
-        case eFormatVectorOfUInt8:
-        case eFormatVectorOfUInt16:
-        case eFormatVectorOfUInt32:
-        case eFormatVectorOfUInt64:
-        case eFormatVectorOfUInt128:
-            return eFormatHex;
-            
-        case eFormatVectorOfFloat16:
-        case eFormatVectorOfFloat32:
-        case eFormatVectorOfFloat64:
-            return eFormatFloat;
-            
-        default:
-            return lldb::eFormatInvalid;
+FormatManager::GetCategory(const ConstString &category_name, bool can_create) {
+  if (!category_name)
+    return GetCategory(m_default_category_name);
+  lldb::TypeCategoryImplSP category;
+  if (m_categories_map.Get(category_name, category))
+    return category;
+
+  if (!can_create)
+    return lldb::TypeCategoryImplSP();
+
+  m_categories_map.Add(
+      category_name,
+      lldb::TypeCategoryImplSP(new TypeCategoryImpl(this, category_name)));
+  return GetCategory(category_name);
+}
+
+lldb::Format FormatManager::GetSingleItemFormat(lldb::Format vector_format) {
+  switch (vector_format) {
+  case eFormatVectorOfChar:
+    return eFormatCharArray;
+
+  case eFormatVectorOfSInt8:
+  case eFormatVectorOfSInt16:
+  case eFormatVectorOfSInt32:
+  case eFormatVectorOfSInt64:
+    return eFormatDecimal;
+
+  case eFormatVectorOfUInt8:
+  case eFormatVectorOfUInt16:
+  case eFormatVectorOfUInt32:
+  case eFormatVectorOfUInt64:
+  case eFormatVectorOfUInt128:
+    return eFormatHex;
+
+  case eFormatVectorOfFloat16:
+  case eFormatVectorOfFloat32:
+  case eFormatVectorOfFloat64:
+    return eFormatFloat;
+
+  default:
+    return lldb::eFormatInvalid;
+  }
+}
+
+bool FormatManager::ShouldPrintAsOneLiner(ValueObject &valobj) {
+  // if settings say no oneline whatsoever
+  if (valobj.GetTargetSP().get() &&
+      valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries() == false)
+    return false; // then don't oneline
+
+  // if this object has a summary, then ask the summary
+  if (valobj.GetSummaryFormat().get() != nullptr)
+    return valobj.GetSummaryFormat()->IsOneLiner();
+
+  // no children, no party
+  if (valobj.GetNumChildren() == 0)
+    return false;
+
+  // ask the type if it has any opinion about this
+  // eLazyBoolCalculate == no opinion; other values should be self explanatory
+  CompilerType compiler_type(valobj.GetCompilerType());
+  if (compiler_type.IsValid()) {
+    switch (compiler_type.ShouldPrintAsOneLiner(&valobj)) {
+    case eLazyBoolNo:
+      return false;
+    case eLazyBoolYes:
+      return true;
+    case eLazyBoolCalculate:
+      break;
+    }
+  }
+
+  size_t total_children_name_len = 0;
+
+  for (size_t idx = 0; idx < valobj.GetNumChildren(); idx++) {
+    bool is_synth_val = false;
+    ValueObjectSP child_sp(valobj.GetChildAtIndex(idx, true));
+    // something is wrong here - bail out
+    if (!child_sp)
+      return false;
+
+    // also ask the child's type if it has any opinion
+    CompilerType child_compiler_type(child_sp->GetCompilerType());
+    if (child_compiler_type.IsValid()) {
+      switch (child_compiler_type.ShouldPrintAsOneLiner(child_sp.get())) {
+      case eLazyBoolYes:
+      // an opinion of yes is only binding for the child, so keep going
+      case eLazyBoolCalculate:
+        break;
+      case eLazyBoolNo:
+        // but if the child says no, then it's a veto on the whole thing
+        return false;
+      }
     }
-}
 
-bool
-FormatManager::ShouldPrintAsOneLiner (ValueObject& valobj)
-{
-    // if settings say no oneline whatsoever
-    if (valobj.GetTargetSP().get() && valobj.GetTargetSP()->GetDebugger().GetAutoOneLineSummaries() == false)
-        return false; // then don't oneline
-    
-    // if this object has a summary, then ask the summary
-    if (valobj.GetSummaryFormat().get() != nullptr)
-        return valobj.GetSummaryFormat()->IsOneLiner();
-    
-    // no children, no party
-    if (valobj.GetNumChildren() == 0)
+    // if we decided to define synthetic children for a type, we probably care
+    // enough
+    // to show them, but avoid nesting children in children
+    if (child_sp->GetSyntheticChildren().get() != nullptr) {
+      ValueObjectSP synth_sp(child_sp->GetSyntheticValue());
+      // wait.. wat? just get out of here..
+      if (!synth_sp)
+        return false;
+      // but if we only have them to provide a value, keep going
+      if (synth_sp->MightHaveChildren() == false &&
+          synth_sp->DoesProvideSyntheticValue())
+        is_synth_val = true;
+      else
         return false;
-    
-    // ask the type if it has any opinion about this
-    // eLazyBoolCalculate == no opinion; other values should be self explanatory
-    CompilerType compiler_type(valobj.GetCompilerType());
-    if (compiler_type.IsValid())
-    {
-        switch (compiler_type.ShouldPrintAsOneLiner(&valobj))
-        {
-            case eLazyBoolNo:
-                return false;
-            case eLazyBoolYes:
-                return true;
-            case eLazyBoolCalculate:
-                break;
-        }
-    }
-    
-    size_t total_children_name_len = 0;
-    
-    for (size_t idx = 0;
-         idx < valobj.GetNumChildren();
-         idx++)
-    {
-        bool is_synth_val = false;
-        ValueObjectSP child_sp(valobj.GetChildAtIndex(idx, true));
-        // something is wrong here - bail out
-        if (!child_sp)
-            return false;
-        
-        // also ask the child's type if it has any opinion
-        CompilerType child_compiler_type(child_sp->GetCompilerType());
-        if (child_compiler_type.IsValid())
-        {
-            switch (child_compiler_type.ShouldPrintAsOneLiner(child_sp.get()))
-            {
-                case eLazyBoolYes:
-                    // an opinion of yes is only binding for the child, so keep going
-                case eLazyBoolCalculate:
-                    break;
-                case eLazyBoolNo:
-                    // but if the child says no, then it's a veto on the whole thing
-                    return false;
-            }
-        }
-        
-        // if we decided to define synthetic children for a type, we probably care enough
-        // to show them, but avoid nesting children in children
-        if (child_sp->GetSyntheticChildren().get() != nullptr)
-        {
-            ValueObjectSP synth_sp(child_sp->GetSyntheticValue());
-            // wait.. wat? just get out of here..
-            if (!synth_sp)
-                return false;
-            // but if we only have them to provide a value, keep going
-            if (synth_sp->MightHaveChildren() == false && synth_sp->DoesProvideSyntheticValue())
-                is_synth_val = true;
-            else
-                return false;
-        }
-        
-        total_children_name_len += child_sp->GetName().GetLength();
-        
-        // 50 itself is a "randomly" chosen number - the idea is that
-        // overly long structs should not get this treatment
-        // FIXME: maybe make this a user-tweakable setting?
-        if (total_children_name_len > 50)
-            return false;
-        
-        // if a summary is there..
-        if (child_sp->GetSummaryFormat())
-        {
-            // and it wants children, then bail out
-            if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
-                return false;
-        }
-        
-        // if this child has children..
-        if (child_sp->GetNumChildren())
-        {
-            // ...and no summary...
-            // (if it had a summary and the summary wanted children, we would have bailed out anyway
-            //  so this only makes us bail out if this has no summary and we would then print children)
-            if (!child_sp->GetSummaryFormat() && !is_synth_val) // but again only do that if not a synthetic valued child
-                return false; // then bail out
-        }
-    }
-    return true;
-}
-
-ConstString
-FormatManager::GetValidTypeName (const ConstString& type)
-{
-    return ::GetValidTypeName_Impl(type);
-}
-
-ConstString
-FormatManager::GetTypeForCache (ValueObject& valobj,
-                                lldb::DynamicValueType use_dynamic)
-{
-    ValueObjectSP valobj_sp = valobj.GetQualifiedRepresentationIfAvailable(use_dynamic, valobj.IsSynthetic());
-    if (valobj_sp && valobj_sp->GetCompilerType().IsValid())
-    {
-        if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution())
-            return valobj_sp->GetQualifiedTypeName();
     }
-    return ConstString();
-}
 
-std::vector<lldb::LanguageType>
-FormatManager::GetCandidateLanguages (ValueObject& valobj)
-{
-    lldb::LanguageType lang_type = valobj.GetObjectRuntimeLanguage();
-    return GetCandidateLanguages(lang_type);
+    total_children_name_len += child_sp->GetName().GetLength();
+
+    // 50 itself is a "randomly" chosen number - the idea is that
+    // overly long structs should not get this treatment
+    // FIXME: maybe make this a user-tweakable setting?
+    if (total_children_name_len > 50)
+      return false;
+
+    // if a summary is there..
+    if (child_sp->GetSummaryFormat()) {
+      // and it wants children, then bail out
+      if (child_sp->GetSummaryFormat()->DoesPrintChildren(child_sp.get()))
+        return false;
+    }
+
+    // if this child has children..
+    if (child_sp->GetNumChildren()) {
+      // ...and no summary...
+      // (if it had a summary and the summary wanted children, we would have
+      // bailed out anyway
+      //  so this only makes us bail out if this has no summary and we would
+      //  then print children)
+      if (!child_sp->GetSummaryFormat() && !is_synth_val) // but again only do
+                                                          // that if not a
+                                                          // synthetic valued
+                                                          // child
+        return false;                                     // then bail out
+    }
+  }
+  return true;
+}
+
+ConstString FormatManager::GetValidTypeName(const ConstString &type) {
+  return ::GetValidTypeName_Impl(type);
+}
+
+ConstString FormatManager::GetTypeForCache(ValueObject &valobj,
+                                           lldb::DynamicValueType use_dynamic) {
+  ValueObjectSP valobj_sp = valobj.GetQualifiedRepresentationIfAvailable(
+      use_dynamic, valobj.IsSynthetic());
+  if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) {
+    if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution())
+      return valobj_sp->GetQualifiedTypeName();
+  }
+  return ConstString();
 }
 
 std::vector<lldb::LanguageType>
-FormatManager::GetCandidateLanguages (lldb::LanguageType lang_type)
-{
-    switch (lang_type)
-    {
-        case lldb::eLanguageTypeC:
-        case lldb::eLanguageTypeC89:
-        case lldb::eLanguageTypeC99:
-        case lldb::eLanguageTypeC11:
-        case lldb::eLanguageTypeC_plus_plus:
-        case lldb::eLanguageTypeC_plus_plus_03:
-        case lldb::eLanguageTypeC_plus_plus_11:
-        case lldb::eLanguageTypeC_plus_plus_14:
-            return {lldb::eLanguageTypeC_plus_plus, lldb::eLanguageTypeObjC};
-        default:
-            return {lang_type};
-    }
+FormatManager::GetCandidateLanguages(ValueObject &valobj) {
+  lldb::LanguageType lang_type = valobj.GetObjectRuntimeLanguage();
+  return GetCandidateLanguages(lang_type);
 }
 
-LanguageCategory*
-FormatManager::GetCategoryForLanguage (lldb::LanguageType lang_type)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
-    auto iter = m_language_categories_map.find(lang_type), end = m_language_categories_map.end();
-    if (iter != end)
-        return iter->second.get();
-    LanguageCategory* lang_category = new LanguageCategory(lang_type);
-    m_language_categories_map[lang_type] = LanguageCategory::UniquePointer(lang_category);
-    return lang_category;
+std::vector<lldb::LanguageType>
+FormatManager::GetCandidateLanguages(lldb::LanguageType lang_type) {
+  switch (lang_type) {
+  case lldb::eLanguageTypeC:
+  case lldb::eLanguageTypeC89:
+  case lldb::eLanguageTypeC99:
+  case lldb::eLanguageTypeC11:
+  case lldb::eLanguageTypeC_plus_plus:
+  case lldb::eLanguageTypeC_plus_plus_03:
+  case lldb::eLanguageTypeC_plus_plus_11:
+  case lldb::eLanguageTypeC_plus_plus_14:
+    return {lldb::eLanguageTypeC_plus_plus, lldb::eLanguageTypeObjC};
+  default:
+    return {lang_type};
+  }
+}
+
+LanguageCategory *
+FormatManager::GetCategoryForLanguage(lldb::LanguageType lang_type) {
+  std::lock_guard<std::recursive_mutex> guard(m_language_categories_mutex);
+  auto iter = m_language_categories_map.find(lang_type),
+       end = m_language_categories_map.end();
+  if (iter != end)
+    return iter->second.get();
+  LanguageCategory *lang_category = new LanguageCategory(lang_type);
+  m_language_categories_map[lang_type] =
+      LanguageCategory::UniquePointer(lang_category);
+  return lang_category;
 }
 
 lldb::TypeFormatImplSP
-FormatManager::GetHardcodedFormat (FormattersMatchData& match_data)
-{
-    TypeFormatImplSP retval_sp;
-    
-    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages())
-    {
-        if (LanguageCategory* lang_category = GetCategoryForLanguage(lang_type))
-        {
-            if (lang_category->GetHardcoded(*this, match_data, retval_sp))
-                break;
-        }
+FormatManager::GetHardcodedFormat(FormattersMatchData &match_data) {
+  TypeFormatImplSP retval_sp;
+
+  for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+    if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+      if (lang_category->GetHardcoded(*this, match_data, retval_sp))
+        break;
     }
+  }
 
-    return retval_sp;
+  return retval_sp;
 }
 
 lldb::TypeFormatImplSP
-FormatManager::GetFormat (ValueObject& valobj,
-                          lldb::DynamicValueType use_dynamic)
-{
-    FormattersMatchData match_data(valobj, use_dynamic);
-    
-    TypeFormatImplSP retval;
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    if (match_data.GetTypeForCache())
-    {
-        if (log)
-            log->Printf("\n\n[FormatManager::GetFormat] Looking into cache for type %s", match_data.GetTypeForCache().AsCString("<invalid>"));
-        if (m_format_cache.GetFormat(match_data.GetTypeForCache(),retval))
-        {
-            if (log)
-            {
-                log->Printf("[FormatManager::GetFormat] Cache search success. Returning.");
-                if (log->GetDebug())
-                    log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-            }
-            return retval;
-        }
-        if (log)
-            log->Printf("[FormatManager::GetFormat] Cache search failed. Going normal route");
-    }
-    
-    retval = m_categories_map.GetFormat(match_data);
-    if (!retval)
-    {
-        if (log)
-            log->Printf("[FormatManager::GetFormat] Search failed. Giving language a chance.");
-        for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages())
-        {
-            if (LanguageCategory* lang_category = GetCategoryForLanguage(lang_type))
-            {
-                if (lang_category->Get(match_data, retval))
-                    break;
-            }
-        }
-        if (retval)
-        {
-            if (log)
-                log->Printf("[FormatManager::GetFormat] Language search success. Returning.");
-            return retval;
-        }
-    }
-    if (!retval)
-    {
-        if (log)
-            log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded a chance.");
-        retval = GetHardcodedFormat(match_data);
-    }
-    
-    if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable()))
-    {
-        if (log)
-            log->Printf("[FormatManager::GetFormat] Caching %p for type %s",
-                        static_cast<void*>(retval.get()),
-                        match_data.GetTypeForCache().AsCString("<invalid>"));
-        m_format_cache.SetFormat(match_data.GetTypeForCache(),retval);
-    }
-    if (log && log->GetDebug())
-        log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-    return retval;
+FormatManager::GetFormat(ValueObject &valobj,
+                         lldb::DynamicValueType use_dynamic) {
+  FormattersMatchData match_data(valobj, use_dynamic);
+
+  TypeFormatImplSP retval;
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+  if (match_data.GetTypeForCache()) {
+    if (log)
+      log->Printf(
+          "\n\n[FormatManager::GetFormat] Looking into cache for type %s",
+          match_data.GetTypeForCache().AsCString("<invalid>"));
+    if (m_format_cache.GetFormat(match_data.GetTypeForCache(), retval)) {
+      if (log) {
+        log->Printf(
+            "[FormatManager::GetFormat] Cache search success. Returning.");
+        if (log->GetDebug())
+          log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64
+                      " - Cache Misses: %" PRIu64,
+                      m_format_cache.GetCacheHits(),
+                      m_format_cache.GetCacheMisses());
+      }
+      return retval;
+    }
+    if (log)
+      log->Printf(
+          "[FormatManager::GetFormat] Cache search failed. Going normal route");
+  }
+
+  retval = m_categories_map.GetFormat(match_data);
+  if (!retval) {
+    if (log)
+      log->Printf("[FormatManager::GetFormat] Search failed. Giving language a "
+                  "chance.");
+    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+      if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+        if (lang_category->Get(match_data, retval))
+          break;
+      }
+    }
+    if (retval) {
+      if (log)
+        log->Printf(
+            "[FormatManager::GetFormat] Language search success. Returning.");
+      return retval;
+    }
+  }
+  if (!retval) {
+    if (log)
+      log->Printf("[FormatManager::GetFormat] Search failed. Giving hardcoded "
+                  "a chance.");
+    retval = GetHardcodedFormat(match_data);
+  }
+
+  if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
+    if (log)
+      log->Printf("[FormatManager::GetFormat] Caching %p for type %s",
+                  static_cast<void *>(retval.get()),
+                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    m_format_cache.SetFormat(match_data.GetTypeForCache(), retval);
+  }
+  if (log && log->GetDebug())
+    log->Printf("[FormatManager::GetFormat] Cache hits: %" PRIu64
+                " - Cache Misses: %" PRIu64,
+                m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+  return retval;
 }
 
 lldb::TypeSummaryImplSP
-FormatManager::GetHardcodedSummaryFormat (FormattersMatchData& match_data)
-{
-    TypeSummaryImplSP retval_sp;
-    
-    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages())
-    {
-        if (LanguageCategory* lang_category = GetCategoryForLanguage(lang_type))
-        {
-            if (lang_category->GetHardcoded(*this, match_data, retval_sp))
-                break;
-        }
+FormatManager::GetHardcodedSummaryFormat(FormattersMatchData &match_data) {
+  TypeSummaryImplSP retval_sp;
+
+  for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+    if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+      if (lang_category->GetHardcoded(*this, match_data, retval_sp))
+        break;
     }
-    
-    return retval_sp;
+  }
+
+  return retval_sp;
 }
 
 lldb::TypeSummaryImplSP
-FormatManager::GetSummaryFormat (ValueObject& valobj,
-                                 lldb::DynamicValueType use_dynamic)
-{
-    FormattersMatchData match_data(valobj, use_dynamic);
-    
-    TypeSummaryImplSP retval;
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    if (match_data.GetTypeForCache())
-    {
-        if (log)
-            log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache for type %s", match_data.GetTypeForCache().AsCString("<invalid>"));
-        if (m_format_cache.GetSummary(match_data.GetTypeForCache(),retval))
-        {
-            if (log)
-            {
-                log->Printf("[FormatManager::GetSummaryFormat] Cache search success. Returning.");
-                if (log->GetDebug())
-                    log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-            }
-            return retval;
-        }
-        if (log)
-            log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. Going normal route");
-    }
-    
-    retval = m_categories_map.GetSummaryFormat(match_data);
-    if (!retval)
-    {
-        if (log)
-            log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving language a chance.");
-        for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages())
-        {
-            if (LanguageCategory* lang_category = GetCategoryForLanguage(lang_type))
-            {
-                if (lang_category->Get(match_data, retval))
-                    break;
-            }
-        }
-        if (retval)
-        {
-            if (log)
-                log->Printf("[FormatManager::GetSummaryFormat] Language search success. Returning.");
-            return retval;
-        }
-    }
-    if (!retval)
-    {
-        if (log)
-            log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving hardcoded a chance.");
-        retval = GetHardcodedSummaryFormat(match_data);
-    }
-    
-    if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable()))
-    {
-        if (log)
-            log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",
-                        static_cast<void*>(retval.get()),
-                        match_data.GetTypeForCache().AsCString("<invalid>"));
-        m_format_cache.SetSummary(match_data.GetTypeForCache(),retval);
-    }
-    if (log && log->GetDebug())
-        log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-    return retval;
+FormatManager::GetSummaryFormat(ValueObject &valobj,
+                                lldb::DynamicValueType use_dynamic) {
+  FormattersMatchData match_data(valobj, use_dynamic);
+
+  TypeSummaryImplSP retval;
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+  if (match_data.GetTypeForCache()) {
+    if (log)
+      log->Printf("\n\n[FormatManager::GetSummaryFormat] Looking into cache "
+                  "for type %s",
+                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    if (m_format_cache.GetSummary(match_data.GetTypeForCache(), retval)) {
+      if (log) {
+        log->Printf("[FormatManager::GetSummaryFormat] Cache search success. "
+                    "Returning.");
+        if (log->GetDebug())
+          log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64
+                      " - Cache Misses: %" PRIu64,
+                      m_format_cache.GetCacheHits(),
+                      m_format_cache.GetCacheMisses());
+      }
+      return retval;
+    }
+    if (log)
+      log->Printf("[FormatManager::GetSummaryFormat] Cache search failed. "
+                  "Going normal route");
+  }
+
+  retval = m_categories_map.GetSummaryFormat(match_data);
+  if (!retval) {
+    if (log)
+      log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving "
+                  "language a chance.");
+    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+      if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+        if (lang_category->Get(match_data, retval))
+          break;
+      }
+    }
+    if (retval) {
+      if (log)
+        log->Printf("[FormatManager::GetSummaryFormat] Language search "
+                    "success. Returning.");
+      return retval;
+    }
+  }
+  if (!retval) {
+    if (log)
+      log->Printf("[FormatManager::GetSummaryFormat] Search failed. Giving "
+                  "hardcoded a chance.");
+    retval = GetHardcodedSummaryFormat(match_data);
+  }
+
+  if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
+    if (log)
+      log->Printf("[FormatManager::GetSummaryFormat] Caching %p for type %s",
+                  static_cast<void *>(retval.get()),
+                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    m_format_cache.SetSummary(match_data.GetTypeForCache(), retval);
+  }
+  if (log && log->GetDebug())
+    log->Printf("[FormatManager::GetSummaryFormat] Cache hits: %" PRIu64
+                " - Cache Misses: %" PRIu64,
+                m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+  return retval;
 }
 
 #ifndef LLDB_DISABLE_PYTHON
 lldb::SyntheticChildrenSP
-FormatManager::GetHardcodedSyntheticChildren (FormattersMatchData& match_data)
-{
-    SyntheticChildrenSP retval_sp;
-    
-    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages())
-    {
-        if (LanguageCategory* lang_category = GetCategoryForLanguage(lang_type))
-        {
-            if (lang_category->GetHardcoded(*this, match_data, retval_sp))
-                break;
-        }
+FormatManager::GetHardcodedSyntheticChildren(FormattersMatchData &match_data) {
+  SyntheticChildrenSP retval_sp;
+
+  for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+    if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+      if (lang_category->GetHardcoded(*this, match_data, retval_sp))
+        break;
     }
-    
-    return retval_sp;
+  }
+
+  return retval_sp;
 }
 
 lldb::SyntheticChildrenSP
-FormatManager::GetSyntheticChildren (ValueObject& valobj,
-                                     lldb::DynamicValueType use_dynamic)
-{
-    FormattersMatchData match_data(valobj, use_dynamic);
-    
-    SyntheticChildrenSP retval;
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    if (match_data.GetTypeForCache())
-    {
-        if (log)
-            log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into cache for type %s", match_data.GetTypeForCache().AsCString("<invalid>"));
-        if (m_format_cache.GetSynthetic(match_data.GetTypeForCache(),retval))
-        {
-            if (log)
-            {
-                log->Printf("[FormatManager::GetSyntheticChildren] Cache search success. Returning.");
-                if (log->GetDebug())
-                    log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-            }
-            return retval;
-        }
-        if (log)
-            log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. Going normal route");
-    }
-    
-    retval = m_categories_map.GetSyntheticChildren(match_data);
-    if (!retval)
-    {
-        if (log)
-            log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving language a chance.");
-        for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages())
-        {
-            if (LanguageCategory* lang_category = GetCategoryForLanguage(lang_type))
-            {
-                if (lang_category->Get(match_data, retval))
-                    break;
-            }
-        }
-        if (retval)
-        {
-            if (log)
-                log->Printf("[FormatManager::GetSyntheticChildren] Language search success. Returning.");
-            return retval;
-        }
-    }
-    if (!retval)
-    {
-        if (log)
-            log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving hardcoded a chance.");
-        retval = GetHardcodedSyntheticChildren(match_data);
-    }
-    
-    if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable()))
-    {
-        if (log)
-            log->Printf("[FormatManager::GetSyntheticChildren] Caching %p for type %s",
-                        static_cast<void*>(retval.get()),
-                        match_data.GetTypeForCache().AsCString("<invalid>"));
-        m_format_cache.SetSynthetic(match_data.GetTypeForCache(),retval);
-    }
-    if (log && log->GetDebug())
-        log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-    return retval;
+FormatManager::GetSyntheticChildren(ValueObject &valobj,
+                                    lldb::DynamicValueType use_dynamic) {
+  FormattersMatchData match_data(valobj, use_dynamic);
+
+  SyntheticChildrenSP retval;
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+  if (match_data.GetTypeForCache()) {
+    if (log)
+      log->Printf("\n\n[FormatManager::GetSyntheticChildren] Looking into "
+                  "cache for type %s",
+                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    if (m_format_cache.GetSynthetic(match_data.GetTypeForCache(), retval)) {
+      if (log) {
+        log->Printf("[FormatManager::GetSyntheticChildren] Cache search "
+                    "success. Returning.");
+        if (log->GetDebug())
+          log->Printf(
+              "[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64
+              " - Cache Misses: %" PRIu64,
+              m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+      }
+      return retval;
+    }
+    if (log)
+      log->Printf("[FormatManager::GetSyntheticChildren] Cache search failed. "
+                  "Going normal route");
+  }
+
+  retval = m_categories_map.GetSyntheticChildren(match_data);
+  if (!retval) {
+    if (log)
+      log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving "
+                  "language a chance.");
+    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+      if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+        if (lang_category->Get(match_data, retval))
+          break;
+      }
+    }
+    if (retval) {
+      if (log)
+        log->Printf("[FormatManager::GetSyntheticChildren] Language search "
+                    "success. Returning.");
+      return retval;
+    }
+  }
+  if (!retval) {
+    if (log)
+      log->Printf("[FormatManager::GetSyntheticChildren] Search failed. Giving "
+                  "hardcoded a chance.");
+    retval = GetHardcodedSyntheticChildren(match_data);
+  }
+
+  if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
+    if (log)
+      log->Printf(
+          "[FormatManager::GetSyntheticChildren] Caching %p for type %s",
+          static_cast<void *>(retval.get()),
+          match_data.GetTypeForCache().AsCString("<invalid>"));
+    m_format_cache.SetSynthetic(match_data.GetTypeForCache(), retval);
+  }
+  if (log && log->GetDebug())
+    log->Printf("[FormatManager::GetSyntheticChildren] Cache hits: %" PRIu64
+                " - Cache Misses: %" PRIu64,
+                m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+  return retval;
 }
 #endif
 
 lldb::TypeValidatorImplSP
-FormatManager::GetValidator (ValueObject& valobj,
-                             lldb::DynamicValueType use_dynamic)
-{
-    FormattersMatchData match_data(valobj, use_dynamic);
-    
-    TypeValidatorImplSP retval;
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    if (match_data.GetTypeForCache())
-    {
-        if (log)
-            log->Printf("\n\n[FormatManager::GetValidator] Looking into cache for type %s", match_data.GetTypeForCache().AsCString("<invalid>"));
-        if (m_format_cache.GetValidator(match_data.GetTypeForCache(),retval))
-        {
-            if (log)
-            {
-                log->Printf("[FormatManager::GetValidator] Cache search success. Returning.");
-                if (log->GetDebug())
-                    log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-            }
-            return retval;
-        }
-        if (log)
-            log->Printf("[FormatManager::GetValidator] Cache search failed. Going normal route");
-    }
-    
-    retval = m_categories_map.GetValidator(match_data);
-    if (!retval)
-    {
-        if (log)
-            log->Printf("[FormatManager::GetValidator] Search failed. Giving language a chance.");
-        for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages())
-        {
-            if (LanguageCategory* lang_category = GetCategoryForLanguage(lang_type))
-            {
-                if (lang_category->Get(match_data, retval))
-                    break;
-            }
-        }
-        if (retval)
-        {
-            if (log)
-                log->Printf("[FormatManager::GetValidator] Language search success. Returning.");
-            return retval;
-        }
-    }
-    if (!retval)
-    {
-        if (log)
-            log->Printf("[FormatManager::GetValidator] Search failed. Giving hardcoded a chance.");
-        retval = GetHardcodedValidator(match_data);
-    }
-    
-    if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable()))
-    {
-        if (log)
-            log->Printf("[FormatManager::GetValidator] Caching %p for type %s",
-                        static_cast<void*>(retval.get()),
-                        match_data.GetTypeForCache().AsCString("<invalid>"));
-        m_format_cache.SetValidator(match_data.GetTypeForCache(),retval);
-    }
-    if (log && log->GetDebug())
-        log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64 " - Cache Misses: %" PRIu64, m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
-    return retval;
+FormatManager::GetValidator(ValueObject &valobj,
+                            lldb::DynamicValueType use_dynamic) {
+  FormattersMatchData match_data(valobj, use_dynamic);
+
+  TypeValidatorImplSP retval;
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+  if (match_data.GetTypeForCache()) {
+    if (log)
+      log->Printf(
+          "\n\n[FormatManager::GetValidator] Looking into cache for type %s",
+          match_data.GetTypeForCache().AsCString("<invalid>"));
+    if (m_format_cache.GetValidator(match_data.GetTypeForCache(), retval)) {
+      if (log) {
+        log->Printf(
+            "[FormatManager::GetValidator] Cache search success. Returning.");
+        if (log->GetDebug())
+          log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64
+                      " - Cache Misses: %" PRIu64,
+                      m_format_cache.GetCacheHits(),
+                      m_format_cache.GetCacheMisses());
+      }
+      return retval;
+    }
+    if (log)
+      log->Printf("[FormatManager::GetValidator] Cache search failed. Going "
+                  "normal route");
+  }
+
+  retval = m_categories_map.GetValidator(match_data);
+  if (!retval) {
+    if (log)
+      log->Printf("[FormatManager::GetValidator] Search failed. Giving "
+                  "language a chance.");
+    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+      if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+        if (lang_category->Get(match_data, retval))
+          break;
+      }
+    }
+    if (retval) {
+      if (log)
+        log->Printf("[FormatManager::GetValidator] Language search success. "
+                    "Returning.");
+      return retval;
+    }
+  }
+  if (!retval) {
+    if (log)
+      log->Printf("[FormatManager::GetValidator] Search failed. Giving "
+                  "hardcoded a chance.");
+    retval = GetHardcodedValidator(match_data);
+  }
+
+  if (match_data.GetTypeForCache() && (!retval || !retval->NonCacheable())) {
+    if (log)
+      log->Printf("[FormatManager::GetValidator] Caching %p for type %s",
+                  static_cast<void *>(retval.get()),
+                  match_data.GetTypeForCache().AsCString("<invalid>"));
+    m_format_cache.SetValidator(match_data.GetTypeForCache(), retval);
+  }
+  if (log && log->GetDebug())
+    log->Printf("[FormatManager::GetValidator] Cache hits: %" PRIu64
+                " - Cache Misses: %" PRIu64,
+                m_format_cache.GetCacheHits(), m_format_cache.GetCacheMisses());
+  return retval;
 }
 
 lldb::TypeValidatorImplSP
-FormatManager::GetHardcodedValidator (FormattersMatchData& match_data)
-{
-    TypeValidatorImplSP retval_sp;
-    
-    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages())
-    {
-        if (LanguageCategory* lang_category = GetCategoryForLanguage(lang_type))
-        {
-            if (lang_category->GetHardcoded(*this, match_data, retval_sp))
-                break;
-        }
+FormatManager::GetHardcodedValidator(FormattersMatchData &match_data) {
+  TypeValidatorImplSP retval_sp;
+
+  for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+    if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+      if (lang_category->GetHardcoded(*this, match_data, retval_sp))
+        break;
     }
-    
-    return retval_sp;
+  }
+
+  return retval_sp;
 }
 
 FormatManager::FormatManager()
-    : m_last_revision(0),
-      m_format_cache(),
-      m_language_categories_mutex(),
-      m_language_categories_map(),
-      m_named_summaries_map(this),
-      m_categories_map(this),
-      m_default_category_name(ConstString("default")),
+    : m_last_revision(0), m_format_cache(), m_language_categories_mutex(),
+      m_language_categories_map(), m_named_summaries_map(this),
+      m_categories_map(this), m_default_category_name(ConstString("default")),
       m_system_category_name(ConstString("system")),
-      m_vectortypes_category_name(ConstString("VectorTypes"))
-{
-    LoadSystemFormatters();
-    LoadVectorFormatters();
-
-    EnableCategory(m_vectortypes_category_name, TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
-    EnableCategory(m_system_category_name, TypeCategoryMap::Last, lldb::eLanguageTypeObjC_plus_plus);
-}
-
-void
-FormatManager::LoadSystemFormatters()
-{
-    TypeSummaryImpl::Flags string_flags;
-    string_flags.SetCascades(true)
-    .SetSkipPointers(true)
-    .SetSkipReferences(false)
-    .SetDontShowChildren(true)
-    .SetDontShowValue(false)
-    .SetShowMembersOneLiner(false)
-    .SetHideItemNames(false);
-    
-    TypeSummaryImpl::Flags string_array_flags;
-    string_array_flags.SetCascades(true)
-    .SetSkipPointers(true)
-    .SetSkipReferences(false)
-    .SetDontShowChildren(true)
-    .SetDontShowValue(true)
-    .SetShowMembersOneLiner(false)
-    .SetHideItemNames(false);
-    
-    lldb::TypeSummaryImplSP string_format(new StringSummaryFormat(string_flags, "${var%s}"));
-    
-    
-    lldb::TypeSummaryImplSP string_array_format(new StringSummaryFormat(string_array_flags,
-                                                                        "${var%s}"));
-    
-    lldb::RegularExpressionSP any_size_char_arr(new RegularExpression("char \\[[0-9]+\\]"));
-    lldb::RegularExpressionSP any_size_wchar_arr(new RegularExpression("wchar_t \\[[0-9]+\\]"));
-    
-    TypeCategoryImpl::SharedPointer sys_category_sp = GetCategory(m_system_category_name);
-    
-    sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("char *"), string_format);
-    sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("unsigned char *"), string_format);
-    sys_category_sp->GetRegexTypeSummariesContainer()->Add(any_size_char_arr, string_array_format);
-
-    lldb::TypeSummaryImplSP ostype_summary(new StringSummaryFormat(TypeSummaryImpl::Flags().SetCascades(false)
-                                                                   .SetSkipPointers(true)
-                                                                   .SetSkipReferences(true)
-                                                                   .SetDontShowChildren(true)
-                                                                   .SetDontShowValue(false)
-                                                                   .SetShowMembersOneLiner(false)
-                                                                   .SetHideItemNames(false),
-                                                                   "${var%O}"));
-    
-    sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("OSType"), ostype_summary);
-    
+      m_vectortypes_category_name(ConstString("VectorTypes")) {
+  LoadSystemFormatters();
+  LoadVectorFormatters();
+
+  EnableCategory(m_vectortypes_category_name, TypeCategoryMap::Last,
+                 lldb::eLanguageTypeObjC_plus_plus);
+  EnableCategory(m_system_category_name, TypeCategoryMap::Last,
+                 lldb::eLanguageTypeObjC_plus_plus);
+}
+
+void FormatManager::LoadSystemFormatters() {
+  TypeSummaryImpl::Flags string_flags;
+  string_flags.SetCascades(true)
+      .SetSkipPointers(true)
+      .SetSkipReferences(false)
+      .SetDontShowChildren(true)
+      .SetDontShowValue(false)
+      .SetShowMembersOneLiner(false)
+      .SetHideItemNames(false);
+
+  TypeSummaryImpl::Flags string_array_flags;
+  string_array_flags.SetCascades(true)
+      .SetSkipPointers(true)
+      .SetSkipReferences(false)
+      .SetDontShowChildren(true)
+      .SetDontShowValue(true)
+      .SetShowMembersOneLiner(false)
+      .SetHideItemNames(false);
+
+  lldb::TypeSummaryImplSP string_format(
+      new StringSummaryFormat(string_flags, "${var%s}"));
+
+  lldb::TypeSummaryImplSP string_array_format(
+      new StringSummaryFormat(string_array_flags, "${var%s}"));
+
+  lldb::RegularExpressionSP any_size_char_arr(
+      new RegularExpression("char \\[[0-9]+\\]"));
+  lldb::RegularExpressionSP any_size_wchar_arr(
+      new RegularExpression("wchar_t \\[[0-9]+\\]"));
+
+  TypeCategoryImpl::SharedPointer sys_category_sp =
+      GetCategory(m_system_category_name);
+
+  sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("char *"),
+                                                    string_format);
+  sys_category_sp->GetTypeSummariesContainer()->Add(
+      ConstString("unsigned char *"), string_format);
+  sys_category_sp->GetRegexTypeSummariesContainer()->Add(any_size_char_arr,
+                                                         string_array_format);
+
+  lldb::TypeSummaryImplSP ostype_summary(
+      new StringSummaryFormat(TypeSummaryImpl::Flags()
+                                  .SetCascades(false)
+                                  .SetSkipPointers(true)
+                                  .SetSkipReferences(true)
+                                  .SetDontShowChildren(true)
+                                  .SetDontShowValue(false)
+                                  .SetShowMembersOneLiner(false)
+                                  .SetHideItemNames(false),
+                              "${var%O}"));
+
+  sys_category_sp->GetTypeSummariesContainer()->Add(ConstString("OSType"),
+                                                    ostype_summary);
+
 #ifndef LLDB_DISABLE_PYTHON
-    TypeFormatImpl::Flags fourchar_flags;
-    fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(true);
-    
-    AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"), fourchar_flags);
+  TypeFormatImpl::Flags fourchar_flags;
+  fourchar_flags.SetCascades(true).SetSkipPointers(true).SetSkipReferences(
+      true);
+
+  AddFormat(sys_category_sp, lldb::eFormatOSType, ConstString("FourCharCode"),
+            fourchar_flags);
 #endif
 }
 
-void
-FormatManager::LoadVectorFormatters()
-{
-    TypeCategoryImpl::SharedPointer vectors_category_sp = GetCategory(m_vectortypes_category_name);
-    
-    TypeSummaryImpl::Flags vector_flags;
-    vector_flags.SetCascades(true)
-    .SetSkipPointers(true)
-    .SetSkipReferences(false)
-    .SetDontShowChildren(true)
-    .SetDontShowValue(false)
-    .SetShowMembersOneLiner(true)
-    .SetHideItemNames(true);
-    
-    AddStringSummary(vectors_category_sp,
-                     "${var.uint128}",
-                     ConstString("builtin_type_vec128"),
-                     vector_flags);
-    
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("float [4]"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("int32_t [4]"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("int16_t [8]"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vDouble"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vFloat"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vSInt8"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vSInt16"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vSInt32"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vUInt16"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vUInt8"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vUInt16"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vUInt32"),
-                     vector_flags);
-    AddStringSummary(vectors_category_sp,
-                     "",
-                     ConstString("vBool32"),
-                     vector_flags);
+void FormatManager::LoadVectorFormatters() {
+  TypeCategoryImpl::SharedPointer vectors_category_sp =
+      GetCategory(m_vectortypes_category_name);
+
+  TypeSummaryImpl::Flags vector_flags;
+  vector_flags.SetCascades(true)
+      .SetSkipPointers(true)
+      .SetSkipReferences(false)
+      .SetDontShowChildren(true)
+      .SetDontShowValue(false)
+      .SetShowMembersOneLiner(true)
+      .SetHideItemNames(true);
+
+  AddStringSummary(vectors_category_sp, "${var.uint128}",
+                   ConstString("builtin_type_vec128"), vector_flags);
+
+  AddStringSummary(vectors_category_sp, "", ConstString("float [4]"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("int32_t [4]"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("int16_t [8]"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vDouble"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vFloat"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vSInt8"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vSInt16"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vSInt32"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vUInt16"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vUInt8"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vUInt16"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vUInt32"),
+                   vector_flags);
+  AddStringSummary(vectors_category_sp, "", ConstString("vBool32"),
+                   vector_flags);
 }

Modified: lldb/trunk/source/DataFormatters/FormattersHelpers.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormattersHelpers.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormattersHelpers.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormattersHelpers.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- FormattersHelpers.cpp -------------------------------------*- C++ -*-===//
+//===-- FormattersHelpers.cpp -------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -26,139 +27,126 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-void
-lldb_private::formatters::AddFormat (TypeCategoryImpl::SharedPointer category_sp,
-                                     lldb::Format format,
-                                     ConstString type_name,
-                                     TypeFormatImpl::Flags flags,
-                                     bool regex)
-{
-    lldb::TypeFormatImplSP format_sp(new TypeFormatImpl_Format(format, flags));
-    
-    if (regex)
-        category_sp->GetRegexTypeFormatsContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),format_sp);
-    else
-        category_sp->GetTypeFormatsContainer()->Add(type_name, format_sp);
-}
-
-void
-lldb_private::formatters::AddSummary(TypeCategoryImpl::SharedPointer category_sp,
-                                     TypeSummaryImplSP summary_sp,
-                                     ConstString type_name,
-                                     bool regex)
-{
-    if (regex)
-        category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
-    else
-        category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
-}
-
-void
-lldb_private::formatters::AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
-                                           const char* string,
-                                           ConstString type_name,
-                                           TypeSummaryImpl::Flags flags,
-                                           bool regex)
-{
-    lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags,
-                                                               string));
-    
-    if (regex)
-        category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
-    else
-        category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
-}
-
-void
-lldb_private::formatters::AddOneLineSummary (TypeCategoryImpl::SharedPointer category_sp,
-                                             ConstString type_name,
-                                             TypeSummaryImpl::Flags flags,
-                                             bool regex)
-{
-    flags.SetShowMembersOneLiner(true);
-    lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, ""));
-    
-    if (regex)
-        category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
-    else
-        category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
+void lldb_private::formatters::AddFormat(
+    TypeCategoryImpl::SharedPointer category_sp, lldb::Format format,
+    ConstString type_name, TypeFormatImpl::Flags flags, bool regex) {
+  lldb::TypeFormatImplSP format_sp(new TypeFormatImpl_Format(format, flags));
+
+  if (regex)
+    category_sp->GetRegexTypeFormatsContainer()->Add(
+        RegularExpressionSP(new RegularExpression(type_name.AsCString())),
+        format_sp);
+  else
+    category_sp->GetTypeFormatsContainer()->Add(type_name, format_sp);
+}
+
+void lldb_private::formatters::AddSummary(
+    TypeCategoryImpl::SharedPointer category_sp, TypeSummaryImplSP summary_sp,
+    ConstString type_name, bool regex) {
+  if (regex)
+    category_sp->GetRegexTypeSummariesContainer()->Add(
+        RegularExpressionSP(new RegularExpression(type_name.AsCString())),
+        summary_sp);
+  else
+    category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
+}
+
+void lldb_private::formatters::AddStringSummary(
+    TypeCategoryImpl::SharedPointer category_sp, const char *string,
+    ConstString type_name, TypeSummaryImpl::Flags flags, bool regex) {
+  lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, string));
+
+  if (regex)
+    category_sp->GetRegexTypeSummariesContainer()->Add(
+        RegularExpressionSP(new RegularExpression(type_name.AsCString())),
+        summary_sp);
+  else
+    category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
+}
+
+void lldb_private::formatters::AddOneLineSummary(
+    TypeCategoryImpl::SharedPointer category_sp, ConstString type_name,
+    TypeSummaryImpl::Flags flags, bool regex) {
+  flags.SetShowMembersOneLiner(true);
+  lldb::TypeSummaryImplSP summary_sp(new StringSummaryFormat(flags, ""));
+
+  if (regex)
+    category_sp->GetRegexTypeSummariesContainer()->Add(
+        RegularExpressionSP(new RegularExpression(type_name.AsCString())),
+        summary_sp);
+  else
+    category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
 }
 
 #ifndef LLDB_DISABLE_PYTHON
-void
-lldb_private::formatters::AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
-                                         CXXFunctionSummaryFormat::Callback funct,
-                                         const char* description,
-                                         ConstString type_name,
-                                         TypeSummaryImpl::Flags flags,
-                                         bool regex)
-{
-    lldb::TypeSummaryImplSP summary_sp(new CXXFunctionSummaryFormat(flags,funct,description));
-    if (regex)
-        category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
-    else
-        category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
-}
-
-void
-lldb_private::formatters::AddCXXSynthetic  (TypeCategoryImpl::SharedPointer category_sp,
-                                            CXXSyntheticChildren::CreateFrontEndCallback generator,
-                                            const char* description,
-                                            ConstString type_name,
-                                            ScriptedSyntheticChildren::Flags flags,
-                                            bool regex)
-{
-    lldb::SyntheticChildrenSP synth_sp(new CXXSyntheticChildren(flags,description,generator));
-    if (regex)
-        category_sp->GetRegexTypeSyntheticsContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), synth_sp);
-    else
-        category_sp->GetTypeSyntheticsContainer()->Add(type_name,synth_sp);
-}
-
-void
-lldb_private::formatters::AddFilter  (TypeCategoryImpl::SharedPointer category_sp,
-                                      std::vector<std::string> children,
-                                      const char* description,
-                                      ConstString type_name,
-                                      ScriptedSyntheticChildren::Flags flags,
-                                      bool regex)
-{
-    TypeFilterImplSP filter_sp(new TypeFilterImpl(flags));
-    for (auto child : children)
-        filter_sp->AddExpressionPath(child);
-    if (regex)
-        category_sp->GetRegexTypeFiltersContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())), filter_sp);
-    else
-        category_sp->GetTypeFiltersContainer()->Add(type_name,filter_sp);
+void lldb_private::formatters::AddCXXSummary(
+    TypeCategoryImpl::SharedPointer category_sp,
+    CXXFunctionSummaryFormat::Callback funct, const char *description,
+    ConstString type_name, TypeSummaryImpl::Flags flags, bool regex) {
+  lldb::TypeSummaryImplSP summary_sp(
+      new CXXFunctionSummaryFormat(flags, funct, description));
+  if (regex)
+    category_sp->GetRegexTypeSummariesContainer()->Add(
+        RegularExpressionSP(new RegularExpression(type_name.AsCString())),
+        summary_sp);
+  else
+    category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
+}
+
+void lldb_private::formatters::AddCXXSynthetic(
+    TypeCategoryImpl::SharedPointer category_sp,
+    CXXSyntheticChildren::CreateFrontEndCallback generator,
+    const char *description, ConstString type_name,
+    ScriptedSyntheticChildren::Flags flags, bool regex) {
+  lldb::SyntheticChildrenSP synth_sp(
+      new CXXSyntheticChildren(flags, description, generator));
+  if (regex)
+    category_sp->GetRegexTypeSyntheticsContainer()->Add(
+        RegularExpressionSP(new RegularExpression(type_name.AsCString())),
+        synth_sp);
+  else
+    category_sp->GetTypeSyntheticsContainer()->Add(type_name, synth_sp);
+}
+
+void lldb_private::formatters::AddFilter(
+    TypeCategoryImpl::SharedPointer category_sp,
+    std::vector<std::string> children, const char *description,
+    ConstString type_name, ScriptedSyntheticChildren::Flags flags, bool regex) {
+  TypeFilterImplSP filter_sp(new TypeFilterImpl(flags));
+  for (auto child : children)
+    filter_sp->AddExpressionPath(child);
+  if (regex)
+    category_sp->GetRegexTypeFiltersContainer()->Add(
+        RegularExpressionSP(new RegularExpression(type_name.AsCString())),
+        filter_sp);
+  else
+    category_sp->GetTypeFiltersContainer()->Add(type_name, filter_sp);
 }
 #endif
 
-size_t
-lldb_private::formatters::ExtractIndexFromString (const char* item_name)
-{
-    if (!item_name || !*item_name)
-        return UINT32_MAX;
-    if (*item_name != '[')
-        return UINT32_MAX;
-    item_name++;
-    char* endptr = NULL;
-    unsigned long int idx = ::strtoul(item_name, &endptr, 0);
-    if (idx == 0 && endptr == item_name)
-        return UINT32_MAX;
-    if (idx == ULONG_MAX)
-        return UINT32_MAX;
-    return idx;
+size_t lldb_private::formatters::ExtractIndexFromString(const char *item_name) {
+  if (!item_name || !*item_name)
+    return UINT32_MAX;
+  if (*item_name != '[')
+    return UINT32_MAX;
+  item_name++;
+  char *endptr = NULL;
+  unsigned long int idx = ::strtoul(item_name, &endptr, 0);
+  if (idx == 0 && endptr == item_name)
+    return UINT32_MAX;
+  if (idx == ULONG_MAX)
+    return UINT32_MAX;
+  return idx;
 }
 
 lldb::addr_t
-lldb_private::formatters::GetArrayAddressOrPointerValue (ValueObject& valobj)
-{
-    lldb::addr_t data_addr = LLDB_INVALID_ADDRESS;
-
-    if (valobj.IsPointerType())
-        data_addr = valobj.GetValueAsUnsigned(0);
-    else if (valobj.IsArrayType())
-        data_addr = valobj.GetAddressOf();
+lldb_private::formatters::GetArrayAddressOrPointerValue(ValueObject &valobj) {
+  lldb::addr_t data_addr = LLDB_INVALID_ADDRESS;
 
-    return data_addr;
+  if (valobj.IsPointerType())
+    data_addr = valobj.GetValueAsUnsigned(0);
+  else if (valobj.IsArrayType())
+    data_addr = valobj.GetAddressOf();
+
+  return data_addr;
 }

Modified: lldb/trunk/source/DataFormatters/LanguageCategory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/LanguageCategory.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/LanguageCategory.cpp (original)
+++ lldb/trunk/source/DataFormatters/LanguageCategory.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- LanguageCategory.cpp ---------------------------------------*- C++ -*-===//
+//===-- LanguageCategory.cpp ---------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -24,248 +25,208 @@
 using namespace lldb;
 using namespace lldb_private;
 
-LanguageCategory::LanguageCategory (lldb::LanguageType lang_type) :
-    m_category_sp(),
-    m_hardcoded_formats(),
-    m_hardcoded_summaries(),
-    m_hardcoded_synthetics(),
-    m_hardcoded_validators(),
-    m_format_cache(),
-    m_enabled(false)
-{
-    if (Language* language_plugin = Language::FindPlugin(lang_type))
-    {
-        m_category_sp = language_plugin->GetFormatters();
-        m_hardcoded_formats = language_plugin->GetHardcodedFormats();
-        m_hardcoded_summaries = language_plugin->GetHardcodedSummaries();
-        m_hardcoded_synthetics = language_plugin->GetHardcodedSynthetics();
-        m_hardcoded_validators = language_plugin->GetHardcodedValidators();
-    }
-    Enable();
-}
-
-bool
-LanguageCategory::Get (FormattersMatchData& match_data,
-                       lldb::TypeFormatImplSP& format_sp)
-{
-    if (!m_category_sp)
-        return false;
-    
-    if (!IsEnabled())
-        return false;
-
-    if (match_data.GetTypeForCache())
-    {
-        if (m_format_cache.GetFormat(match_data.GetTypeForCache(), format_sp))
-            return format_sp.get() != nullptr;
-    }
-
-    ValueObject& valobj(match_data.GetValueObject());
-    bool result = m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
-    if (match_data.GetTypeForCache() && (!format_sp || !format_sp->NonCacheable()))
-    {
-        m_format_cache.SetFormat(match_data.GetTypeForCache(), format_sp);
-    }
-    return result;
-}
-
-bool
-LanguageCategory::Get (FormattersMatchData& match_data,
-                       lldb::TypeSummaryImplSP& format_sp)
-{
-    if (!m_category_sp)
-        return false;
-    
-    if (!IsEnabled())
-        return false;
-
-    if (match_data.GetTypeForCache())
-    {
-        if (m_format_cache.GetSummary(match_data.GetTypeForCache(), format_sp))
-            return format_sp.get() != nullptr;
-    }
-    
-    ValueObject& valobj(match_data.GetValueObject());
-    bool result = m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
-    if (match_data.GetTypeForCache() && (!format_sp || !format_sp->NonCacheable()))
-    {
-        m_format_cache.SetSummary(match_data.GetTypeForCache(), format_sp);
-    }
-    return result;
-}
-
-bool
-LanguageCategory::Get (FormattersMatchData& match_data,
-                       lldb::SyntheticChildrenSP& format_sp)
-{
-    if (!m_category_sp)
-        return false;
-    
-    if (!IsEnabled())
-        return false;
-
-    if (match_data.GetTypeForCache())
-    {
-        if (m_format_cache.GetSynthetic(match_data.GetTypeForCache(), format_sp))
-            return format_sp.get() != nullptr;
-    }
-    
-    ValueObject& valobj(match_data.GetValueObject());
-    bool result = m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
-    if (match_data.GetTypeForCache() && (!format_sp || !format_sp->NonCacheable()))
-    {
-        m_format_cache.SetSynthetic(match_data.GetTypeForCache(), format_sp);
-    }
-    return result;
-}
-
-bool
-LanguageCategory::Get (FormattersMatchData& match_data,
-                       lldb::TypeValidatorImplSP& format_sp)
-{
-    if (!m_category_sp)
-        return false;
-
-    if (!IsEnabled())
-        return false;
-
-    if (match_data.GetTypeForCache())
-    {
-        if (m_format_cache.GetValidator(match_data.GetTypeForCache(), format_sp))
-            return format_sp.get() != nullptr;
-    }
-    
-    ValueObject& valobj(match_data.GetValueObject());
-    bool result = m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
-    if (match_data.GetTypeForCache() && (!format_sp || !format_sp->NonCacheable()))
-    {
-        m_format_cache.SetValidator(match_data.GetTypeForCache(), format_sp);
-    }
-    return result;
-}
-
-bool
-LanguageCategory::GetHardcoded (FormatManager& fmt_mgr,
-                                FormattersMatchData& match_data,
-                                lldb::TypeFormatImplSP& format_sp)
-{
-    if (!IsEnabled())
-        return false;
-
-    ValueObject& valobj(match_data.GetValueObject());
-    lldb::DynamicValueType use_dynamic(match_data.GetDynamicValueType());
-    
-    for (auto& candidate : m_hardcoded_formats)
-    {
-        if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
-            break;
-    }
-    if (match_data.GetTypeForCache() && (!format_sp || !format_sp->NonCacheable()))
-    {
-        m_format_cache.SetFormat(match_data.GetTypeForCache(), format_sp);
-    }
-    return format_sp.get() != nullptr;
-}
-
-bool
-LanguageCategory::GetHardcoded (FormatManager& fmt_mgr,
-                                FormattersMatchData& match_data,
-                                lldb::TypeSummaryImplSP& format_sp)
-{
-    if (!IsEnabled())
-        return false;
-    
-    ValueObject& valobj(match_data.GetValueObject());
-    lldb::DynamicValueType use_dynamic(match_data.GetDynamicValueType());
-
-    for (auto& candidate : m_hardcoded_summaries)
-    {
-        if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
-            break;
-    }
-    if (match_data.GetTypeForCache() && (!format_sp || !format_sp->NonCacheable()))
-    {
-        m_format_cache.SetSummary(match_data.GetTypeForCache(), format_sp);
-    }
-    return format_sp.get() != nullptr;
-}
-
-bool
-LanguageCategory::GetHardcoded (FormatManager& fmt_mgr,
-                                FormattersMatchData& match_data,
-                                lldb::SyntheticChildrenSP& format_sp)
-{
-    if (!IsEnabled())
-        return false;
-
-    ValueObject& valobj(match_data.GetValueObject());
-    lldb::DynamicValueType use_dynamic(match_data.GetDynamicValueType());
-    
-    for (auto& candidate : m_hardcoded_synthetics)
-    {
-        if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
-            break;
-    }
-    if (match_data.GetTypeForCache() && (!format_sp || !format_sp->NonCacheable()))
-    {
-        m_format_cache.SetSynthetic(match_data.GetTypeForCache(), format_sp);
-    }
-    return format_sp.get() != nullptr;
-}
-
-bool
-LanguageCategory::GetHardcoded (FormatManager& fmt_mgr,
-                                FormattersMatchData& match_data,
-                                lldb::TypeValidatorImplSP& format_sp)
-{
-    if (!IsEnabled())
-        return false;
-
-    ValueObject& valobj(match_data.GetValueObject());
-    lldb::DynamicValueType use_dynamic(match_data.GetDynamicValueType());
-    
-    for (auto& candidate : m_hardcoded_validators)
-    {
-        if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
-            break;
-    }
-    if (match_data.GetTypeForCache() && (!format_sp || !format_sp->NonCacheable()))
-    {
-        m_format_cache.SetValidator(match_data.GetTypeForCache(), format_sp);
-    }
-    return format_sp.get() != nullptr;
-}
-
-lldb::TypeCategoryImplSP
-LanguageCategory::GetCategory () const
-{
-    return m_category_sp;
-}
-
-FormatCache&
-LanguageCategory::GetFormatCache ()
-{
-    return m_format_cache;
-}
-
-void
-LanguageCategory::Enable ()
-{
-    if (m_category_sp)
-        m_category_sp->Enable(true, TypeCategoryMap::Default);
-    m_enabled = true;
-}
-
-void
-LanguageCategory::Disable ()
-{
-    if (m_category_sp)
-        m_category_sp->Disable();
-    m_enabled = false;
-}
-
-bool
-LanguageCategory::IsEnabled ()
-{
-    return m_enabled;
+LanguageCategory::LanguageCategory(lldb::LanguageType lang_type)
+    : m_category_sp(), m_hardcoded_formats(), m_hardcoded_summaries(),
+      m_hardcoded_synthetics(), m_hardcoded_validators(), m_format_cache(),
+      m_enabled(false) {
+  if (Language *language_plugin = Language::FindPlugin(lang_type)) {
+    m_category_sp = language_plugin->GetFormatters();
+    m_hardcoded_formats = language_plugin->GetHardcodedFormats();
+    m_hardcoded_summaries = language_plugin->GetHardcodedSummaries();
+    m_hardcoded_synthetics = language_plugin->GetHardcodedSynthetics();
+    m_hardcoded_validators = language_plugin->GetHardcodedValidators();
+  }
+  Enable();
+}
+
+bool LanguageCategory::Get(FormattersMatchData &match_data,
+                           lldb::TypeFormatImplSP &format_sp) {
+  if (!m_category_sp)
+    return false;
+
+  if (!IsEnabled())
+    return false;
+
+  if (match_data.GetTypeForCache()) {
+    if (m_format_cache.GetFormat(match_data.GetTypeForCache(), format_sp))
+      return format_sp.get() != nullptr;
+  }
+
+  ValueObject &valobj(match_data.GetValueObject());
+  bool result =
+      m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
+  if (match_data.GetTypeForCache() &&
+      (!format_sp || !format_sp->NonCacheable())) {
+    m_format_cache.SetFormat(match_data.GetTypeForCache(), format_sp);
+  }
+  return result;
+}
+
+bool LanguageCategory::Get(FormattersMatchData &match_data,
+                           lldb::TypeSummaryImplSP &format_sp) {
+  if (!m_category_sp)
+    return false;
+
+  if (!IsEnabled())
+    return false;
+
+  if (match_data.GetTypeForCache()) {
+    if (m_format_cache.GetSummary(match_data.GetTypeForCache(), format_sp))
+      return format_sp.get() != nullptr;
+  }
+
+  ValueObject &valobj(match_data.GetValueObject());
+  bool result =
+      m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
+  if (match_data.GetTypeForCache() &&
+      (!format_sp || !format_sp->NonCacheable())) {
+    m_format_cache.SetSummary(match_data.GetTypeForCache(), format_sp);
+  }
+  return result;
+}
+
+bool LanguageCategory::Get(FormattersMatchData &match_data,
+                           lldb::SyntheticChildrenSP &format_sp) {
+  if (!m_category_sp)
+    return false;
+
+  if (!IsEnabled())
+    return false;
+
+  if (match_data.GetTypeForCache()) {
+    if (m_format_cache.GetSynthetic(match_data.GetTypeForCache(), format_sp))
+      return format_sp.get() != nullptr;
+  }
+
+  ValueObject &valobj(match_data.GetValueObject());
+  bool result =
+      m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
+  if (match_data.GetTypeForCache() &&
+      (!format_sp || !format_sp->NonCacheable())) {
+    m_format_cache.SetSynthetic(match_data.GetTypeForCache(), format_sp);
+  }
+  return result;
+}
+
+bool LanguageCategory::Get(FormattersMatchData &match_data,
+                           lldb::TypeValidatorImplSP &format_sp) {
+  if (!m_category_sp)
+    return false;
+
+  if (!IsEnabled())
+    return false;
+
+  if (match_data.GetTypeForCache()) {
+    if (m_format_cache.GetValidator(match_data.GetTypeForCache(), format_sp))
+      return format_sp.get() != nullptr;
+  }
+
+  ValueObject &valobj(match_data.GetValueObject());
+  bool result =
+      m_category_sp->Get(valobj, match_data.GetMatchesVector(), format_sp);
+  if (match_data.GetTypeForCache() &&
+      (!format_sp || !format_sp->NonCacheable())) {
+    m_format_cache.SetValidator(match_data.GetTypeForCache(), format_sp);
+  }
+  return result;
+}
+
+bool LanguageCategory::GetHardcoded(FormatManager &fmt_mgr,
+                                    FormattersMatchData &match_data,
+                                    lldb::TypeFormatImplSP &format_sp) {
+  if (!IsEnabled())
+    return false;
+
+  ValueObject &valobj(match_data.GetValueObject());
+  lldb::DynamicValueType use_dynamic(match_data.GetDynamicValueType());
+
+  for (auto &candidate : m_hardcoded_formats) {
+    if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
+      break;
+  }
+  if (match_data.GetTypeForCache() &&
+      (!format_sp || !format_sp->NonCacheable())) {
+    m_format_cache.SetFormat(match_data.GetTypeForCache(), format_sp);
+  }
+  return format_sp.get() != nullptr;
+}
+
+bool LanguageCategory::GetHardcoded(FormatManager &fmt_mgr,
+                                    FormattersMatchData &match_data,
+                                    lldb::TypeSummaryImplSP &format_sp) {
+  if (!IsEnabled())
+    return false;
+
+  ValueObject &valobj(match_data.GetValueObject());
+  lldb::DynamicValueType use_dynamic(match_data.GetDynamicValueType());
+
+  for (auto &candidate : m_hardcoded_summaries) {
+    if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
+      break;
+  }
+  if (match_data.GetTypeForCache() &&
+      (!format_sp || !format_sp->NonCacheable())) {
+    m_format_cache.SetSummary(match_data.GetTypeForCache(), format_sp);
+  }
+  return format_sp.get() != nullptr;
+}
+
+bool LanguageCategory::GetHardcoded(FormatManager &fmt_mgr,
+                                    FormattersMatchData &match_data,
+                                    lldb::SyntheticChildrenSP &format_sp) {
+  if (!IsEnabled())
+    return false;
+
+  ValueObject &valobj(match_data.GetValueObject());
+  lldb::DynamicValueType use_dynamic(match_data.GetDynamicValueType());
+
+  for (auto &candidate : m_hardcoded_synthetics) {
+    if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
+      break;
+  }
+  if (match_data.GetTypeForCache() &&
+      (!format_sp || !format_sp->NonCacheable())) {
+    m_format_cache.SetSynthetic(match_data.GetTypeForCache(), format_sp);
+  }
+  return format_sp.get() != nullptr;
+}
+
+bool LanguageCategory::GetHardcoded(FormatManager &fmt_mgr,
+                                    FormattersMatchData &match_data,
+                                    lldb::TypeValidatorImplSP &format_sp) {
+  if (!IsEnabled())
+    return false;
+
+  ValueObject &valobj(match_data.GetValueObject());
+  lldb::DynamicValueType use_dynamic(match_data.GetDynamicValueType());
+
+  for (auto &candidate : m_hardcoded_validators) {
+    if ((format_sp = candidate(valobj, use_dynamic, fmt_mgr)))
+      break;
+  }
+  if (match_data.GetTypeForCache() &&
+      (!format_sp || !format_sp->NonCacheable())) {
+    m_format_cache.SetValidator(match_data.GetTypeForCache(), format_sp);
+  }
+  return format_sp.get() != nullptr;
+}
+
+lldb::TypeCategoryImplSP LanguageCategory::GetCategory() const {
+  return m_category_sp;
+}
+
+FormatCache &LanguageCategory::GetFormatCache() { return m_format_cache; }
+
+void LanguageCategory::Enable() {
+  if (m_category_sp)
+    m_category_sp->Enable(true, TypeCategoryMap::Default);
+  m_enabled = true;
+}
+
+void LanguageCategory::Disable() {
+  if (m_category_sp)
+    m_category_sp->Disable();
+  m_enabled = false;
 }
+
+bool LanguageCategory::IsEnabled() { return m_enabled; }

Modified: lldb/trunk/source/DataFormatters/StringPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/StringPrinter.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/StringPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/StringPrinter.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- StringPrinter.cpp ----------------------------------------*- C++ -*-===//
+//===-- StringPrinter.cpp ----------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -25,629 +26,622 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-// we define this for all values of type but only implement it for those we care about
+// we define this for all values of type but only implement it for those we care
+// about
 // that's good because we get linker errors for any unsupported type
 template <lldb_private::formatters::StringPrinter::StringElementType type>
 static StringPrinter::StringPrinterBufferPointer<>
-GetPrintableImpl(uint8_t* buffer, uint8_t* buffer_end, uint8_t*& next);
+GetPrintableImpl(uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next);
 
 // mimic isprint() for Unicode codepoints
-static bool
-isprint(char32_t codepoint)
-{
-    if (codepoint <= 0x1F || codepoint == 0x7F) // C0
-    {
-        return false;
-    }
-    if (codepoint >= 0x80 && codepoint <= 0x9F) // C1
-    {
-        return false;
-    }
-    if (codepoint == 0x2028 || codepoint == 0x2029) // line/paragraph separators
-    {
-        return false;
-    }
-    if (codepoint == 0x200E || codepoint == 0x200F || (codepoint >= 0x202A && codepoint <= 0x202E)) // bidirectional text control
-    {
-        return false;
-    }
-    if (codepoint >= 0xFFF9 && codepoint <= 0xFFFF) // interlinears and generally specials
-    {
-        return false;
-    }
-    return true;
+static bool isprint(char32_t codepoint) {
+  if (codepoint <= 0x1F || codepoint == 0x7F) // C0
+  {
+    return false;
+  }
+  if (codepoint >= 0x80 && codepoint <= 0x9F) // C1
+  {
+    return false;
+  }
+  if (codepoint == 0x2028 || codepoint == 0x2029) // line/paragraph separators
+  {
+    return false;
+  }
+  if (codepoint == 0x200E || codepoint == 0x200F ||
+      (codepoint >= 0x202A &&
+       codepoint <= 0x202E)) // bidirectional text control
+  {
+    return false;
+  }
+  if (codepoint >= 0xFFF9 &&
+      codepoint <= 0xFFFF) // interlinears and generally specials
+  {
+    return false;
+  }
+  return true;
 }
 
 template <>
 StringPrinter::StringPrinterBufferPointer<>
-GetPrintableImpl<StringPrinter::StringElementType::ASCII> (uint8_t* buffer, uint8_t* buffer_end, uint8_t*& next)
-{
-    StringPrinter::StringPrinterBufferPointer<> retval = {nullptr};
-    
-    switch (*buffer)
-    {
-        case 0:
-            retval = {"\\0",2};
-            break;
-        case '\a':
-            retval = {"\\a",2};
-            break;
-        case '\b':
-            retval = {"\\b",2};
-            break;
-        case '\f':
-            retval = {"\\f",2};
-            break;
-        case '\n':
-            retval = {"\\n",2};
-            break;
-        case '\r':
-            retval = {"\\r",2};
-            break;
-        case '\t':
-            retval = {"\\t",2};
-            break;
-        case '\v':
-            retval = {"\\v",2};
-            break;
-        case '\"':
-            retval = {"\\\"",2};
-            break;
-        case '\\':
-            retval = {"\\\\",2};
-            break;
-        default:
-          if (isprint(*buffer))
-              retval = {buffer,1};
-          else
-          {
-              uint8_t* data = new uint8_t[5];
-              sprintf((char*)data,"\\x%02x",*buffer);
-              retval = {data, 4, [] (const uint8_t* c) {delete[] c;} };
-              break;
-          }
-    }
-    
-    next = buffer + 1;
-    return retval;
-}
-
-static char32_t
-ConvertUTF8ToCodePoint (unsigned char c0, unsigned char c1)
-{
-    return (c0-192)*64+(c1-128);
-}
-static char32_t
-ConvertUTF8ToCodePoint (unsigned char c0, unsigned char c1, unsigned char c2)
-{
-    return (c0-224)*4096+(c1-128)*64+(c2-128);
-}
-static char32_t
-ConvertUTF8ToCodePoint (unsigned char c0, unsigned char c1, unsigned char c2, unsigned char c3)
-{
-    return (c0-240)*262144+(c2-128)*4096+(c2-128)*64+(c3-128);
+GetPrintableImpl<StringPrinter::StringElementType::ASCII>(uint8_t *buffer,
+                                                          uint8_t *buffer_end,
+                                                          uint8_t *&next) {
+  StringPrinter::StringPrinterBufferPointer<> retval = {nullptr};
+
+  switch (*buffer) {
+  case 0:
+    retval = {"\\0", 2};
+    break;
+  case '\a':
+    retval = {"\\a", 2};
+    break;
+  case '\b':
+    retval = {"\\b", 2};
+    break;
+  case '\f':
+    retval = {"\\f", 2};
+    break;
+  case '\n':
+    retval = {"\\n", 2};
+    break;
+  case '\r':
+    retval = {"\\r", 2};
+    break;
+  case '\t':
+    retval = {"\\t", 2};
+    break;
+  case '\v':
+    retval = {"\\v", 2};
+    break;
+  case '\"':
+    retval = {"\\\"", 2};
+    break;
+  case '\\':
+    retval = {"\\\\", 2};
+    break;
+  default:
+    if (isprint(*buffer))
+      retval = {buffer, 1};
+    else {
+      uint8_t *data = new uint8_t[5];
+      sprintf((char *)data, "\\x%02x", *buffer);
+      retval = {data, 4, [](const uint8_t *c) { delete[] c; }};
+      break;
+    }
+  }
+
+  next = buffer + 1;
+  return retval;
+}
+
+static char32_t ConvertUTF8ToCodePoint(unsigned char c0, unsigned char c1) {
+  return (c0 - 192) * 64 + (c1 - 128);
+}
+static char32_t ConvertUTF8ToCodePoint(unsigned char c0, unsigned char c1,
+                                       unsigned char c2) {
+  return (c0 - 224) * 4096 + (c1 - 128) * 64 + (c2 - 128);
+}
+static char32_t ConvertUTF8ToCodePoint(unsigned char c0, unsigned char c1,
+                                       unsigned char c2, unsigned char c3) {
+  return (c0 - 240) * 262144 + (c2 - 128) * 4096 + (c2 - 128) * 64 + (c3 - 128);
 }
 
 template <>
 StringPrinter::StringPrinterBufferPointer<>
-GetPrintableImpl<StringPrinter::StringElementType::UTF8> (uint8_t* buffer, uint8_t* buffer_end, uint8_t*& next)
-{
-    StringPrinter::StringPrinterBufferPointer<> retval {nullptr};
-    
-    unsigned utf8_encoded_len = getNumBytesForUTF8(*buffer);
-    
-    if (1+buffer_end-buffer < utf8_encoded_len)
-    {
-        // I don't have enough bytes - print whatever I have left
-        retval = {buffer,static_cast<size_t>(1+buffer_end-buffer)};
-        next = buffer_end+1;
-        return retval;
-    }
-    
-    char32_t codepoint = 0;
-    switch (utf8_encoded_len)
-    {
-        case 1:
-            // this is just an ASCII byte - ask ASCII
-            return GetPrintableImpl<StringPrinter::StringElementType::ASCII>(buffer, buffer_end, next);
-        case 2:
-            codepoint = ConvertUTF8ToCodePoint((unsigned char)*buffer, (unsigned char)*(buffer+1));
-            break;
-        case 3:
-            codepoint = ConvertUTF8ToCodePoint((unsigned char)*buffer, (unsigned char)*(buffer+1), (unsigned char)*(buffer+2));
-            break;
-        case 4:
-            codepoint = ConvertUTF8ToCodePoint((unsigned char)*buffer, (unsigned char)*(buffer+1), (unsigned char)*(buffer+2), (unsigned char)*(buffer+3));
-            break;
-        default:
-            // this is probably some bogus non-character thing
-            // just print it as-is and hope to sync up again soon
-            retval = {buffer,1};
-            next = buffer+1;
-            return retval;
-    }
-    
-    if (codepoint)
-    {
-        switch (codepoint)
-        {
-            case 0:
-                retval = {"\\0",2};
-                break;
-            case '\a':
-                retval = {"\\a",2};
-                break;
-            case '\b':
-                retval = {"\\b",2};
-                break;
-            case '\f':
-                retval = {"\\f",2};
-                break;
-            case '\n':
-                retval = {"\\n",2};
-                break;
-            case '\r':
-                retval = {"\\r",2};
-                break;
-            case '\t':
-                retval = {"\\t",2};
-                break;
-            case '\v':
-                retval = {"\\v",2};
-                break;
-            case '\"':
-                retval = {"\\\"",2};
-                break;
-            case '\\':
-                retval = {"\\\\",2};
-                break;
-            default:
-                if (isprint(codepoint))
-                    retval = {buffer,utf8_encoded_len};
-                else
-                {
-                    uint8_t* data = new uint8_t[11];
-                    sprintf((char *)data, "\\U%08x", (unsigned)codepoint);
-                    retval = { data,10,[] (const uint8_t* c) {delete[] c;} };
-                    break;
-                }
-        }
-        
-        next = buffer + utf8_encoded_len;
-        return retval;
+GetPrintableImpl<StringPrinter::StringElementType::UTF8>(uint8_t *buffer,
+                                                         uint8_t *buffer_end,
+                                                         uint8_t *&next) {
+  StringPrinter::StringPrinterBufferPointer<> retval{nullptr};
+
+  unsigned utf8_encoded_len = getNumBytesForUTF8(*buffer);
+
+  if (1 + buffer_end - buffer < utf8_encoded_len) {
+    // I don't have enough bytes - print whatever I have left
+    retval = {buffer, static_cast<size_t>(1 + buffer_end - buffer)};
+    next = buffer_end + 1;
+    return retval;
+  }
+
+  char32_t codepoint = 0;
+  switch (utf8_encoded_len) {
+  case 1:
+    // this is just an ASCII byte - ask ASCII
+    return GetPrintableImpl<StringPrinter::StringElementType::ASCII>(
+        buffer, buffer_end, next);
+  case 2:
+    codepoint = ConvertUTF8ToCodePoint((unsigned char)*buffer,
+                                       (unsigned char)*(buffer + 1));
+    break;
+  case 3:
+    codepoint = ConvertUTF8ToCodePoint((unsigned char)*buffer,
+                                       (unsigned char)*(buffer + 1),
+                                       (unsigned char)*(buffer + 2));
+    break;
+  case 4:
+    codepoint = ConvertUTF8ToCodePoint(
+        (unsigned char)*buffer, (unsigned char)*(buffer + 1),
+        (unsigned char)*(buffer + 2), (unsigned char)*(buffer + 3));
+    break;
+  default:
+    // this is probably some bogus non-character thing
+    // just print it as-is and hope to sync up again soon
+    retval = {buffer, 1};
+    next = buffer + 1;
+    return retval;
+  }
+
+  if (codepoint) {
+    switch (codepoint) {
+    case 0:
+      retval = {"\\0", 2};
+      break;
+    case '\a':
+      retval = {"\\a", 2};
+      break;
+    case '\b':
+      retval = {"\\b", 2};
+      break;
+    case '\f':
+      retval = {"\\f", 2};
+      break;
+    case '\n':
+      retval = {"\\n", 2};
+      break;
+    case '\r':
+      retval = {"\\r", 2};
+      break;
+    case '\t':
+      retval = {"\\t", 2};
+      break;
+    case '\v':
+      retval = {"\\v", 2};
+      break;
+    case '\"':
+      retval = {"\\\"", 2};
+      break;
+    case '\\':
+      retval = {"\\\\", 2};
+      break;
+    default:
+      if (isprint(codepoint))
+        retval = {buffer, utf8_encoded_len};
+      else {
+        uint8_t *data = new uint8_t[11];
+        sprintf((char *)data, "\\U%08x", (unsigned)codepoint);
+        retval = {data, 10, [](const uint8_t *c) { delete[] c; }};
+        break;
+      }
     }
-    
-    // this should not happen - but just in case.. try to resync at some point
-    retval = {buffer,1};
-    next = buffer+1;
+
+    next = buffer + utf8_encoded_len;
     return retval;
+  }
+
+  // this should not happen - but just in case.. try to resync at some point
+  retval = {buffer, 1};
+  next = buffer + 1;
+  return retval;
 }
 
 // Given a sequence of bytes, this function returns:
 // a sequence of bytes to actually print out + a length
 // the following unscanned position of the buffer is in next
 static StringPrinter::StringPrinterBufferPointer<>
-GetPrintable(StringPrinter::StringElementType type, uint8_t* buffer, uint8_t* buffer_end, uint8_t*& next)
-{
-    if (!buffer)
-        return {nullptr};
-    
-    switch (type)
-    {
-        case StringPrinter::StringElementType::ASCII:
-            return GetPrintableImpl<StringPrinter::StringElementType::ASCII>(buffer, buffer_end, next);
-        case StringPrinter::StringElementType::UTF8:
-            return GetPrintableImpl<StringPrinter::StringElementType::UTF8>(buffer, buffer_end, next);
-        default:
-            return {nullptr};
-    }
+GetPrintable(StringPrinter::StringElementType type, uint8_t *buffer,
+             uint8_t *buffer_end, uint8_t *&next) {
+  if (!buffer)
+    return {nullptr};
+
+  switch (type) {
+  case StringPrinter::StringElementType::ASCII:
+    return GetPrintableImpl<StringPrinter::StringElementType::ASCII>(
+        buffer, buffer_end, next);
+  case StringPrinter::StringElementType::UTF8:
+    return GetPrintableImpl<StringPrinter::StringElementType::UTF8>(
+        buffer, buffer_end, next);
+  default:
+    return {nullptr};
+  }
 }
 
 StringPrinter::EscapingHelper
-StringPrinter::GetDefaultEscapingHelper (GetPrintableElementType elem_type)
-{
-    switch (elem_type)
-    {
-        case GetPrintableElementType::UTF8:
-            return [] (uint8_t* buffer, uint8_t* buffer_end, uint8_t*& next) -> StringPrinter::StringPrinterBufferPointer<> {
-                return GetPrintable(StringPrinter::StringElementType::UTF8, buffer, buffer_end, next);
-            };
-        case GetPrintableElementType::ASCII:
-            return [] (uint8_t* buffer, uint8_t* buffer_end, uint8_t*& next) -> StringPrinter::StringPrinterBufferPointer<> {
-                return GetPrintable(StringPrinter::StringElementType::ASCII, buffer, buffer_end, next);
-            };
-    }
-    llvm_unreachable("bad element type");
+StringPrinter::GetDefaultEscapingHelper(GetPrintableElementType elem_type) {
+  switch (elem_type) {
+  case GetPrintableElementType::UTF8:
+    return [](uint8_t *buffer, uint8_t *buffer_end,
+              uint8_t *&next) -> StringPrinter::StringPrinterBufferPointer<> {
+      return GetPrintable(StringPrinter::StringElementType::UTF8, buffer,
+                          buffer_end, next);
+    };
+  case GetPrintableElementType::ASCII:
+    return [](uint8_t *buffer, uint8_t *buffer_end,
+              uint8_t *&next) -> StringPrinter::StringPrinterBufferPointer<> {
+      return GetPrintable(StringPrinter::StringElementType::ASCII, buffer,
+                          buffer_end, next);
+    };
+  }
+  llvm_unreachable("bad element type");
 }
 
 // use this call if you already have an LLDB-side buffer for the data
-template<typename SourceDataType>
-static bool
-DumpUTFBufferToStream (ConversionResult (*ConvertFunction) (const SourceDataType**,
-                                                            const SourceDataType*,
-                                                            UTF8**,
-                                                            UTF8*,
-                                                            ConversionFlags),
-                       const StringPrinter::ReadBufferAndDumpToStreamOptions& dump_options)
-{
-    Stream &stream(*dump_options.GetStream());
-    if (dump_options.GetPrefixToken() != 0)
-        stream.Printf("%s",dump_options.GetPrefixToken());
-    if (dump_options.GetQuote() != 0)
-        stream.Printf("%c",dump_options.GetQuote());
-    auto data(dump_options.GetData());
-    auto source_size(dump_options.GetSourceSize());
-    if (data.GetByteSize() && data.GetDataStart() && data.GetDataEnd())
-    {
-        const int bufferSPSize = data.GetByteSize();
-        if (dump_options.GetSourceSize() == 0)
-        {
-            const int origin_encoding = 8*sizeof(SourceDataType);
-            source_size = bufferSPSize/(origin_encoding / 4);
-        }
-        
-        const SourceDataType *data_ptr = (const SourceDataType*)data.GetDataStart();
-        const SourceDataType *data_end_ptr = data_ptr + source_size;
-        
-        const bool zero_is_terminator = dump_options.GetBinaryZeroIsTerminator();
-        
-        if (zero_is_terminator)
-        {
-            while (data_ptr < data_end_ptr)
-            {
-                if (!*data_ptr)
-                {
-                    data_end_ptr = data_ptr;
-                    break;
-                }
-                data_ptr++;
-            }
-            
-            data_ptr = (const SourceDataType*)data.GetDataStart();
-        }
-        
-        lldb::DataBufferSP utf8_data_buffer_sp;
-        UTF8* utf8_data_ptr = nullptr;
-        UTF8* utf8_data_end_ptr = nullptr;
-        
-        if (ConvertFunction)
-        {
-            utf8_data_buffer_sp.reset(new DataBufferHeap(4*bufferSPSize,0));
-            utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes();
-            utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize();
-            ConvertFunction ( &data_ptr, data_end_ptr, &utf8_data_ptr, utf8_data_end_ptr, lenientConversion );
-            if (false == zero_is_terminator)
-                utf8_data_end_ptr = utf8_data_ptr;
-            utf8_data_ptr = (UTF8*)utf8_data_buffer_sp->GetBytes(); // needed because the ConvertFunction will change the value of the data_ptr
-        }
-        else
-        {
-            // just copy the pointers - the cast is necessary to make the compiler happy
-            // but this should only happen if we are reading UTF8 data
-            utf8_data_ptr = const_cast<UTF8 *>(reinterpret_cast<const UTF8*>(data_ptr));
-            utf8_data_end_ptr = const_cast<UTF8 *>(reinterpret_cast<const UTF8*>(data_end_ptr));
-        }
-        
-        const bool escape_non_printables = dump_options.GetEscapeNonPrintables();
-        lldb_private::formatters::StringPrinter::EscapingHelper escaping_callback;
-        if (escape_non_printables)
-        {
-            if (Language *language = Language::FindPlugin(dump_options.GetLanguage()))
-                escaping_callback = language->GetStringPrinterEscapingHelper(lldb_private::formatters::StringPrinter::GetPrintableElementType::UTF8);
-            else
-                escaping_callback = lldb_private::formatters::StringPrinter::GetDefaultEscapingHelper(lldb_private::formatters::StringPrinter::GetPrintableElementType::UTF8);
-        }
-        
-        // since we tend to accept partial data (and even partially malformed data)
-        // we might end up with no NULL terminator before the end_ptr
-        // hence we need to take a slower route and ensure we stay within boundaries
-        for (;utf8_data_ptr < utf8_data_end_ptr;)
-        {
-            if (zero_is_terminator && !*utf8_data_ptr)
-                break;
-            
-            if (escape_non_printables)
-            {
-                uint8_t* next_data = nullptr;
-                auto printable = escaping_callback(utf8_data_ptr, utf8_data_end_ptr, next_data);
-                auto printable_bytes = printable.GetBytes();
-                auto printable_size = printable.GetSize();
-                if (!printable_bytes || !next_data)
-                {
-                    // GetPrintable() failed on us - print one byte in a desperate resync attempt
-                    printable_bytes = utf8_data_ptr;
-                    printable_size = 1;
-                    next_data = utf8_data_ptr+1;
-                }
-                for (unsigned c = 0; c < printable_size; c++)
-                    stream.Printf("%c", *(printable_bytes+c));
-                utf8_data_ptr = (uint8_t*)next_data;
-            }
-            else
-            {
-                stream.Printf("%c",*utf8_data_ptr);
-                utf8_data_ptr++;
-            }
-        }
-    }
-    if (dump_options.GetQuote() != 0)
-        stream.Printf("%c",dump_options.GetQuote());
-    if (dump_options.GetSuffixToken() != 0)
-        stream.Printf("%s",dump_options.GetSuffixToken());
-    if (dump_options.GetIsTruncated())
-        stream.Printf("...");
-    return true;
-}
-
-lldb_private::formatters::StringPrinter::ReadStringAndDumpToStreamOptions::ReadStringAndDumpToStreamOptions (ValueObject& valobj) :
-    ReadStringAndDumpToStreamOptions()
-{
-    SetEscapeNonPrintables(valobj.GetTargetSP()->GetDebugger().GetEscapeNonPrintables());
-}
-
-lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStreamOptions::ReadBufferAndDumpToStreamOptions (ValueObject& valobj) :
-    ReadBufferAndDumpToStreamOptions()
-{
-    SetEscapeNonPrintables(valobj.GetTargetSP()->GetDebugger().GetEscapeNonPrintables());
-}
-
-lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStreamOptions::ReadBufferAndDumpToStreamOptions (const ReadStringAndDumpToStreamOptions& options) :
-    ReadBufferAndDumpToStreamOptions()
-{
-    SetStream(options.GetStream());
-    SetPrefixToken(options.GetPrefixToken());
-    SetSuffixToken(options.GetSuffixToken());
-    SetQuote(options.GetQuote());
-    SetEscapeNonPrintables(options.GetEscapeNonPrintables());
-    SetBinaryZeroIsTerminator(options.GetBinaryZeroIsTerminator());
-    SetLanguage(options.GetLanguage());
-}
-
-
-namespace lldb_private
-{
-
-namespace formatters
-{
-
-template <>
-bool
-StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::ASCII> (const ReadStringAndDumpToStreamOptions& options)
-{
-    assert(options.GetStream() && "need a Stream to print the string to");
-    Error my_error;
-
-    ProcessSP process_sp(options.GetProcessSP());
-
-    if (process_sp.get() == nullptr || options.GetLocation() == 0)
-        return false;
-
-    size_t size;
-    const auto max_size = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
-    bool is_truncated = false;
-
-    if (options.GetSourceSize() == 0)
-        size = max_size;
-    else if (!options.GetIgnoreMaxLength())
-    {
-        size = options.GetSourceSize();
-        if (size > max_size)
-        {
-            size = max_size;
-            is_truncated = true;
-        }
+template <typename SourceDataType>
+static bool DumpUTFBufferToStream(
+    ConversionResult (*ConvertFunction)(const SourceDataType **,
+                                        const SourceDataType *, UTF8 **, UTF8 *,
+                                        ConversionFlags),
+    const StringPrinter::ReadBufferAndDumpToStreamOptions &dump_options) {
+  Stream &stream(*dump_options.GetStream());
+  if (dump_options.GetPrefixToken() != 0)
+    stream.Printf("%s", dump_options.GetPrefixToken());
+  if (dump_options.GetQuote() != 0)
+    stream.Printf("%c", dump_options.GetQuote());
+  auto data(dump_options.GetData());
+  auto source_size(dump_options.GetSourceSize());
+  if (data.GetByteSize() && data.GetDataStart() && data.GetDataEnd()) {
+    const int bufferSPSize = data.GetByteSize();
+    if (dump_options.GetSourceSize() == 0) {
+      const int origin_encoding = 8 * sizeof(SourceDataType);
+      source_size = bufferSPSize / (origin_encoding / 4);
+    }
+
+    const SourceDataType *data_ptr =
+        (const SourceDataType *)data.GetDataStart();
+    const SourceDataType *data_end_ptr = data_ptr + source_size;
+
+    const bool zero_is_terminator = dump_options.GetBinaryZeroIsTerminator();
+
+    if (zero_is_terminator) {
+      while (data_ptr < data_end_ptr) {
+        if (!*data_ptr) {
+          data_end_ptr = data_ptr;
+          break;
+        }
+        data_ptr++;
+      }
+
+      data_ptr = (const SourceDataType *)data.GetDataStart();
+    }
+
+    lldb::DataBufferSP utf8_data_buffer_sp;
+    UTF8 *utf8_data_ptr = nullptr;
+    UTF8 *utf8_data_end_ptr = nullptr;
+
+    if (ConvertFunction) {
+      utf8_data_buffer_sp.reset(new DataBufferHeap(4 * bufferSPSize, 0));
+      utf8_data_ptr = (UTF8 *)utf8_data_buffer_sp->GetBytes();
+      utf8_data_end_ptr = utf8_data_ptr + utf8_data_buffer_sp->GetByteSize();
+      ConvertFunction(&data_ptr, data_end_ptr, &utf8_data_ptr,
+                      utf8_data_end_ptr, lenientConversion);
+      if (false == zero_is_terminator)
+        utf8_data_end_ptr = utf8_data_ptr;
+      utf8_data_ptr =
+          (UTF8 *)utf8_data_buffer_sp->GetBytes(); // needed because the
+                                                   // ConvertFunction will
+                                                   // change the value of the
+                                                   // data_ptr
+    } else {
+      // just copy the pointers - the cast is necessary to make the compiler
+      // happy
+      // but this should only happen if we are reading UTF8 data
+      utf8_data_ptr =
+          const_cast<UTF8 *>(reinterpret_cast<const UTF8 *>(data_ptr));
+      utf8_data_end_ptr =
+          const_cast<UTF8 *>(reinterpret_cast<const UTF8 *>(data_end_ptr));
     }
-    else
-        size = options.GetSourceSize();
-
-    lldb::DataBufferSP buffer_sp(new DataBufferHeap(size,0));
-
-    process_sp->ReadCStringFromMemory(options.GetLocation(), (char*)buffer_sp->GetBytes(), size, my_error);
-
-    if (my_error.Fail())
-        return false;
-
-    const char* prefix_token = options.GetPrefixToken();
-    char quote = options.GetQuote();
-
-    if (prefix_token != 0)
-        options.GetStream()->Printf("%s%c",prefix_token,quote);
-    else if (quote != 0)
-        options.GetStream()->Printf("%c",quote);
 
-    uint8_t* data_end = buffer_sp->GetBytes()+buffer_sp->GetByteSize();
-
-    const bool escape_non_printables = options.GetEscapeNonPrintables();
+    const bool escape_non_printables = dump_options.GetEscapeNonPrintables();
     lldb_private::formatters::StringPrinter::EscapingHelper escaping_callback;
-    if (escape_non_printables)
-    {
-        if (Language *language = Language::FindPlugin(options.GetLanguage()))
-            escaping_callback = language->GetStringPrinterEscapingHelper(lldb_private::formatters::StringPrinter::GetPrintableElementType::ASCII);
-        else
-            escaping_callback = lldb_private::formatters::StringPrinter::GetDefaultEscapingHelper(lldb_private::formatters::StringPrinter::GetPrintableElementType::ASCII);
+    if (escape_non_printables) {
+      if (Language *language = Language::FindPlugin(dump_options.GetLanguage()))
+        escaping_callback = language->GetStringPrinterEscapingHelper(
+            lldb_private::formatters::StringPrinter::GetPrintableElementType::
+                UTF8);
+      else
+        escaping_callback =
+            lldb_private::formatters::StringPrinter::GetDefaultEscapingHelper(
+                lldb_private::formatters::StringPrinter::
+                    GetPrintableElementType::UTF8);
     }
-    
+
     // since we tend to accept partial data (and even partially malformed data)
     // we might end up with no NULL terminator before the end_ptr
     // hence we need to take a slower route and ensure we stay within boundaries
-    for (uint8_t* data = buffer_sp->GetBytes(); *data && (data < data_end);)
-    {
-        if (escape_non_printables)
-        {
-            uint8_t* next_data = nullptr;
-            auto printable = escaping_callback(data, data_end, next_data);
-            auto printable_bytes = printable.GetBytes();
-            auto printable_size = printable.GetSize();
-            if (!printable_bytes || !next_data)
-            {
-                // GetPrintable() failed on us - print one byte in a desperate resync attempt
-                printable_bytes = data;
-                printable_size = 1;
-                next_data = data+1;
-            }
-            for (unsigned c = 0; c < printable_size; c++)
-                options.GetStream()->Printf("%c", *(printable_bytes+c));
-            data = (uint8_t*)next_data;
-        }
-        else
-        {
-            options.GetStream()->Printf("%c",*data);
-            data++;
-        }
-    }
-    
-    const char* suffix_token = options.GetSuffixToken();
-    
-    if (suffix_token != 0)
-        options.GetStream()->Printf("%c%s",quote, suffix_token);
-    else if (quote != 0)
-        options.GetStream()->Printf("%c",quote);
-
-    if (is_truncated)
-        options.GetStream()->Printf("...");
-    
-    return true;
+    for (; utf8_data_ptr < utf8_data_end_ptr;) {
+      if (zero_is_terminator && !*utf8_data_ptr)
+        break;
+
+      if (escape_non_printables) {
+        uint8_t *next_data = nullptr;
+        auto printable =
+            escaping_callback(utf8_data_ptr, utf8_data_end_ptr, next_data);
+        auto printable_bytes = printable.GetBytes();
+        auto printable_size = printable.GetSize();
+        if (!printable_bytes || !next_data) {
+          // GetPrintable() failed on us - print one byte in a desperate resync
+          // attempt
+          printable_bytes = utf8_data_ptr;
+          printable_size = 1;
+          next_data = utf8_data_ptr + 1;
+        }
+        for (unsigned c = 0; c < printable_size; c++)
+          stream.Printf("%c", *(printable_bytes + c));
+        utf8_data_ptr = (uint8_t *)next_data;
+      } else {
+        stream.Printf("%c", *utf8_data_ptr);
+        utf8_data_ptr++;
+      }
+    }
+  }
+  if (dump_options.GetQuote() != 0)
+    stream.Printf("%c", dump_options.GetQuote());
+  if (dump_options.GetSuffixToken() != 0)
+    stream.Printf("%s", dump_options.GetSuffixToken());
+  if (dump_options.GetIsTruncated())
+    stream.Printf("...");
+  return true;
+}
+
+lldb_private::formatters::StringPrinter::ReadStringAndDumpToStreamOptions::
+    ReadStringAndDumpToStreamOptions(ValueObject &valobj)
+    : ReadStringAndDumpToStreamOptions() {
+  SetEscapeNonPrintables(
+      valobj.GetTargetSP()->GetDebugger().GetEscapeNonPrintables());
+}
+
+lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStreamOptions::
+    ReadBufferAndDumpToStreamOptions(ValueObject &valobj)
+    : ReadBufferAndDumpToStreamOptions() {
+  SetEscapeNonPrintables(
+      valobj.GetTargetSP()->GetDebugger().GetEscapeNonPrintables());
+}
+
+lldb_private::formatters::StringPrinter::ReadBufferAndDumpToStreamOptions::
+    ReadBufferAndDumpToStreamOptions(
+        const ReadStringAndDumpToStreamOptions &options)
+    : ReadBufferAndDumpToStreamOptions() {
+  SetStream(options.GetStream());
+  SetPrefixToken(options.GetPrefixToken());
+  SetSuffixToken(options.GetSuffixToken());
+  SetQuote(options.GetQuote());
+  SetEscapeNonPrintables(options.GetEscapeNonPrintables());
+  SetBinaryZeroIsTerminator(options.GetBinaryZeroIsTerminator());
+  SetLanguage(options.GetLanguage());
 }
 
-template<typename SourceDataType>
-static bool
-ReadUTFBufferAndDumpToStream (const StringPrinter::ReadStringAndDumpToStreamOptions& options,
-                              ConversionResult (*ConvertFunction) (const SourceDataType**,
-                                                                   const SourceDataType*,
-                                                                   UTF8**,
-                                                                   UTF8*,
-                                                                   ConversionFlags))
-{
-    assert(options.GetStream() && "need a Stream to print the string to");
-
-    if (options.GetLocation() == 0 || options.GetLocation() == LLDB_INVALID_ADDRESS)
-        return false;
-
-    lldb::ProcessSP process_sp(options.GetProcessSP());
-
-    if (!process_sp)
-        return false;
-
-    const int type_width = sizeof(SourceDataType);
-    const int origin_encoding = 8 * type_width ;
-    if (origin_encoding != 8 && origin_encoding != 16 && origin_encoding != 32)
-        return false;
-    // if not UTF8, I need a conversion function to return proper UTF8
-    if (origin_encoding != 8 && !ConvertFunction)
-        return false;
-
-    if (!options.GetStream())
-        return false;
-
-    uint32_t sourceSize = options.GetSourceSize();
-    bool needs_zero_terminator = options.GetNeedsZeroTermination();
-    
-    bool is_truncated = false;
-    const auto max_size = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
-
-    if (!sourceSize)
-    {
-        sourceSize = max_size;
-        needs_zero_terminator = true;
-    }
-    else if (!options.GetIgnoreMaxLength())
-    {
-        if (sourceSize > max_size)
-        {
-            sourceSize = max_size;
-            is_truncated = true;
-        }
-    }
-
-    const int bufferSPSize = sourceSize * type_width;
-
-    lldb::DataBufferSP buffer_sp(new DataBufferHeap(bufferSPSize,0));
-
-    if (!buffer_sp->GetBytes())
-        return false;
+namespace lldb_private {
 
-    Error error;
-    char *buffer = reinterpret_cast<char *>(buffer_sp->GetBytes());
+namespace formatters {
 
-    if (needs_zero_terminator)
-        process_sp->ReadStringFromMemory(options.GetLocation(), buffer, bufferSPSize, error, type_width);
+template <>
+bool StringPrinter::ReadStringAndDumpToStream<
+    StringPrinter::StringElementType::ASCII>(
+    const ReadStringAndDumpToStreamOptions &options) {
+  assert(options.GetStream() && "need a Stream to print the string to");
+  Error my_error;
+
+  ProcessSP process_sp(options.GetProcessSP());
+
+  if (process_sp.get() == nullptr || options.GetLocation() == 0)
+    return false;
+
+  size_t size;
+  const auto max_size = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
+  bool is_truncated = false;
+
+  if (options.GetSourceSize() == 0)
+    size = max_size;
+  else if (!options.GetIgnoreMaxLength()) {
+    size = options.GetSourceSize();
+    if (size > max_size) {
+      size = max_size;
+      is_truncated = true;
+    }
+  } else
+    size = options.GetSourceSize();
+
+  lldb::DataBufferSP buffer_sp(new DataBufferHeap(size, 0));
+
+  process_sp->ReadCStringFromMemory(
+      options.GetLocation(), (char *)buffer_sp->GetBytes(), size, my_error);
+
+  if (my_error.Fail())
+    return false;
+
+  const char *prefix_token = options.GetPrefixToken();
+  char quote = options.GetQuote();
+
+  if (prefix_token != 0)
+    options.GetStream()->Printf("%s%c", prefix_token, quote);
+  else if (quote != 0)
+    options.GetStream()->Printf("%c", quote);
+
+  uint8_t *data_end = buffer_sp->GetBytes() + buffer_sp->GetByteSize();
+
+  const bool escape_non_printables = options.GetEscapeNonPrintables();
+  lldb_private::formatters::StringPrinter::EscapingHelper escaping_callback;
+  if (escape_non_printables) {
+    if (Language *language = Language::FindPlugin(options.GetLanguage()))
+      escaping_callback = language->GetStringPrinterEscapingHelper(
+          lldb_private::formatters::StringPrinter::GetPrintableElementType::
+              ASCII);
     else
-        process_sp->ReadMemoryFromInferior(options.GetLocation(), (char*)buffer_sp->GetBytes(), bufferSPSize, error);
+      escaping_callback =
+          lldb_private::formatters::StringPrinter::GetDefaultEscapingHelper(
+              lldb_private::formatters::StringPrinter::GetPrintableElementType::
+                  ASCII);
+  }
+
+  // since we tend to accept partial data (and even partially malformed data)
+  // we might end up with no NULL terminator before the end_ptr
+  // hence we need to take a slower route and ensure we stay within boundaries
+  for (uint8_t *data = buffer_sp->GetBytes(); *data && (data < data_end);) {
+    if (escape_non_printables) {
+      uint8_t *next_data = nullptr;
+      auto printable = escaping_callback(data, data_end, next_data);
+      auto printable_bytes = printable.GetBytes();
+      auto printable_size = printable.GetSize();
+      if (!printable_bytes || !next_data) {
+        // GetPrintable() failed on us - print one byte in a desperate resync
+        // attempt
+        printable_bytes = data;
+        printable_size = 1;
+        next_data = data + 1;
+      }
+      for (unsigned c = 0; c < printable_size; c++)
+        options.GetStream()->Printf("%c", *(printable_bytes + c));
+      data = (uint8_t *)next_data;
+    } else {
+      options.GetStream()->Printf("%c", *data);
+      data++;
+    }
+  }
+
+  const char *suffix_token = options.GetSuffixToken();
+
+  if (suffix_token != 0)
+    options.GetStream()->Printf("%c%s", quote, suffix_token);
+  else if (quote != 0)
+    options.GetStream()->Printf("%c", quote);
+
+  if (is_truncated)
+    options.GetStream()->Printf("...");
+
+  return true;
+}
+
+template <typename SourceDataType>
+static bool ReadUTFBufferAndDumpToStream(
+    const StringPrinter::ReadStringAndDumpToStreamOptions &options,
+    ConversionResult (*ConvertFunction)(const SourceDataType **,
+                                        const SourceDataType *, UTF8 **, UTF8 *,
+                                        ConversionFlags)) {
+  assert(options.GetStream() && "need a Stream to print the string to");
+
+  if (options.GetLocation() == 0 ||
+      options.GetLocation() == LLDB_INVALID_ADDRESS)
+    return false;
+
+  lldb::ProcessSP process_sp(options.GetProcessSP());
+
+  if (!process_sp)
+    return false;
+
+  const int type_width = sizeof(SourceDataType);
+  const int origin_encoding = 8 * type_width;
+  if (origin_encoding != 8 && origin_encoding != 16 && origin_encoding != 32)
+    return false;
+  // if not UTF8, I need a conversion function to return proper UTF8
+  if (origin_encoding != 8 && !ConvertFunction)
+    return false;
+
+  if (!options.GetStream())
+    return false;
+
+  uint32_t sourceSize = options.GetSourceSize();
+  bool needs_zero_terminator = options.GetNeedsZeroTermination();
+
+  bool is_truncated = false;
+  const auto max_size = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
+
+  if (!sourceSize) {
+    sourceSize = max_size;
+    needs_zero_terminator = true;
+  } else if (!options.GetIgnoreMaxLength()) {
+    if (sourceSize > max_size) {
+      sourceSize = max_size;
+      is_truncated = true;
+    }
+  }
+
+  const int bufferSPSize = sourceSize * type_width;
+
+  lldb::DataBufferSP buffer_sp(new DataBufferHeap(bufferSPSize, 0));
+
+  if (!buffer_sp->GetBytes())
+    return false;
+
+  Error error;
+  char *buffer = reinterpret_cast<char *>(buffer_sp->GetBytes());
+
+  if (needs_zero_terminator)
+    process_sp->ReadStringFromMemory(options.GetLocation(), buffer,
+                                     bufferSPSize, error, type_width);
+  else
+    process_sp->ReadMemoryFromInferior(options.GetLocation(),
+                                       (char *)buffer_sp->GetBytes(),
+                                       bufferSPSize, error);
 
-    if (error.Fail())
-    {
-        options.GetStream()->Printf("unable to read data");
-        return true;
-    }
+  if (error.Fail()) {
+    options.GetStream()->Printf("unable to read data");
+    return true;
+  }
+
+  DataExtractor data(buffer_sp, process_sp->GetByteOrder(),
+                     process_sp->GetAddressByteSize());
 
-    DataExtractor data(buffer_sp, process_sp->GetByteOrder(), process_sp->GetAddressByteSize());
-    
-    StringPrinter::ReadBufferAndDumpToStreamOptions dump_options(options);
-    dump_options.SetData(data);
-    dump_options.SetSourceSize(sourceSize);
-    dump_options.SetIsTruncated(is_truncated);
+  StringPrinter::ReadBufferAndDumpToStreamOptions dump_options(options);
+  dump_options.SetData(data);
+  dump_options.SetSourceSize(sourceSize);
+  dump_options.SetIsTruncated(is_truncated);
 
-    return DumpUTFBufferToStream(ConvertFunction, dump_options);
+  return DumpUTFBufferToStream(ConvertFunction, dump_options);
 }
 
 template <>
-bool
-StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::UTF8> (const ReadStringAndDumpToStreamOptions& options)
-{
-    return ReadUTFBufferAndDumpToStream<UTF8>(options,
-                                              nullptr);
+bool StringPrinter::ReadStringAndDumpToStream<
+    StringPrinter::StringElementType::UTF8>(
+    const ReadStringAndDumpToStreamOptions &options) {
+  return ReadUTFBufferAndDumpToStream<UTF8>(options, nullptr);
 }
 
 template <>
-bool
-StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::UTF16> (const ReadStringAndDumpToStreamOptions& options)
-{
-    return ReadUTFBufferAndDumpToStream<UTF16>(options,
-                                               ConvertUTF16toUTF8);
+bool StringPrinter::ReadStringAndDumpToStream<
+    StringPrinter::StringElementType::UTF16>(
+    const ReadStringAndDumpToStreamOptions &options) {
+  return ReadUTFBufferAndDumpToStream<UTF16>(options, ConvertUTF16toUTF8);
 }
 
 template <>
-bool
-StringPrinter::ReadStringAndDumpToStream<StringPrinter::StringElementType::UTF32> (const ReadStringAndDumpToStreamOptions& options)
-{
-    return ReadUTFBufferAndDumpToStream<UTF32>(options,
-                                               ConvertUTF32toUTF8);
+bool StringPrinter::ReadStringAndDumpToStream<
+    StringPrinter::StringElementType::UTF32>(
+    const ReadStringAndDumpToStreamOptions &options) {
+  return ReadUTFBufferAndDumpToStream<UTF32>(options, ConvertUTF32toUTF8);
 }
 
 template <>
-bool
-StringPrinter::ReadBufferAndDumpToStream<StringPrinter::StringElementType::UTF8> (const ReadBufferAndDumpToStreamOptions& options)
-{
-    assert(options.GetStream() && "need a Stream to print the string to");
+bool StringPrinter::ReadBufferAndDumpToStream<
+    StringPrinter::StringElementType::UTF8>(
+    const ReadBufferAndDumpToStreamOptions &options) {
+  assert(options.GetStream() && "need a Stream to print the string to");
 
-    return DumpUTFBufferToStream<UTF8>(nullptr, options);
+  return DumpUTFBufferToStream<UTF8>(nullptr, options);
 }
 
 template <>
-bool
-StringPrinter::ReadBufferAndDumpToStream<StringPrinter::StringElementType::ASCII> (const ReadBufferAndDumpToStreamOptions& options)
-{
-    // treat ASCII the same as UTF8
-    // FIXME: can we optimize ASCII some more?
-    return ReadBufferAndDumpToStream<StringElementType::UTF8>(options);
+bool StringPrinter::ReadBufferAndDumpToStream<
+    StringPrinter::StringElementType::ASCII>(
+    const ReadBufferAndDumpToStreamOptions &options) {
+  // treat ASCII the same as UTF8
+  // FIXME: can we optimize ASCII some more?
+  return ReadBufferAndDumpToStream<StringElementType::UTF8>(options);
 }
 
 template <>
-bool
-StringPrinter::ReadBufferAndDumpToStream<StringPrinter::StringElementType::UTF16> (const ReadBufferAndDumpToStreamOptions& options)
-{
-    assert(options.GetStream() && "need a Stream to print the string to");
+bool StringPrinter::ReadBufferAndDumpToStream<
+    StringPrinter::StringElementType::UTF16>(
+    const ReadBufferAndDumpToStreamOptions &options) {
+  assert(options.GetStream() && "need a Stream to print the string to");
 
-    return DumpUTFBufferToStream(ConvertUTF16toUTF8, options);
+  return DumpUTFBufferToStream(ConvertUTF16toUTF8, options);
 }
 
 template <>
-bool
-StringPrinter::ReadBufferAndDumpToStream<StringPrinter::StringElementType::UTF32> (const ReadBufferAndDumpToStreamOptions& options)
-{
-    assert(options.GetStream() && "need a Stream to print the string to");
+bool StringPrinter::ReadBufferAndDumpToStream<
+    StringPrinter::StringElementType::UTF32>(
+    const ReadBufferAndDumpToStreamOptions &options) {
+  assert(options.GetStream() && "need a Stream to print the string to");
 
-    return DumpUTFBufferToStream(ConvertUTF32toUTF8, options);
+  return DumpUTFBufferToStream(ConvertUTF32toUTF8, options);
 }
 
 } // namespace formatters

Modified: lldb/trunk/source/DataFormatters/TypeCategory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeCategory.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeCategory.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeCategory.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- TypeCategory.cpp -------------------------------------------*- C++ -*-===//
+//===-- TypeCategory.cpp -------------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -18,690 +19,626 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeCategoryImpl::TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
-                                   std::initializer_list<lldb::LanguageType> langs)
+TypeCategoryImpl::TypeCategoryImpl(
+    IFormatChangeListener *clist, ConstString name,
+    std::initializer_list<lldb::LanguageType> langs)
     : m_format_cont("format", "regex-format", clist),
       m_summary_cont("summary", "regex-summary", clist),
       m_filter_cont("filter", "regex-filter", clist),
 #ifndef LLDB_DISABLE_PYTHON
       m_synth_cont("synth", "regex-synth", clist),
 #endif
-      m_validator_cont("validator", "regex-validator", clist),
-      m_enabled(false),
-      m_change_listener(clist),
-      m_mutex(),
-      m_name(name),
-      m_languages()
-{
-    for (const lldb::LanguageType lang : langs)
-        AddLanguage(lang);
-}
-
-static bool
-IsApplicable(lldb::LanguageType category_lang,
-             lldb::LanguageType valobj_lang)
-{
-    switch (category_lang)
-    {
-            // these are not languages that LLDB would ordinarily deal with
-            // only allow an exact equality here, since we really don't know
-            // any better
-        case eLanguageTypeAda83:
-        case eLanguageTypeCobol74:
-        case eLanguageTypeCobol85:
-        case eLanguageTypeFortran77:
-        case eLanguageTypeFortran90:
-        case eLanguageTypePascal83:
-        case eLanguageTypeModula2:
-        case eLanguageTypeJava:
-        case eLanguageTypeAda95:
-        case eLanguageTypeFortran95:
-        case eLanguageTypePLI:
-        case eLanguageTypeUPC:
-        case eLanguageTypeD:
-        case eLanguageTypePython:
-            return category_lang == valobj_lang;
-            
-            // the C family, we consider it as one
-        case eLanguageTypeC89:
-        case eLanguageTypeC:
-        case eLanguageTypeC99:
-            return valobj_lang == eLanguageTypeC89 ||
-            valobj_lang == eLanguageTypeC ||
-            valobj_lang == eLanguageTypeC99;
-            
-            // ObjC knows about C and itself
-        case eLanguageTypeObjC:
-            return valobj_lang == eLanguageTypeC89 ||
-            valobj_lang == eLanguageTypeC ||
-            valobj_lang == eLanguageTypeC99 ||
-            valobj_lang == eLanguageTypeObjC;
-            
-            // C++ knows about C and C++
-        case eLanguageTypeC_plus_plus:
-            return valobj_lang == eLanguageTypeC89 ||
-            valobj_lang == eLanguageTypeC ||
-            valobj_lang == eLanguageTypeC99 ||
-            valobj_lang == eLanguageTypeC_plus_plus;
-            
-            // ObjC++ knows about C,C++,ObjC and ObjC++
-        case eLanguageTypeObjC_plus_plus:
-            return valobj_lang == eLanguageTypeC89 ||
-            valobj_lang == eLanguageTypeC ||
-            valobj_lang == eLanguageTypeC99 ||
-            valobj_lang == eLanguageTypeC_plus_plus ||
-            valobj_lang == eLanguageTypeObjC;
-            
-        default:
-        case eLanguageTypeUnknown:
-            return true;
-    }
+      m_validator_cont("validator", "regex-validator", clist), m_enabled(false),
+      m_change_listener(clist), m_mutex(), m_name(name), m_languages() {
+  for (const lldb::LanguageType lang : langs)
+    AddLanguage(lang);
+}
+
+static bool IsApplicable(lldb::LanguageType category_lang,
+                         lldb::LanguageType valobj_lang) {
+  switch (category_lang) {
+  // these are not languages that LLDB would ordinarily deal with
+  // only allow an exact equality here, since we really don't know
+  // any better
+  case eLanguageTypeAda83:
+  case eLanguageTypeCobol74:
+  case eLanguageTypeCobol85:
+  case eLanguageTypeFortran77:
+  case eLanguageTypeFortran90:
+  case eLanguageTypePascal83:
+  case eLanguageTypeModula2:
+  case eLanguageTypeJava:
+  case eLanguageTypeAda95:
+  case eLanguageTypeFortran95:
+  case eLanguageTypePLI:
+  case eLanguageTypeUPC:
+  case eLanguageTypeD:
+  case eLanguageTypePython:
+    return category_lang == valobj_lang;
+
+  // the C family, we consider it as one
+  case eLanguageTypeC89:
+  case eLanguageTypeC:
+  case eLanguageTypeC99:
+    return valobj_lang == eLanguageTypeC89 || valobj_lang == eLanguageTypeC ||
+           valobj_lang == eLanguageTypeC99;
+
+  // ObjC knows about C and itself
+  case eLanguageTypeObjC:
+    return valobj_lang == eLanguageTypeC89 || valobj_lang == eLanguageTypeC ||
+           valobj_lang == eLanguageTypeC99 || valobj_lang == eLanguageTypeObjC;
+
+  // C++ knows about C and C++
+  case eLanguageTypeC_plus_plus:
+    return valobj_lang == eLanguageTypeC89 || valobj_lang == eLanguageTypeC ||
+           valobj_lang == eLanguageTypeC99 ||
+           valobj_lang == eLanguageTypeC_plus_plus;
+
+  // ObjC++ knows about C,C++,ObjC and ObjC++
+  case eLanguageTypeObjC_plus_plus:
+    return valobj_lang == eLanguageTypeC89 || valobj_lang == eLanguageTypeC ||
+           valobj_lang == eLanguageTypeC99 ||
+           valobj_lang == eLanguageTypeC_plus_plus ||
+           valobj_lang == eLanguageTypeObjC;
+
+  default:
+  case eLanguageTypeUnknown:
+    return true;
+  }
+}
+
+bool TypeCategoryImpl::IsApplicable(ValueObject &valobj) {
+  lldb::LanguageType valobj_lang = valobj.GetObjectRuntimeLanguage();
+  for (size_t idx = 0; idx < GetNumLanguages(); idx++) {
+    const lldb::LanguageType category_lang = GetLanguageAtIndex(idx);
+    if (::IsApplicable(category_lang, valobj_lang))
+      return true;
+  }
+  return false;
+}
+
+size_t TypeCategoryImpl::GetNumLanguages() {
+  if (m_languages.empty())
+    return 1;
+  return m_languages.size();
+}
+
+lldb::LanguageType TypeCategoryImpl::GetLanguageAtIndex(size_t idx) {
+  if (m_languages.empty())
+    return lldb::eLanguageTypeUnknown;
+  return m_languages[idx];
+}
+
+void TypeCategoryImpl::AddLanguage(lldb::LanguageType lang) {
+  m_languages.push_back(lang);
+}
+
+bool TypeCategoryImpl::HasLanguage(lldb::LanguageType lang) {
+  const auto iter = std::find(m_languages.begin(), m_languages.end(), lang),
+             end = m_languages.end();
+  return (iter != end);
+}
+
+bool TypeCategoryImpl::Get(ValueObject &valobj,
+                           const FormattersMatchVector &candidates,
+                           lldb::TypeFormatImplSP &entry, uint32_t *reason) {
+  if (!IsEnabled() || !IsApplicable(valobj))
+    return false;
+  if (GetTypeFormatsContainer()->Get(candidates, entry, reason))
+    return true;
+  bool regex = GetRegexTypeFormatsContainer()->Get(candidates, entry, reason);
+  if (regex && reason)
+    *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
+  return regex;
 }
 
-bool
-TypeCategoryImpl::IsApplicable (ValueObject& valobj)
-{
-    lldb::LanguageType valobj_lang = valobj.GetObjectRuntimeLanguage();
-    for (size_t idx = 0;
-         idx < GetNumLanguages();
-         idx++)
-    {
-        const lldb::LanguageType category_lang = GetLanguageAtIndex(idx);
-        if (::IsApplicable(category_lang,valobj_lang))
-            return true;
-    }
+bool TypeCategoryImpl::Get(ValueObject &valobj,
+                           const FormattersMatchVector &candidates,
+                           lldb::TypeSummaryImplSP &entry, uint32_t *reason) {
+  if (!IsEnabled() || !IsApplicable(valobj))
     return false;
+  if (GetTypeSummariesContainer()->Get(candidates, entry, reason))
+    return true;
+  bool regex = GetRegexTypeSummariesContainer()->Get(candidates, entry, reason);
+  if (regex && reason)
+    *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
+  return regex;
 }
 
-size_t
-TypeCategoryImpl::GetNumLanguages ()
-{
-    if (m_languages.empty())
-        return 1;
-    return m_languages.size();
-}
-
-lldb::LanguageType
-TypeCategoryImpl::GetLanguageAtIndex (size_t idx)
-{
-    if (m_languages.empty())
-        return lldb::eLanguageTypeUnknown;
-    return m_languages[idx];
-}
-
-void
-TypeCategoryImpl::AddLanguage (lldb::LanguageType lang)
-{
-    m_languages.push_back(lang);
-}
-
-bool
-TypeCategoryImpl::HasLanguage (lldb::LanguageType lang)
-{
-    const auto iter = std::find(m_languages.begin(), m_languages.end(), lang),
-               end = m_languages.end();
-    return (iter != end);
-}
-
-bool
-TypeCategoryImpl::Get (ValueObject& valobj,
-                       const FormattersMatchVector& candidates,
-                       lldb::TypeFormatImplSP& entry,
-                       uint32_t* reason)
-{
-    if (!IsEnabled() || !IsApplicable(valobj))
-        return false;
-    if (GetTypeFormatsContainer()->Get(candidates, entry, reason))
-        return true;
-    bool regex = GetRegexTypeFormatsContainer()->Get(candidates, entry, reason);
-    if (regex && reason)
-        *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
-    return regex;
-}
-
-bool
-TypeCategoryImpl::Get (ValueObject& valobj,
-                       const FormattersMatchVector& candidates,
-                       lldb::TypeSummaryImplSP& entry,
-                       uint32_t* reason)
-{
-    if (!IsEnabled() || !IsApplicable(valobj))
-        return false;
-    if (GetTypeSummariesContainer()->Get(candidates, entry, reason))
-        return true;
-    bool regex = GetRegexTypeSummariesContainer()->Get(candidates, entry, reason);
-    if (regex && reason)
-        *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
-    return regex;
-}
-
-bool
-TypeCategoryImpl::Get (ValueObject& valobj,
-                       const FormattersMatchVector& candidates,
-                       lldb::SyntheticChildrenSP& entry,
-                       uint32_t* reason)
-{
-    if (!IsEnabled() || !IsApplicable(valobj))
-        return false;
-    TypeFilterImpl::SharedPointer filter_sp;
-    uint32_t reason_filter = 0;
-    bool regex_filter = false;
-    // first find both Filter and Synth, and then check which is most recent
-    
-    if (!GetTypeFiltersContainer()->Get(candidates, filter_sp, &reason_filter))
-        regex_filter = GetRegexTypeFiltersContainer()->Get (candidates, filter_sp, &reason_filter);
-    
+bool TypeCategoryImpl::Get(ValueObject &valobj,
+                           const FormattersMatchVector &candidates,
+                           lldb::SyntheticChildrenSP &entry, uint32_t *reason) {
+  if (!IsEnabled() || !IsApplicable(valobj))
+    return false;
+  TypeFilterImpl::SharedPointer filter_sp;
+  uint32_t reason_filter = 0;
+  bool regex_filter = false;
+  // first find both Filter and Synth, and then check which is most recent
+
+  if (!GetTypeFiltersContainer()->Get(candidates, filter_sp, &reason_filter))
+    regex_filter = GetRegexTypeFiltersContainer()->Get(candidates, filter_sp,
+                                                       &reason_filter);
+
 #ifndef LLDB_DISABLE_PYTHON
-    bool regex_synth = false;
-    uint32_t reason_synth = 0;
-    bool pick_synth = false;
-    ScriptedSyntheticChildren::SharedPointer synth;
-    if (!GetTypeSyntheticsContainer()->Get(candidates, synth, &reason_synth))
-        regex_synth = GetRegexTypeSyntheticsContainer()->Get (candidates, synth, &reason_synth);
-    if (!filter_sp.get() && !synth.get())
-        return false;
-    else if (!filter_sp.get() && synth.get())
-        pick_synth = true;
-    
-    else if (filter_sp.get() && !synth.get())
-        pick_synth = false;
-    
-    else /*if (filter_sp.get() && synth.get())*/
-    {
-        if (filter_sp->GetRevision() > synth->GetRevision())
-            pick_synth = false;
-        else
-            pick_synth = true;
-    }
-    if (pick_synth)
-    {
-        if (regex_synth && reason)
-            *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
-        entry = synth;
-        return true;
-    }
-    else
-    {
-        if (regex_filter && reason)
-            *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
-        entry = filter_sp;
-        return true;
-    }
-    
+  bool regex_synth = false;
+  uint32_t reason_synth = 0;
+  bool pick_synth = false;
+  ScriptedSyntheticChildren::SharedPointer synth;
+  if (!GetTypeSyntheticsContainer()->Get(candidates, synth, &reason_synth))
+    regex_synth = GetRegexTypeSyntheticsContainer()->Get(candidates, synth,
+                                                         &reason_synth);
+  if (!filter_sp.get() && !synth.get())
+    return false;
+  else if (!filter_sp.get() && synth.get())
+    pick_synth = true;
+
+  else if (filter_sp.get() && !synth.get())
+    pick_synth = false;
+
+  else /*if (filter_sp.get() && synth.get())*/
+  {
+    if (filter_sp->GetRevision() > synth->GetRevision())
+      pick_synth = false;
+    else
+      pick_synth = true;
+  }
+  if (pick_synth) {
+    if (regex_synth && reason)
+      *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
+    entry = synth;
+    return true;
+  } else {
+    if (regex_filter && reason)
+      *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionFilter;
+    entry = filter_sp;
+    return true;
+  }
+
 #else
-    if (filter_sp)
-    {
-        entry = filter_sp;
-        return true;
-    }
+  if (filter_sp) {
+    entry = filter_sp;
+    return true;
+  }
 #endif
-    
-    return false;
+
+  return false;
 }
 
-bool
-TypeCategoryImpl::Get (ValueObject& valobj,
-                       const FormattersMatchVector& candidates,
-                       lldb::TypeValidatorImplSP& entry,
-                       uint32_t* reason)
-{
-    if (!IsEnabled())
-        return false;
-    if (GetTypeValidatorsContainer()->Get(candidates, entry, reason))
-        return true;
-    bool regex = GetRegexTypeValidatorsContainer()->Get(candidates, entry, reason);
-    if (regex && reason)
-        *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
-    return regex;
-}
-
-void
-TypeCategoryImpl::Clear (FormatCategoryItems items)
-{
-    if ( (items & eFormatCategoryItemValue)  == eFormatCategoryItemValue )
-        GetTypeFormatsContainer()->Clear();
-    if ( (items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue )
-        GetRegexTypeFormatsContainer()->Clear();
-
-    if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
-        GetTypeSummariesContainer()->Clear();
-    if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
-        GetRegexTypeSummariesContainer()->Clear();
-
-    if ( (items & eFormatCategoryItemFilter)  == eFormatCategoryItemFilter )
-        GetTypeFiltersContainer()->Clear();
-    if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
-        GetRegexTypeFiltersContainer()->Clear();
+bool TypeCategoryImpl::Get(ValueObject &valobj,
+                           const FormattersMatchVector &candidates,
+                           lldb::TypeValidatorImplSP &entry, uint32_t *reason) {
+  if (!IsEnabled())
+    return false;
+  if (GetTypeValidatorsContainer()->Get(candidates, entry, reason))
+    return true;
+  bool regex =
+      GetRegexTypeValidatorsContainer()->Get(candidates, entry, reason);
+  if (regex && reason)
+    *reason |= lldb_private::eFormatterChoiceCriterionRegularExpressionSummary;
+  return regex;
+}
+
+void TypeCategoryImpl::Clear(FormatCategoryItems items) {
+  if ((items & eFormatCategoryItemValue) == eFormatCategoryItemValue)
+    GetTypeFormatsContainer()->Clear();
+  if ((items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue)
+    GetRegexTypeFormatsContainer()->Clear();
+
+  if ((items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary)
+    GetTypeSummariesContainer()->Clear();
+  if ((items & eFormatCategoryItemRegexSummary) ==
+      eFormatCategoryItemRegexSummary)
+    GetRegexTypeSummariesContainer()->Clear();
+
+  if ((items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter)
+    GetTypeFiltersContainer()->Clear();
+  if ((items & eFormatCategoryItemRegexFilter) ==
+      eFormatCategoryItemRegexFilter)
+    GetRegexTypeFiltersContainer()->Clear();
 
 #ifndef LLDB_DISABLE_PYTHON
-    if ( (items & eFormatCategoryItemSynth)  == eFormatCategoryItemSynth )
-        GetTypeSyntheticsContainer()->Clear();
-    if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
-        GetRegexTypeSyntheticsContainer()->Clear();
+  if ((items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth)
+    GetTypeSyntheticsContainer()->Clear();
+  if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
+    GetRegexTypeSyntheticsContainer()->Clear();
 #endif
-    
-    if ( (items & eFormatCategoryItemValidator)  == eFormatCategoryItemValidator )
-        GetTypeValidatorsContainer()->Clear();
-    if ( (items & eFormatCategoryItemRegexValidator) == eFormatCategoryItemRegexValidator )
-        GetRegexTypeValidatorsContainer()->Clear();
-}
-
-bool
-TypeCategoryImpl::Delete (ConstString name,
-                          FormatCategoryItems items)
-{
-    bool success = false;
-    
-    if ( (items & eFormatCategoryItemValue)  == eFormatCategoryItemValue )
-        success = GetTypeFormatsContainer()->Delete(name) || success;
-    if ( (items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue )
-        success = GetRegexTypeFormatsContainer()->Delete(name) || success;
-
-    if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
-        success = GetTypeSummariesContainer()->Delete(name) || success;
-    if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
-        success = GetRegexTypeSummariesContainer()->Delete(name) || success;
-
-    if ( (items & eFormatCategoryItemFilter)  == eFormatCategoryItemFilter )
-        success = GetTypeFiltersContainer()->Delete(name) || success;
-    if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
-        success = GetRegexTypeFiltersContainer()->Delete(name) || success;
+
+  if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
+    GetTypeValidatorsContainer()->Clear();
+  if ((items & eFormatCategoryItemRegexValidator) ==
+      eFormatCategoryItemRegexValidator)
+    GetRegexTypeValidatorsContainer()->Clear();
+}
+
+bool TypeCategoryImpl::Delete(ConstString name, FormatCategoryItems items) {
+  bool success = false;
+
+  if ((items & eFormatCategoryItemValue) == eFormatCategoryItemValue)
+    success = GetTypeFormatsContainer()->Delete(name) || success;
+  if ((items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue)
+    success = GetRegexTypeFormatsContainer()->Delete(name) || success;
+
+  if ((items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary)
+    success = GetTypeSummariesContainer()->Delete(name) || success;
+  if ((items & eFormatCategoryItemRegexSummary) ==
+      eFormatCategoryItemRegexSummary)
+    success = GetRegexTypeSummariesContainer()->Delete(name) || success;
+
+  if ((items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter)
+    success = GetTypeFiltersContainer()->Delete(name) || success;
+  if ((items & eFormatCategoryItemRegexFilter) ==
+      eFormatCategoryItemRegexFilter)
+    success = GetRegexTypeFiltersContainer()->Delete(name) || success;
 
 #ifndef LLDB_DISABLE_PYTHON
-    if ( (items & eFormatCategoryItemSynth)  == eFormatCategoryItemSynth )
-        success = GetTypeSyntheticsContainer()->Delete(name) || success;
-    if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
-        success = GetRegexTypeSyntheticsContainer()->Delete(name) || success;
+  if ((items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth)
+    success = GetTypeSyntheticsContainer()->Delete(name) || success;
+  if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
+    success = GetRegexTypeSyntheticsContainer()->Delete(name) || success;
 #endif
-    
-    if ( (items & eFormatCategoryItemValidator)  == eFormatCategoryItemValidator )
-        success = GetTypeValidatorsContainer()->Delete(name) || success;
-    if ( (items & eFormatCategoryItemRegexValidator) == eFormatCategoryItemRegexValidator )
-        success = GetRegexTypeValidatorsContainer()->Delete(name) || success;
-    
-    return success;
-}
-
-uint32_t
-TypeCategoryImpl::GetCount (FormatCategoryItems items)
-{
-    uint32_t count = 0;
-
-    if ( (items & eFormatCategoryItemValue) == eFormatCategoryItemValue )
-        count += GetTypeFormatsContainer()->GetCount();
-    if ( (items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue )
-        count += GetRegexTypeFormatsContainer()->GetCount();
-    
-    if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
-        count += GetTypeSummariesContainer()->GetCount();
-    if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
-        count += GetRegexTypeSummariesContainer()->GetCount();
-
-    if ( (items & eFormatCategoryItemFilter)  == eFormatCategoryItemFilter )
-        count += GetTypeFiltersContainer()->GetCount();
-    if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
-        count += GetRegexTypeFiltersContainer()->GetCount();
+
+  if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
+    success = GetTypeValidatorsContainer()->Delete(name) || success;
+  if ((items & eFormatCategoryItemRegexValidator) ==
+      eFormatCategoryItemRegexValidator)
+    success = GetRegexTypeValidatorsContainer()->Delete(name) || success;
+
+  return success;
+}
+
+uint32_t TypeCategoryImpl::GetCount(FormatCategoryItems items) {
+  uint32_t count = 0;
+
+  if ((items & eFormatCategoryItemValue) == eFormatCategoryItemValue)
+    count += GetTypeFormatsContainer()->GetCount();
+  if ((items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue)
+    count += GetRegexTypeFormatsContainer()->GetCount();
+
+  if ((items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary)
+    count += GetTypeSummariesContainer()->GetCount();
+  if ((items & eFormatCategoryItemRegexSummary) ==
+      eFormatCategoryItemRegexSummary)
+    count += GetRegexTypeSummariesContainer()->GetCount();
+
+  if ((items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter)
+    count += GetTypeFiltersContainer()->GetCount();
+  if ((items & eFormatCategoryItemRegexFilter) ==
+      eFormatCategoryItemRegexFilter)
+    count += GetRegexTypeFiltersContainer()->GetCount();
 
 #ifndef LLDB_DISABLE_PYTHON
-    if ( (items & eFormatCategoryItemSynth)  == eFormatCategoryItemSynth )
-        count += GetTypeSyntheticsContainer()->GetCount();
-    if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
-        count += GetRegexTypeSyntheticsContainer()->GetCount();
+  if ((items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth)
+    count += GetTypeSyntheticsContainer()->GetCount();
+  if ((items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth)
+    count += GetRegexTypeSyntheticsContainer()->GetCount();
 #endif
-    
-    if ( (items & eFormatCategoryItemValidator)  == eFormatCategoryItemValidator )
-        count += GetTypeValidatorsContainer()->GetCount();
-    if ( (items & eFormatCategoryItemRegexValidator) == eFormatCategoryItemRegexValidator )
-        count += GetRegexTypeValidatorsContainer()->GetCount();
-    
-    return count;
-}
-
-bool
-TypeCategoryImpl::AnyMatches(ConstString type_name,
-                             FormatCategoryItems items,
-                             bool only_enabled,
-                             const char** matching_category,
-                             FormatCategoryItems* matching_type)
-{
-    if (!IsEnabled() && only_enabled)
-        return false;
-    
-    lldb::TypeFormatImplSP format_sp;
-    lldb::TypeSummaryImplSP summary_sp;
-    TypeFilterImpl::SharedPointer filter_sp;
+
+  if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator)
+    count += GetTypeValidatorsContainer()->GetCount();
+  if ((items & eFormatCategoryItemRegexValidator) ==
+      eFormatCategoryItemRegexValidator)
+    count += GetRegexTypeValidatorsContainer()->GetCount();
+
+  return count;
+}
+
+bool TypeCategoryImpl::AnyMatches(ConstString type_name,
+                                  FormatCategoryItems items, bool only_enabled,
+                                  const char **matching_category,
+                                  FormatCategoryItems *matching_type) {
+  if (!IsEnabled() && only_enabled)
+    return false;
+
+  lldb::TypeFormatImplSP format_sp;
+  lldb::TypeSummaryImplSP summary_sp;
+  TypeFilterImpl::SharedPointer filter_sp;
 #ifndef LLDB_DISABLE_PYTHON
-    ScriptedSyntheticChildren::SharedPointer synth_sp;
+  ScriptedSyntheticChildren::SharedPointer synth_sp;
 #endif
-    TypeValidatorImpl::SharedPointer validator_sp;
-    
-    if ( (items & eFormatCategoryItemValue) == eFormatCategoryItemValue )
-    {
-        if (GetTypeFormatsContainer()->Get(type_name, format_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemValue;
-            return true;
-        }
-    }
-    if ( (items & eFormatCategoryItemRegexValue) == eFormatCategoryItemRegexValue )
-    {
-        if (GetRegexTypeFormatsContainer()->Get(type_name, format_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemRegexValue;
-            return true;
-        }
-    }
-    
-    if ( (items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary )
-    {
-        if (GetTypeSummariesContainer()->Get(type_name, summary_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemSummary;
-            return true;
-        }
-    }
-    if ( (items & eFormatCategoryItemRegexSummary) == eFormatCategoryItemRegexSummary )
-    {
-        if (GetRegexTypeSummariesContainer()->Get(type_name, summary_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemRegexSummary;
-            return true;
-        }
-    }
-    
-    if ( (items & eFormatCategoryItemFilter)  == eFormatCategoryItemFilter )
-    {
-        if (GetTypeFiltersContainer()->Get(type_name, filter_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemFilter;
-            return true;
-        }
-    }
-    if ( (items & eFormatCategoryItemRegexFilter) == eFormatCategoryItemRegexFilter )
-    {
-        if (GetRegexTypeFiltersContainer()->Get(type_name, filter_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemRegexFilter;
-            return true;
-        }
+  TypeValidatorImpl::SharedPointer validator_sp;
+
+  if ((items & eFormatCategoryItemValue) == eFormatCategoryItemValue) {
+    if (GetTypeFormatsContainer()->Get(type_name, format_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemValue;
+      return true;
+    }
+  }
+  if ((items & eFormatCategoryItemRegexValue) ==
+      eFormatCategoryItemRegexValue) {
+    if (GetRegexTypeFormatsContainer()->Get(type_name, format_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemRegexValue;
+      return true;
+    }
+  }
+
+  if ((items & eFormatCategoryItemSummary) == eFormatCategoryItemSummary) {
+    if (GetTypeSummariesContainer()->Get(type_name, summary_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemSummary;
+      return true;
+    }
+  }
+  if ((items & eFormatCategoryItemRegexSummary) ==
+      eFormatCategoryItemRegexSummary) {
+    if (GetRegexTypeSummariesContainer()->Get(type_name, summary_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemRegexSummary;
+      return true;
+    }
+  }
+
+  if ((items & eFormatCategoryItemFilter) == eFormatCategoryItemFilter) {
+    if (GetTypeFiltersContainer()->Get(type_name, filter_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemFilter;
+      return true;
+    }
+  }
+  if ((items & eFormatCategoryItemRegexFilter) ==
+      eFormatCategoryItemRegexFilter) {
+    if (GetRegexTypeFiltersContainer()->Get(type_name, filter_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemRegexFilter;
+      return true;
     }
-    
+  }
+
 #ifndef LLDB_DISABLE_PYTHON
-    if ( (items & eFormatCategoryItemSynth)  == eFormatCategoryItemSynth )
-    {
-        if (GetTypeSyntheticsContainer()->Get(type_name, synth_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemSynth;
-            return true;
-        }
-    }
-    if ( (items & eFormatCategoryItemRegexSynth) == eFormatCategoryItemRegexSynth )
-    {
-        if (GetRegexTypeSyntheticsContainer()->Get(type_name, synth_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemRegexSynth;
-            return true;
-        }
+  if ((items & eFormatCategoryItemSynth) == eFormatCategoryItemSynth) {
+    if (GetTypeSyntheticsContainer()->Get(type_name, synth_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemSynth;
+      return true;
+    }
+  }
+  if ((items & eFormatCategoryItemRegexSynth) ==
+      eFormatCategoryItemRegexSynth) {
+    if (GetRegexTypeSyntheticsContainer()->Get(type_name, synth_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemRegexSynth;
+      return true;
     }
+  }
 #endif
-    
-    if ( (items & eFormatCategoryItemValidator)  == eFormatCategoryItemValidator )
-    {
-        if (GetTypeValidatorsContainer()->Get(type_name, validator_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemValidator;
-            return true;
-        }
-    }
-    if ( (items & eFormatCategoryItemRegexValidator) == eFormatCategoryItemRegexValidator )
-    {
-        if (GetRegexTypeValidatorsContainer()->Get(type_name, validator_sp))
-        {
-            if (matching_category)
-                *matching_category = m_name.GetCString();
-            if (matching_type)
-                *matching_type = eFormatCategoryItemRegexValidator;
-            return true;
-        }
+
+  if ((items & eFormatCategoryItemValidator) == eFormatCategoryItemValidator) {
+    if (GetTypeValidatorsContainer()->Get(type_name, validator_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemValidator;
+      return true;
+    }
+  }
+  if ((items & eFormatCategoryItemRegexValidator) ==
+      eFormatCategoryItemRegexValidator) {
+    if (GetRegexTypeValidatorsContainer()->Get(type_name, validator_sp)) {
+      if (matching_category)
+        *matching_category = m_name.GetCString();
+      if (matching_type)
+        *matching_type = eFormatCategoryItemRegexValidator;
+      return true;
     }
-    
-    return false;
+  }
+
+  return false;
 }
 
 TypeCategoryImpl::FormatContainer::MapValueType
-TypeCategoryImpl::GetFormatForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    FormatContainer::MapValueType retval;
-    
-    if (type_sp)
-    {
-        if (type_sp->IsRegex())
-            GetRegexTypeFormatsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-        else
-            GetTypeFormatsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-    }
-    
-    return retval;
+TypeCategoryImpl::GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  FormatContainer::MapValueType retval;
+
+  if (type_sp) {
+    if (type_sp->IsRegex())
+      GetRegexTypeFormatsContainer()->GetExact(ConstString(type_sp->GetName()),
+                                               retval);
+    else
+      GetTypeFormatsContainer()->GetExact(ConstString(type_sp->GetName()),
+                                          retval);
+  }
+
+  return retval;
 }
 
 TypeCategoryImpl::SummaryContainer::MapValueType
-TypeCategoryImpl::GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    SummaryContainer::MapValueType retval;
-    
-    if (type_sp)
-    {
-        if (type_sp->IsRegex())
-            GetRegexTypeSummariesContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-        else
-            GetTypeSummariesContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-    }
-    
-    return retval;
+TypeCategoryImpl::GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  SummaryContainer::MapValueType retval;
+
+  if (type_sp) {
+    if (type_sp->IsRegex())
+      GetRegexTypeSummariesContainer()->GetExact(
+          ConstString(type_sp->GetName()), retval);
+    else
+      GetTypeSummariesContainer()->GetExact(ConstString(type_sp->GetName()),
+                                            retval);
+  }
+
+  return retval;
 }
 
 TypeCategoryImpl::FilterContainer::MapValueType
-TypeCategoryImpl::GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    FilterContainer::MapValueType retval;
-    
-    if (type_sp)
-    {
-        if (type_sp->IsRegex())
-            GetRegexTypeFiltersContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-        else
-            GetTypeFiltersContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-    }
-    
-    return retval;
+TypeCategoryImpl::GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  FilterContainer::MapValueType retval;
+
+  if (type_sp) {
+    if (type_sp->IsRegex())
+      GetRegexTypeFiltersContainer()->GetExact(ConstString(type_sp->GetName()),
+                                               retval);
+    else
+      GetTypeFiltersContainer()->GetExact(ConstString(type_sp->GetName()),
+                                          retval);
+  }
+
+  return retval;
 }
 
 #ifndef LLDB_DISABLE_PYTHON
 TypeCategoryImpl::SynthContainer::MapValueType
-TypeCategoryImpl::GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    SynthContainer::MapValueType retval;
-    
-    if (type_sp)
-    {
-        if (type_sp->IsRegex())
-            GetRegexTypeSyntheticsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-        else
-            GetTypeSyntheticsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-    }
-    
-    return retval;
+TypeCategoryImpl::GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  SynthContainer::MapValueType retval;
+
+  if (type_sp) {
+    if (type_sp->IsRegex())
+      GetRegexTypeSyntheticsContainer()->GetExact(
+          ConstString(type_sp->GetName()), retval);
+    else
+      GetTypeSyntheticsContainer()->GetExact(ConstString(type_sp->GetName()),
+                                             retval);
+  }
+
+  return retval;
 }
 #endif
 
 TypeCategoryImpl::ValidatorContainer::MapValueType
-TypeCategoryImpl::GetValidatorForType (lldb::TypeNameSpecifierImplSP type_sp)
-{
-    ValidatorContainer::MapValueType retval;
-    
-    if (type_sp)
-    {
-        if (type_sp->IsRegex())
-            GetRegexTypeValidatorsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-        else
-            GetTypeValidatorsContainer()->GetExact(ConstString(type_sp->GetName()),retval);
-    }
-    
-    return retval;
+TypeCategoryImpl::GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp) {
+  ValidatorContainer::MapValueType retval;
+
+  if (type_sp) {
+    if (type_sp->IsRegex())
+      GetRegexTypeValidatorsContainer()->GetExact(
+          ConstString(type_sp->GetName()), retval);
+    else
+      GetTypeValidatorsContainer()->GetExact(ConstString(type_sp->GetName()),
+                                             retval);
+  }
+
+  return retval;
 }
 
 lldb::TypeNameSpecifierImplSP
-TypeCategoryImpl::GetTypeNameSpecifierForSummaryAtIndex (size_t index)
-{
-    if (index < GetTypeSummariesContainer()->GetCount())
-        return GetTypeSummariesContainer()->GetTypeNameSpecifierAtIndex(index);
-    else
-        return GetRegexTypeSummariesContainer()->GetTypeNameSpecifierAtIndex(index-GetTypeSummariesContainer()->GetCount());
+TypeCategoryImpl::GetTypeNameSpecifierForSummaryAtIndex(size_t index) {
+  if (index < GetTypeSummariesContainer()->GetCount())
+    return GetTypeSummariesContainer()->GetTypeNameSpecifierAtIndex(index);
+  else
+    return GetRegexTypeSummariesContainer()->GetTypeNameSpecifierAtIndex(
+        index - GetTypeSummariesContainer()->GetCount());
 }
 
 TypeCategoryImpl::FormatContainer::MapValueType
-TypeCategoryImpl::GetFormatAtIndex (size_t index)
-{
-    if (index < GetTypeFormatsContainer()->GetCount())
-        return GetTypeFormatsContainer()->GetAtIndex(index);
-    else
-        return GetRegexTypeFormatsContainer()->GetAtIndex(index-GetTypeFormatsContainer()->GetCount());
+TypeCategoryImpl::GetFormatAtIndex(size_t index) {
+  if (index < GetTypeFormatsContainer()->GetCount())
+    return GetTypeFormatsContainer()->GetAtIndex(index);
+  else
+    return GetRegexTypeFormatsContainer()->GetAtIndex(
+        index - GetTypeFormatsContainer()->GetCount());
 }
 
 TypeCategoryImpl::SummaryContainer::MapValueType
-TypeCategoryImpl::GetSummaryAtIndex (size_t index)
-{
-    if (index < GetTypeSummariesContainer()->GetCount())
-        return GetTypeSummariesContainer()->GetAtIndex(index);
-    else
-        return GetRegexTypeSummariesContainer()->GetAtIndex(index-GetTypeSummariesContainer()->GetCount());
+TypeCategoryImpl::GetSummaryAtIndex(size_t index) {
+  if (index < GetTypeSummariesContainer()->GetCount())
+    return GetTypeSummariesContainer()->GetAtIndex(index);
+  else
+    return GetRegexTypeSummariesContainer()->GetAtIndex(
+        index - GetTypeSummariesContainer()->GetCount());
 }
 
 TypeCategoryImpl::FilterContainer::MapValueType
-TypeCategoryImpl::GetFilterAtIndex (size_t index)
-{
-    if (index < GetTypeFiltersContainer()->GetCount())
-        return GetTypeFiltersContainer()->GetAtIndex(index);
-    else
-        return GetRegexTypeFiltersContainer()->GetAtIndex(index-GetTypeFiltersContainer()->GetCount());
+TypeCategoryImpl::GetFilterAtIndex(size_t index) {
+  if (index < GetTypeFiltersContainer()->GetCount())
+    return GetTypeFiltersContainer()->GetAtIndex(index);
+  else
+    return GetRegexTypeFiltersContainer()->GetAtIndex(
+        index - GetTypeFiltersContainer()->GetCount());
 }
 
 lldb::TypeNameSpecifierImplSP
-TypeCategoryImpl::GetTypeNameSpecifierForFormatAtIndex (size_t index)
-{
-    if (index < GetTypeFormatsContainer()->GetCount())
-        return GetTypeFormatsContainer()->GetTypeNameSpecifierAtIndex(index);
-    else
-        return GetRegexTypeFormatsContainer()->GetTypeNameSpecifierAtIndex(index-GetTypeFormatsContainer()->GetCount());
+TypeCategoryImpl::GetTypeNameSpecifierForFormatAtIndex(size_t index) {
+  if (index < GetTypeFormatsContainer()->GetCount())
+    return GetTypeFormatsContainer()->GetTypeNameSpecifierAtIndex(index);
+  else
+    return GetRegexTypeFormatsContainer()->GetTypeNameSpecifierAtIndex(
+        index - GetTypeFormatsContainer()->GetCount());
 }
 
 lldb::TypeNameSpecifierImplSP
-TypeCategoryImpl::GetTypeNameSpecifierForFilterAtIndex (size_t index)
-{
-    if (index < GetTypeFiltersContainer()->GetCount())
-        return GetTypeFiltersContainer()->GetTypeNameSpecifierAtIndex(index);
-    else
-        return GetRegexTypeFiltersContainer()->GetTypeNameSpecifierAtIndex(index-GetTypeFiltersContainer()->GetCount());
+TypeCategoryImpl::GetTypeNameSpecifierForFilterAtIndex(size_t index) {
+  if (index < GetTypeFiltersContainer()->GetCount())
+    return GetTypeFiltersContainer()->GetTypeNameSpecifierAtIndex(index);
+  else
+    return GetRegexTypeFiltersContainer()->GetTypeNameSpecifierAtIndex(
+        index - GetTypeFiltersContainer()->GetCount());
 }
 
 #ifndef LLDB_DISABLE_PYTHON
 TypeCategoryImpl::SynthContainer::MapValueType
-TypeCategoryImpl::GetSyntheticAtIndex (size_t index)
-{
-    if (index < GetTypeSyntheticsContainer()->GetCount())
-        return GetTypeSyntheticsContainer()->GetAtIndex(index);
-    else
-        return GetRegexTypeSyntheticsContainer()->GetAtIndex(index-GetTypeSyntheticsContainer()->GetCount());
+TypeCategoryImpl::GetSyntheticAtIndex(size_t index) {
+  if (index < GetTypeSyntheticsContainer()->GetCount())
+    return GetTypeSyntheticsContainer()->GetAtIndex(index);
+  else
+    return GetRegexTypeSyntheticsContainer()->GetAtIndex(
+        index - GetTypeSyntheticsContainer()->GetCount());
 }
 
 lldb::TypeNameSpecifierImplSP
-TypeCategoryImpl::GetTypeNameSpecifierForSyntheticAtIndex (size_t index)
-{
-    if (index < GetTypeSyntheticsContainer()->GetCount())
-        return GetTypeSyntheticsContainer()->GetTypeNameSpecifierAtIndex(index);
-    else
-        return GetRegexTypeSyntheticsContainer()->GetTypeNameSpecifierAtIndex(index - GetTypeSyntheticsContainer()->GetCount());
+TypeCategoryImpl::GetTypeNameSpecifierForSyntheticAtIndex(size_t index) {
+  if (index < GetTypeSyntheticsContainer()->GetCount())
+    return GetTypeSyntheticsContainer()->GetTypeNameSpecifierAtIndex(index);
+  else
+    return GetRegexTypeSyntheticsContainer()->GetTypeNameSpecifierAtIndex(
+        index - GetTypeSyntheticsContainer()->GetCount());
 }
 #endif
 
 TypeCategoryImpl::ValidatorContainer::MapValueType
-TypeCategoryImpl::GetValidatorAtIndex (size_t index)
-{
-    if (index < GetTypeValidatorsContainer()->GetCount())
-        return GetTypeValidatorsContainer()->GetAtIndex(index);
-    else
-        return GetRegexTypeValidatorsContainer()->GetAtIndex(index-GetTypeValidatorsContainer()->GetCount());
+TypeCategoryImpl::GetValidatorAtIndex(size_t index) {
+  if (index < GetTypeValidatorsContainer()->GetCount())
+    return GetTypeValidatorsContainer()->GetAtIndex(index);
+  else
+    return GetRegexTypeValidatorsContainer()->GetAtIndex(
+        index - GetTypeValidatorsContainer()->GetCount());
 }
 
 lldb::TypeNameSpecifierImplSP
-TypeCategoryImpl::GetTypeNameSpecifierForValidatorAtIndex (size_t index)
-{
-    if (index < GetTypeValidatorsContainer()->GetCount())
-        return GetTypeValidatorsContainer()->GetTypeNameSpecifierAtIndex(index);
-    else
-        return GetRegexTypeValidatorsContainer()->GetTypeNameSpecifierAtIndex(index - GetTypeValidatorsContainer()->GetCount());
-}
-
-void
-TypeCategoryImpl::Enable (bool value, uint32_t position)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    if ( (m_enabled = value) )
-        m_enabled_position = position;
-    if (m_change_listener)
-        m_change_listener->Changed();
-}
-
-std::string
-TypeCategoryImpl::GetDescription ()
-{
-    StreamString stream;
-    stream.Printf("%s (%s",
-                  GetName(),
-                  (IsEnabled() ? "enabled" : "disabled"));
-    StreamString lang_stream;
-    lang_stream.Printf(", applicable for language(s): ");
-    bool print_lang = false;
-    for (size_t idx = 0;
-         idx < GetNumLanguages();
-         idx++)
-    {
-        const lldb::LanguageType lang = GetLanguageAtIndex(idx);
-        if (lang != lldb::eLanguageTypeUnknown)
-            print_lang = true;
-        lang_stream.Printf("%s%s",
-                           Language::GetNameForLanguageType(lang),
-                           idx+1<GetNumLanguages() ? ", " : "");
-    }
-    if (print_lang)
-        stream.Printf("%s",lang_stream.GetData());
-    stream.PutChar(')');
-    return stream.GetData();
+TypeCategoryImpl::GetTypeNameSpecifierForValidatorAtIndex(size_t index) {
+  if (index < GetTypeValidatorsContainer()->GetCount())
+    return GetTypeValidatorsContainer()->GetTypeNameSpecifierAtIndex(index);
+  else
+    return GetRegexTypeValidatorsContainer()->GetTypeNameSpecifierAtIndex(
+        index - GetTypeValidatorsContainer()->GetCount());
+}
+
+void TypeCategoryImpl::Enable(bool value, uint32_t position) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  if ((m_enabled = value))
+    m_enabled_position = position;
+  if (m_change_listener)
+    m_change_listener->Changed();
+}
+
+std::string TypeCategoryImpl::GetDescription() {
+  StreamString stream;
+  stream.Printf("%s (%s", GetName(), (IsEnabled() ? "enabled" : "disabled"));
+  StreamString lang_stream;
+  lang_stream.Printf(", applicable for language(s): ");
+  bool print_lang = false;
+  for (size_t idx = 0; idx < GetNumLanguages(); idx++) {
+    const lldb::LanguageType lang = GetLanguageAtIndex(idx);
+    if (lang != lldb::eLanguageTypeUnknown)
+      print_lang = true;
+    lang_stream.Printf("%s%s", Language::GetNameForLanguageType(lang),
+                       idx + 1 < GetNumLanguages() ? ", " : "");
+  }
+  if (print_lang)
+    stream.Printf("%s", lang_stream.GetData());
+  stream.PutChar(')');
+  return stream.GetData();
 }

Modified: lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeCategoryMap.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- TypeCategoryMap.cpp ----------------------------------------*- C++ -*-===//
+//===-- TypeCategoryMap.cpp ----------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -21,401 +22,361 @@ using namespace lldb;
 using namespace lldb_private;
 
 TypeCategoryMap::TypeCategoryMap(IFormatChangeListener *lst)
-    : m_map_mutex(), listener(lst), m_map(), m_active_categories()
-{
-    ConstString default_cs("default");
-    lldb::TypeCategoryImplSP default_sp = lldb::TypeCategoryImplSP(new TypeCategoryImpl(listener, default_cs));
-    Add(default_cs, default_sp);
-    Enable(default_cs, First);
-}
-
-void
-TypeCategoryMap::Add (KeyType name, const ValueSP& entry)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    m_map[name] = entry;
-    if (listener)
-        listener->Changed();
-}
-
-bool
-TypeCategoryMap::Delete (KeyType name)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    MapIterator iter = m_map.find(name);
-    if (iter == m_map.end())
-        return false;
-    m_map.erase(name);
-    Disable(name);
-    if (listener)
-        listener->Changed();
-    return true;
-}
-
-bool
-TypeCategoryMap::Enable (KeyType category_name, Position pos)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    ValueSP category;
-    if (!Get(category_name,category))
-        return false;
-    return Enable(category, pos);
-}
-
-bool
-TypeCategoryMap::Disable (KeyType category_name)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    ValueSP category;
-    if (!Get(category_name,category))
-        return false;
-    return Disable(category);
-}
-
-bool
-TypeCategoryMap::Enable (ValueSP category, Position pos)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    if (category.get())
-    {
-        Position pos_w = pos;
-        if (pos == First || m_active_categories.size() == 0)
-            m_active_categories.push_front(category);
-        else if (pos == Last || pos == m_active_categories.size())
-            m_active_categories.push_back(category);
-        else if (pos < m_active_categories.size())
-        {
-            ActiveCategoriesList::iterator iter = m_active_categories.begin();
-            while (pos_w)
-            {
-                pos_w--,iter++;
-            }
-            m_active_categories.insert(iter,category);
-        }
-        else
-            return false;
-        category->Enable(true,
-                         pos);
-        return true;
-    }
+    : m_map_mutex(), listener(lst), m_map(), m_active_categories() {
+  ConstString default_cs("default");
+  lldb::TypeCategoryImplSP default_sp =
+      lldb::TypeCategoryImplSP(new TypeCategoryImpl(listener, default_cs));
+  Add(default_cs, default_sp);
+  Enable(default_cs, First);
+}
+
+void TypeCategoryMap::Add(KeyType name, const ValueSP &entry) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  m_map[name] = entry;
+  if (listener)
+    listener->Changed();
+}
+
+bool TypeCategoryMap::Delete(KeyType name) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  MapIterator iter = m_map.find(name);
+  if (iter == m_map.end())
     return false;
+  m_map.erase(name);
+  Disable(name);
+  if (listener)
+    listener->Changed();
+  return true;
 }
 
-bool
-TypeCategoryMap::Disable (ValueSP category)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    if (category.get())
-    {
-        m_active_categories.remove_if(delete_matching_categories(category));
-        category->Disable();
-        return true;
-    }
+bool TypeCategoryMap::Enable(KeyType category_name, Position pos) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  ValueSP category;
+  if (!Get(category_name, category))
     return false;
+  return Enable(category, pos);
 }
 
-void
-TypeCategoryMap::EnableAllCategories ()
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    std::vector<ValueSP> sorted_categories(m_map.size(), ValueSP());
-    MapType::iterator iter = m_map.begin(), end = m_map.end();
-    for (; iter != end; ++iter)
-    {
-        if (iter->second->IsEnabled())
-            continue;
-        auto pos = iter->second->GetLastEnabledPosition();
-        if (pos >= sorted_categories.size())
-        {
-            auto iter = std::find_if(sorted_categories.begin(),
-                                     sorted_categories.end(),
-                                     [] (const ValueSP& sp) -> bool {
-                                         return sp.get() == nullptr;
-                                     });
-            pos = std::distance(sorted_categories.begin(), iter);
-        }
-        sorted_categories.at(pos) = iter->second;
-    }
-    decltype(sorted_categories)::iterator viter = sorted_categories.begin(), vend = sorted_categories.end();
-    for (; viter != vend; viter++)
-        if (viter->get())
-            Enable(*viter, Last);
-}
-
-void
-TypeCategoryMap::DisableAllCategories ()
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    Position p = First;
-    for (; false == m_active_categories.empty(); p++)
-    {
-        m_active_categories.front()->SetEnabledPosition(p);
-        Disable(m_active_categories.front());
-    }
+bool TypeCategoryMap::Disable(KeyType category_name) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  ValueSP category;
+  if (!Get(category_name, category))
+    return false;
+  return Disable(category);
 }
 
-void
-TypeCategoryMap::Clear ()
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    m_map.clear();
-    m_active_categories.clear();
-    if (listener)
-        listener->Changed();
+bool TypeCategoryMap::Enable(ValueSP category, Position pos) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  if (category.get()) {
+    Position pos_w = pos;
+    if (pos == First || m_active_categories.size() == 0)
+      m_active_categories.push_front(category);
+    else if (pos == Last || pos == m_active_categories.size())
+      m_active_categories.push_back(category);
+    else if (pos < m_active_categories.size()) {
+      ActiveCategoriesList::iterator iter = m_active_categories.begin();
+      while (pos_w) {
+        pos_w--, iter++;
+      }
+      m_active_categories.insert(iter, category);
+    } else
+      return false;
+    category->Enable(true, pos);
+    return true;
+  }
+  return false;
 }
 
-bool
-TypeCategoryMap::Get (KeyType name, ValueSP& entry)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    MapIterator iter = m_map.find(name);
-    if (iter == m_map.end())
-        return false;
-    entry = iter->second;
+bool TypeCategoryMap::Disable(ValueSP category) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  if (category.get()) {
+    m_active_categories.remove_if(delete_matching_categories(category));
+    category->Disable();
     return true;
+  }
+  return false;
 }
 
-bool
-TypeCategoryMap::Get (uint32_t pos, ValueSP& entry)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-    MapIterator iter = m_map.begin();
-    MapIterator end = m_map.end();
-    while (pos > 0)
-    {
-        iter++;
-        pos--;
-        if (iter == end)
-            return false;
-    }
-    entry = iter->second;
+void TypeCategoryMap::EnableAllCategories() {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  std::vector<ValueSP> sorted_categories(m_map.size(), ValueSP());
+  MapType::iterator iter = m_map.begin(), end = m_map.end();
+  for (; iter != end; ++iter) {
+    if (iter->second->IsEnabled())
+      continue;
+    auto pos = iter->second->GetLastEnabledPosition();
+    if (pos >= sorted_categories.size()) {
+      auto iter = std::find_if(
+          sorted_categories.begin(), sorted_categories.end(),
+          [](const ValueSP &sp) -> bool { return sp.get() == nullptr; });
+      pos = std::distance(sorted_categories.begin(), iter);
+    }
+    sorted_categories.at(pos) = iter->second;
+  }
+  decltype(sorted_categories)::iterator viter = sorted_categories.begin(),
+                                        vend = sorted_categories.end();
+  for (; viter != vend; viter++)
+    if (viter->get())
+      Enable(*viter, Last);
+}
+
+void TypeCategoryMap::DisableAllCategories() {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  Position p = First;
+  for (; false == m_active_categories.empty(); p++) {
+    m_active_categories.front()->SetEnabledPosition(p);
+    Disable(m_active_categories.front());
+  }
+}
+
+void TypeCategoryMap::Clear() {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  m_map.clear();
+  m_active_categories.clear();
+  if (listener)
+    listener->Changed();
+}
+
+bool TypeCategoryMap::Get(KeyType name, ValueSP &entry) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  MapIterator iter = m_map.find(name);
+  if (iter == m_map.end())
     return false;
+  entry = iter->second;
+  return true;
 }
 
-bool
-TypeCategoryMap::AnyMatches (ConstString type_name,
-                             TypeCategoryImpl::FormatCategoryItems items,
-                             bool only_enabled,
-                             const char** matching_category,
-                             TypeCategoryImpl::FormatCategoryItems* matching_type)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
-
-    MapIterator pos, end = m_map.end();
-    for (pos = m_map.begin(); pos != end; pos++)
-    {
-        if (pos->second->AnyMatches(type_name,
-                                    items,
-                                    only_enabled,
-                                    matching_category,
-                                    matching_type))
-            return true;
-    }
-    return false;
+bool TypeCategoryMap::Get(uint32_t pos, ValueSP &entry) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+  MapIterator iter = m_map.begin();
+  MapIterator end = m_map.end();
+  while (pos > 0) {
+    iter++;
+    pos--;
+    if (iter == end)
+      return false;
+  }
+  entry = iter->second;
+  return false;
+}
+
+bool TypeCategoryMap::AnyMatches(
+    ConstString type_name, TypeCategoryImpl::FormatCategoryItems items,
+    bool only_enabled, const char **matching_category,
+    TypeCategoryImpl::FormatCategoryItems *matching_type) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
+  MapIterator pos, end = m_map.end();
+  for (pos = m_map.begin(); pos != end; pos++) {
+    if (pos->second->AnyMatches(type_name, items, only_enabled,
+                                matching_category, matching_type))
+      return true;
+  }
+  return false;
 }
 
 lldb::TypeFormatImplSP
-TypeCategoryMap::GetFormat (FormattersMatchData& match_data)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+TypeCategoryMap::GetFormat(FormattersMatchData &match_data) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
 
-    uint32_t reason_why;
-    ActiveCategoriesIterator begin, end = m_active_categories.end();
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    
-    if (log)
-    {
-        for (auto match : match_data.GetMatchesVector())
-        {
-            log->Printf("[CategoryMap::GetFormat] candidate match = %s %s %s %s reason = %" PRIu32,
-                        match.GetTypeName().GetCString(),
-                        match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
-                        match.DidStripReference() ? "strip-reference" : "no-strip-reference",
-                        match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
-                        match.GetReason());
-        }
-    }
+  uint32_t reason_why;
+  ActiveCategoriesIterator begin, end = m_active_categories.end();
 
-    for (begin = m_active_categories.begin(); begin != end; begin++)
-    {
-        lldb::TypeCategoryImplSP category_sp = *begin;
-        lldb::TypeFormatImplSP current_format;
-        if (log)
-            log->Printf("[TypeCategoryMap::GetFormat] Trying to use category %s", category_sp->GetName());
-        if (!category_sp->Get(match_data.GetValueObject(), match_data.GetMatchesVector(), current_format, &reason_why))
-            continue;
-        return current_format;
-    }
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+
+  if (log) {
+    for (auto match : match_data.GetMatchesVector()) {
+      log->Printf(
+          "[CategoryMap::GetFormat] candidate match = %s %s %s %s reason = "
+          "%" PRIu32,
+          match.GetTypeName().GetCString(),
+          match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
+          match.DidStripReference() ? "strip-reference" : "no-strip-reference",
+          match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
+          match.GetReason());
+    }
+  }
+
+  for (begin = m_active_categories.begin(); begin != end; begin++) {
+    lldb::TypeCategoryImplSP category_sp = *begin;
+    lldb::TypeFormatImplSP current_format;
     if (log)
-        log->Printf("[TypeCategoryMap::GetFormat] nothing found - returning empty SP");
-    return lldb::TypeFormatImplSP();
+      log->Printf("[TypeCategoryMap::GetFormat] Trying to use category %s",
+                  category_sp->GetName());
+    if (!category_sp->Get(match_data.GetValueObject(),
+                          match_data.GetMatchesVector(), current_format,
+                          &reason_why))
+      continue;
+    return current_format;
+  }
+  if (log)
+    log->Printf(
+        "[TypeCategoryMap::GetFormat] nothing found - returning empty SP");
+  return lldb::TypeFormatImplSP();
 }
 
 lldb::TypeSummaryImplSP
-TypeCategoryMap::GetSummaryFormat (FormattersMatchData& match_data)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+TypeCategoryMap::GetSummaryFormat(FormattersMatchData &match_data) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
 
-    uint32_t reason_why;
-    ActiveCategoriesIterator begin, end = m_active_categories.end();
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    
-    if (log)
-    {
-        for (auto match : match_data.GetMatchesVector())
-        {
-            log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32,
-                        match.GetTypeName().GetCString(),
-                        match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
-                        match.DidStripReference() ? "strip-reference" : "no-strip-reference",
-                        match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
-                        match.GetReason());
-        }
-    }
+  uint32_t reason_why;
+  ActiveCategoriesIterator begin, end = m_active_categories.end();
 
-    for (begin = m_active_categories.begin(); begin != end; begin++)
-    {
-        lldb::TypeCategoryImplSP category_sp = *begin;
-        lldb::TypeSummaryImplSP current_format;
-        if (log)
-            log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s", category_sp->GetName());
-        if (!category_sp->Get(match_data.GetValueObject(), match_data.GetMatchesVector(), current_format, &reason_why))
-            continue;
-        return current_format;
-    }
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+
+  if (log) {
+    for (auto match : match_data.GetMatchesVector()) {
+      log->Printf(
+          "[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s "
+          "reason = %" PRIu32,
+          match.GetTypeName().GetCString(),
+          match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
+          match.DidStripReference() ? "strip-reference" : "no-strip-reference",
+          match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
+          match.GetReason());
+    }
+  }
+
+  for (begin = m_active_categories.begin(); begin != end; begin++) {
+    lldb::TypeCategoryImplSP category_sp = *begin;
+    lldb::TypeSummaryImplSP current_format;
     if (log)
-        log->Printf("[CategoryMap::GetSummaryFormat] nothing found - returning empty SP");
-    return lldb::TypeSummaryImplSP();
+      log->Printf("[CategoryMap::GetSummaryFormat] Trying to use category %s",
+                  category_sp->GetName());
+    if (!category_sp->Get(match_data.GetValueObject(),
+                          match_data.GetMatchesVector(), current_format,
+                          &reason_why))
+      continue;
+    return current_format;
+  }
+  if (log)
+    log->Printf(
+        "[CategoryMap::GetSummaryFormat] nothing found - returning empty SP");
+  return lldb::TypeSummaryImplSP();
 }
 
 #ifndef LLDB_DISABLE_PYTHON
 lldb::SyntheticChildrenSP
-TypeCategoryMap::GetSyntheticChildren (FormattersMatchData& match_data)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+TypeCategoryMap::GetSyntheticChildren(FormattersMatchData &match_data) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
 
-    uint32_t reason_why;
-    
-    ActiveCategoriesIterator begin, end = m_active_categories.end();
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    
-    if (log)
-    {
-        for (auto match : match_data.GetMatchesVector())
-        {
-            log->Printf("[CategoryMap::GetSyntheticChildren] candidate match = %s %s %s %s reason = %" PRIu32,
-                        match.GetTypeName().GetCString(),
-                        match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
-                        match.DidStripReference() ? "strip-reference" : "no-strip-reference",
-                        match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
-                        match.GetReason());
-        }
-    }
+  uint32_t reason_why;
 
-    for (begin = m_active_categories.begin(); begin != end; begin++)
-    {
-        lldb::TypeCategoryImplSP category_sp = *begin;
-        lldb::SyntheticChildrenSP current_format;
-        if (log)
-            log->Printf("[CategoryMap::GetSyntheticChildren] Trying to use category %s", category_sp->GetName());
-        if (!category_sp->Get(match_data.GetValueObject(), match_data.GetMatchesVector(), current_format, &reason_why))
-            continue;
-        return current_format;
-    }
+  ActiveCategoriesIterator begin, end = m_active_categories.end();
+
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+
+  if (log) {
+    for (auto match : match_data.GetMatchesVector()) {
+      log->Printf(
+          "[CategoryMap::GetSyntheticChildren] candidate match = %s %s %s %s "
+          "reason = %" PRIu32,
+          match.GetTypeName().GetCString(),
+          match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
+          match.DidStripReference() ? "strip-reference" : "no-strip-reference",
+          match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
+          match.GetReason());
+    }
+  }
+
+  for (begin = m_active_categories.begin(); begin != end; begin++) {
+    lldb::TypeCategoryImplSP category_sp = *begin;
+    lldb::SyntheticChildrenSP current_format;
     if (log)
-        log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning empty SP");
-    return lldb::SyntheticChildrenSP();
+      log->Printf(
+          "[CategoryMap::GetSyntheticChildren] Trying to use category %s",
+          category_sp->GetName());
+    if (!category_sp->Get(match_data.GetValueObject(),
+                          match_data.GetMatchesVector(), current_format,
+                          &reason_why))
+      continue;
+    return current_format;
+  }
+  if (log)
+    log->Printf("[CategoryMap::GetSyntheticChildren] nothing found - returning "
+                "empty SP");
+  return lldb::SyntheticChildrenSP();
 }
 #endif
 
 lldb::TypeValidatorImplSP
-TypeCategoryMap::GetValidator (FormattersMatchData& match_data)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+TypeCategoryMap::GetValidator(FormattersMatchData &match_data) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
 
-    uint32_t reason_why;
-    ActiveCategoriesIterator begin, end = m_active_categories.end();
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_DATAFORMATTERS));
-    
-    if (log)
-    {
-        for (auto match : match_data.GetMatchesVector())
-        {
-            log->Printf("[CategoryMap::GetValidator] candidate match = %s %s %s %s reason = %" PRIu32,
-                        match.GetTypeName().GetCString(),
-                        match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
-                        match.DidStripReference() ? "strip-reference" : "no-strip-reference",
-                        match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
-                        match.GetReason());
-        }
-    }
+  uint32_t reason_why;
+  ActiveCategoriesIterator begin, end = m_active_categories.end();
 
-    for (begin = m_active_categories.begin(); begin != end; begin++)
-    {
-        lldb::TypeCategoryImplSP category_sp = *begin;
-        lldb::TypeValidatorImplSP current_format;
-        if (log)
-            log->Printf("[CategoryMap::GetValidator] Trying to use category %s", category_sp->GetName());
-        if (!category_sp->Get(match_data.GetValueObject(), match_data.GetMatchesVector(), current_format, &reason_why))
-            continue;
-        return current_format;
-    }
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
+
+  if (log) {
+    for (auto match : match_data.GetMatchesVector()) {
+      log->Printf(
+          "[CategoryMap::GetValidator] candidate match = %s %s %s %s reason = "
+          "%" PRIu32,
+          match.GetTypeName().GetCString(),
+          match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
+          match.DidStripReference() ? "strip-reference" : "no-strip-reference",
+          match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
+          match.GetReason());
+    }
+  }
+
+  for (begin = m_active_categories.begin(); begin != end; begin++) {
+    lldb::TypeCategoryImplSP category_sp = *begin;
+    lldb::TypeValidatorImplSP current_format;
     if (log)
-        log->Printf("[CategoryMap::GetValidator] nothing found - returning empty SP");
-    return lldb::TypeValidatorImplSP();
+      log->Printf("[CategoryMap::GetValidator] Trying to use category %s",
+                  category_sp->GetName());
+    if (!category_sp->Get(match_data.GetValueObject(),
+                          match_data.GetMatchesVector(), current_format,
+                          &reason_why))
+      continue;
+    return current_format;
+  }
+  if (log)
+    log->Printf(
+        "[CategoryMap::GetValidator] nothing found - returning empty SP");
+  return lldb::TypeValidatorImplSP();
 }
 
-void
-TypeCategoryMap::ForEach(ForEachCallback callback)
-{
-    if (callback)
+void TypeCategoryMap::ForEach(ForEachCallback callback) {
+  if (callback) {
+    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+
+    // loop through enabled categories in respective order
     {
-        std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+      ActiveCategoriesIterator begin, end = m_active_categories.end();
+      for (begin = m_active_categories.begin(); begin != end; begin++) {
+        lldb::TypeCategoryImplSP category = *begin;
+        if (!callback(category))
+          break;
+      }
+    }
 
-        // loop through enabled categories in respective order
-        {
-            ActiveCategoriesIterator begin, end = m_active_categories.end();
-            for (begin = m_active_categories.begin(); begin != end; begin++)
-            {
-                lldb::TypeCategoryImplSP category = *begin;
-                if (!callback(category))
-                    break;
-            }
-        }
-        
-        // loop through disabled categories in just any order
-        {
-            MapIterator pos, end = m_map.end();
-            for (pos = m_map.begin(); pos != end; pos++)
-            {
-                if (pos->second->IsEnabled())
-                    continue;
-                if (!callback(pos->second))
-                    break;
-            }
-        }
+    // loop through disabled categories in just any order
+    {
+      MapIterator pos, end = m_map.end();
+      for (pos = m_map.begin(); pos != end; pos++) {
+        if (pos->second->IsEnabled())
+          continue;
+        if (!callback(pos->second))
+          break;
+      }
     }
+  }
 }
 
-TypeCategoryImplSP
-TypeCategoryMap::GetAtIndex (uint32_t index)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+TypeCategoryImplSP TypeCategoryMap::GetAtIndex(uint32_t index) {
+  std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
 
-    if (index < m_map.size())
-    {
-        MapIterator pos, end = m_map.end();
-        for (pos = m_map.begin(); pos != end; pos++)
-        {
-            if (index == 0)
-                return pos->second;
-            index--;
-        }
+  if (index < m_map.size()) {
+    MapIterator pos, end = m_map.end();
+    for (pos = m_map.begin(); pos != end; pos++) {
+      if (index == 0)
+        return pos->second;
+      index--;
     }
-    
-    return TypeCategoryImplSP();
+  }
+
+  return TypeCategoryImplSP();
 }

Modified: lldb/trunk/source/DataFormatters/TypeFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeFormat.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeFormat.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeFormat.cpp Tue Sep  6 15:57:50 2016
@@ -16,8 +16,8 @@
 // Other libraries and framework includes
 
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
 
 #include "lldb/Core/StreamString.h"
 #include "lldb/DataFormatters/FormatManager.h"
@@ -30,225 +30,181 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeFormatImpl::TypeFormatImpl (const Flags& flags) :
-m_flags(flags),
-m_my_revision(0)
-{
-}
+TypeFormatImpl::TypeFormatImpl(const Flags &flags)
+    : m_flags(flags), m_my_revision(0) {}
 
-TypeFormatImpl::~TypeFormatImpl ()
-{
-}
+TypeFormatImpl::~TypeFormatImpl() {}
 
-TypeFormatImpl_Format::TypeFormatImpl_Format (lldb::Format f,
-                                              const TypeFormatImpl::Flags& flags) :
-TypeFormatImpl(flags),
-m_format (f)
-{
-}
-
-TypeFormatImpl_Format::~TypeFormatImpl_Format ()
-{
-}
+TypeFormatImpl_Format::TypeFormatImpl_Format(lldb::Format f,
+                                             const TypeFormatImpl::Flags &flags)
+    : TypeFormatImpl(flags), m_format(f) {}
+
+TypeFormatImpl_Format::~TypeFormatImpl_Format() {}
+
+bool TypeFormatImpl_Format::FormatObject(ValueObject *valobj,
+                                         std::string &dest) const {
+  if (!valobj)
+    return false;
+  if (valobj->CanProvideValue()) {
+    Value &value(valobj->GetValue());
+    const Value::ContextType context_type = value.GetContextType();
+    ExecutionContext exe_ctx(valobj->GetExecutionContextRef());
+    DataExtractor data;
 
-bool
-TypeFormatImpl_Format::FormatObject (ValueObject *valobj,
-                                     std::string& dest) const
-{
-    if (!valobj)
-        return false;
-    if (valobj->CanProvideValue())
-    {
-        Value& value(valobj->GetValue());
-        const Value::ContextType context_type = value.GetContextType();
-        ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
-        DataExtractor data;
-        
-        if (context_type == Value::eContextTypeRegisterInfo)
-        {
-            const RegisterInfo *reg_info = value.GetRegisterInfo();
-            if (reg_info)
-            {
-                Error error;
-                valobj->GetData(data, error);
-                if (error.Fail())
-                    return false;
-                
-                StreamString reg_sstr;
-                data.Dump (&reg_sstr,
-                           0,
-                           GetFormat(),
-                           reg_info->byte_size,
-                           1,
-                           UINT32_MAX,
-                           LLDB_INVALID_ADDRESS,
-                           0,
-                           0,
-                           exe_ctx.GetBestExecutionContextScope());
-                dest.swap(reg_sstr.GetString());
-            }
-        }
-        else
-        {
-            CompilerType compiler_type = value.GetCompilerType ();
-            if (compiler_type)
-            {
-                // put custom bytes to display in the DataExtractor to override the default value logic
-                if (GetFormat() == eFormatCString)
-                {
-                    lldb_private::Flags type_flags(compiler_type.GetTypeInfo(NULL)); // disambiguate w.r.t. TypeFormatImpl::Flags
-                    if (type_flags.Test(eTypeIsPointer) && !type_flags.Test(eTypeIsObjC))
-                    {
-                        // if we are dumping a pointer as a c-string, get the pointee data as a string
-                        TargetSP target_sp(valobj->GetTargetSP());
-                        if (target_sp)
-                        {
-                            size_t max_len = target_sp->GetMaximumSizeOfStringSummary();
-                            Error error;
-                            DataBufferSP buffer_sp(new DataBufferHeap(max_len+1,0));
-                            Address address(valobj->GetPointerValue());
-                            if (target_sp->ReadCStringFromMemory(address, (char*)buffer_sp->GetBytes(), max_len, error) && error.Success())
-                                data.SetData(buffer_sp);
-                        }
-                    }
-                }
-                else
-                {
-                    Error error;
-                    valobj->GetData(data, error);
-                    if (error.Fail())
-                        return false;
-                }
-                
-                StreamString sstr;
-                ExecutionContextScope *exe_scope(exe_ctx.GetBestExecutionContextScope());
-                compiler_type.DumpTypeValue (&sstr,                                 // The stream to use for display
-                                             GetFormat(),                           // Format to display this type with
-                                             data,                                  // Data to extract from
-                                             0,                                     // Byte offset into "m_data"
-                                             compiler_type.GetByteSize(exe_scope),  // Byte size of item in "m_data"
-                                             valobj->GetBitfieldBitSize(),          // Bitfield bit size
-                                             valobj->GetBitfieldBitOffset(),        // Bitfield bit offset
-                                             exe_scope);
-                // Given that we do not want to set the ValueObject's m_error
-                // for a formatting error (or else we wouldn't be able to reformat
-                // until a next update), an empty string is treated as a "false"
-                // return from here, but that's about as severe as we get
-                // CompilerType::DumpTypeValue() should always return
-                // something, even if that something is an error message
-                if (sstr.GetString().empty())
-                    dest.clear();
-                else
-                    dest.swap(sstr.GetString());
+    if (context_type == Value::eContextTypeRegisterInfo) {
+      const RegisterInfo *reg_info = value.GetRegisterInfo();
+      if (reg_info) {
+        Error error;
+        valobj->GetData(data, error);
+        if (error.Fail())
+          return false;
+
+        StreamString reg_sstr;
+        data.Dump(&reg_sstr, 0, GetFormat(), reg_info->byte_size, 1, UINT32_MAX,
+                  LLDB_INVALID_ADDRESS, 0, 0,
+                  exe_ctx.GetBestExecutionContextScope());
+        dest.swap(reg_sstr.GetString());
+      }
+    } else {
+      CompilerType compiler_type = value.GetCompilerType();
+      if (compiler_type) {
+        // put custom bytes to display in the DataExtractor to override the
+        // default value logic
+        if (GetFormat() == eFormatCString) {
+          lldb_private::Flags type_flags(compiler_type.GetTypeInfo(
+              NULL)); // disambiguate w.r.t. TypeFormatImpl::Flags
+          if (type_flags.Test(eTypeIsPointer) &&
+              !type_flags.Test(eTypeIsObjC)) {
+            // if we are dumping a pointer as a c-string, get the pointee data
+            // as a string
+            TargetSP target_sp(valobj->GetTargetSP());
+            if (target_sp) {
+              size_t max_len = target_sp->GetMaximumSizeOfStringSummary();
+              Error error;
+              DataBufferSP buffer_sp(new DataBufferHeap(max_len + 1, 0));
+              Address address(valobj->GetPointerValue());
+              if (target_sp->ReadCStringFromMemory(
+                      address, (char *)buffer_sp->GetBytes(), max_len, error) &&
+                  error.Success())
+                data.SetData(buffer_sp);
             }
-        }
-        return !dest.empty();
-    }
-    else
-        return false;
-}
-
-std::string
-TypeFormatImpl_Format::GetDescription()
-{
-    StreamString sstr;
-    sstr.Printf ("%s%s%s%s",
-                 FormatManager::GetFormatAsCString (GetFormat()),
-                 Cascades() ? "" : " (not cascading)",
-                 SkipsPointers() ? " (skip pointers)" : "",
-                 SkipsReferences() ? " (skip references)" : "");
-    return sstr.GetString();
-}
-
-TypeFormatImpl_EnumType::TypeFormatImpl_EnumType (ConstString type_name,
-                                                  const TypeFormatImpl::Flags& flags) :
-TypeFormatImpl(flags),
-m_enum_type(type_name),
-m_types()
-{
-}
-
-TypeFormatImpl_EnumType::~TypeFormatImpl_EnumType ()
-{
-}
-
-bool
-TypeFormatImpl_EnumType::FormatObject (ValueObject *valobj,
-                                       std::string& dest) const
-{
-    dest.clear();
-    if (!valobj)
-        return false;
-    if (!valobj->CanProvideValue())
-        return false;
-    ProcessSP process_sp;
-    TargetSP target_sp;
-    void* valobj_key = (process_sp = valobj->GetProcessSP()).get();
-    if (!valobj_key)
-        valobj_key = (target_sp = valobj->GetTargetSP()).get();
-    else
-        target_sp = process_sp->GetTarget().shared_from_this();
-    if (!valobj_key)
-        return false;
-    auto iter = m_types.find(valobj_key),
-    end = m_types.end();
-    CompilerType valobj_enum_type;
-    if (iter == end)
-    {
-        // probably a redundant check
-        if (!target_sp)
+          }
+        } else {
+          Error error;
+          valobj->GetData(data, error);
+          if (error.Fail())
             return false;
-        const ModuleList& images(target_sp->GetImages());
-        SymbolContext sc;
-        TypeList types;
-        llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
-        images.FindTypes(sc, m_enum_type, false, UINT32_MAX, searched_symbol_files, types);
-        if (types.GetSize() == 0)
-            return false;
-        for (lldb::TypeSP type_sp : types.Types())
-        {
-            if (!type_sp)
-                continue;
-            if ( (type_sp->GetForwardCompilerType().GetTypeInfo() & eTypeIsEnumeration) == eTypeIsEnumeration)
-            {
-                valobj_enum_type = type_sp->GetFullCompilerType ();
-                m_types.emplace(valobj_key,valobj_enum_type);
-                break;
-            }
         }
+
+        StreamString sstr;
+        ExecutionContextScope *exe_scope(
+            exe_ctx.GetBestExecutionContextScope());
+        compiler_type.DumpTypeValue(
+            &sstr,       // The stream to use for display
+            GetFormat(), // Format to display this type with
+            data,        // Data to extract from
+            0,           // Byte offset into "m_data"
+            compiler_type.GetByteSize(
+                exe_scope),                 // Byte size of item in "m_data"
+            valobj->GetBitfieldBitSize(),   // Bitfield bit size
+            valobj->GetBitfieldBitOffset(), // Bitfield bit offset
+            exe_scope);
+        // Given that we do not want to set the ValueObject's m_error
+        // for a formatting error (or else we wouldn't be able to reformat
+        // until a next update), an empty string is treated as a "false"
+        // return from here, but that's about as severe as we get
+        // CompilerType::DumpTypeValue() should always return
+        // something, even if that something is an error message
+        if (sstr.GetString().empty())
+          dest.clear();
+        else
+          dest.swap(sstr.GetString());
+      }
     }
-    else
-        valobj_enum_type = iter->second;
-    if (valobj_enum_type.IsValid() == false)
-        return false;
-    DataExtractor data;
-    Error error;
-    valobj->GetData(data, error);
-    if (error.Fail())
-        return false;
-    ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
-    StreamString sstr;
-    valobj_enum_type.DumpTypeValue(&sstr,
-                                   lldb::eFormatEnum,
-                                   data,
-                                   0,
-                                   data.GetByteSize(),
-                                   0,
-                                   0,
-                                   exe_ctx.GetBestExecutionContextScope());
-    if (!sstr.GetString().empty())
-        dest.swap(sstr.GetString());
     return !dest.empty();
+  } else
+    return false;
 }
 
-std::string
-TypeFormatImpl_EnumType::GetDescription()
-{
-    StreamString sstr;
-    sstr.Printf ("as type %s%s%s%s",
-                 m_enum_type.AsCString("<invalid type>"),
-                 Cascades() ? "" : " (not cascading)",
-                 SkipsPointers() ? " (skip pointers)" : "",
-                 SkipsReferences() ? " (skip references)" : "");
-    return sstr.GetString();
+std::string TypeFormatImpl_Format::GetDescription() {
+  StreamString sstr;
+  sstr.Printf("%s%s%s%s", FormatManager::GetFormatAsCString(GetFormat()),
+              Cascades() ? "" : " (not cascading)",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "");
+  return sstr.GetString();
+}
+
+TypeFormatImpl_EnumType::TypeFormatImpl_EnumType(
+    ConstString type_name, const TypeFormatImpl::Flags &flags)
+    : TypeFormatImpl(flags), m_enum_type(type_name), m_types() {}
+
+TypeFormatImpl_EnumType::~TypeFormatImpl_EnumType() {}
+
+bool TypeFormatImpl_EnumType::FormatObject(ValueObject *valobj,
+                                           std::string &dest) const {
+  dest.clear();
+  if (!valobj)
+    return false;
+  if (!valobj->CanProvideValue())
+    return false;
+  ProcessSP process_sp;
+  TargetSP target_sp;
+  void *valobj_key = (process_sp = valobj->GetProcessSP()).get();
+  if (!valobj_key)
+    valobj_key = (target_sp = valobj->GetTargetSP()).get();
+  else
+    target_sp = process_sp->GetTarget().shared_from_this();
+  if (!valobj_key)
+    return false;
+  auto iter = m_types.find(valobj_key), end = m_types.end();
+  CompilerType valobj_enum_type;
+  if (iter == end) {
+    // probably a redundant check
+    if (!target_sp)
+      return false;
+    const ModuleList &images(target_sp->GetImages());
+    SymbolContext sc;
+    TypeList types;
+    llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
+    images.FindTypes(sc, m_enum_type, false, UINT32_MAX, searched_symbol_files,
+                     types);
+    if (types.GetSize() == 0)
+      return false;
+    for (lldb::TypeSP type_sp : types.Types()) {
+      if (!type_sp)
+        continue;
+      if ((type_sp->GetForwardCompilerType().GetTypeInfo() &
+           eTypeIsEnumeration) == eTypeIsEnumeration) {
+        valobj_enum_type = type_sp->GetFullCompilerType();
+        m_types.emplace(valobj_key, valobj_enum_type);
+        break;
+      }
+    }
+  } else
+    valobj_enum_type = iter->second;
+  if (valobj_enum_type.IsValid() == false)
+    return false;
+  DataExtractor data;
+  Error error;
+  valobj->GetData(data, error);
+  if (error.Fail())
+    return false;
+  ExecutionContext exe_ctx(valobj->GetExecutionContextRef());
+  StreamString sstr;
+  valobj_enum_type.DumpTypeValue(&sstr, lldb::eFormatEnum, data, 0,
+                                 data.GetByteSize(), 0, 0,
+                                 exe_ctx.GetBestExecutionContextScope());
+  if (!sstr.GetString().empty())
+    dest.swap(sstr.GetString());
+  return !dest.empty();
+}
+
+std::string TypeFormatImpl_EnumType::GetDescription() {
+  StreamString sstr;
+  sstr.Printf("as type %s%s%s%s", m_enum_type.AsCString("<invalid type>"),
+              Cascades() ? "" : " (not cascading)",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "");
+  return sstr.GetString();
 }

Modified: lldb/trunk/source/DataFormatters/TypeSummary.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeSummary.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeSummary.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeSummary.cpp Tue Sep  6 15:57:50 2016
@@ -16,8 +16,8 @@
 // Other libraries and framework includes
 
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/StreamString.h"
@@ -31,252 +31,186 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeSummaryOptions::TypeSummaryOptions () :
-    m_lang(eLanguageTypeUnknown),
-    m_capping(eTypeSummaryCapped)
-{}
-
-TypeSummaryOptions::TypeSummaryOptions (const TypeSummaryOptions& rhs) :
-    m_lang(rhs.m_lang),
-    m_capping(rhs.m_capping)
-{}
-
-TypeSummaryOptions&
-TypeSummaryOptions::operator = (const TypeSummaryOptions& rhs)
-{
-    m_lang = rhs.m_lang;
-    m_capping = rhs.m_capping;
-    return *this;
-}
-
-lldb::LanguageType
-TypeSummaryOptions::GetLanguage () const
-{
-    return m_lang;
-}
-
-lldb::TypeSummaryCapping
-TypeSummaryOptions::GetCapping () const
-{
-    return m_capping;
-}
-
-TypeSummaryOptions&
-TypeSummaryOptions::SetLanguage (lldb::LanguageType lang)
-{
-    m_lang = lang;
-    return *this;
-}
-
-TypeSummaryOptions&
-TypeSummaryOptions::SetCapping (lldb::TypeSummaryCapping cap)
-{
-    m_capping = cap;
-    return *this;
-}
-
-TypeSummaryImpl::TypeSummaryImpl (Kind kind,
-                                  const TypeSummaryImpl::Flags& flags) :
-    m_flags(flags),
-    m_kind(kind)
-{
-}
-
-
-StringSummaryFormat::StringSummaryFormat (const TypeSummaryImpl::Flags& flags,
-                                          const char *format_cstr) :
-    TypeSummaryImpl(Kind::eSummaryString,flags),
-    m_format_str()
-{
-    SetSummaryString (format_cstr);
-}
-
-void
-StringSummaryFormat::SetSummaryString (const char* format_cstr)
-{
-    m_format.Clear();
-    if (format_cstr && format_cstr[0])
-    {
-        m_format_str = format_cstr;
-        m_error = FormatEntity::Parse(format_cstr, m_format);
-    }
-    else
-    {
-        m_format_str.clear();
-        m_error.Clear();
-    }
+TypeSummaryOptions::TypeSummaryOptions()
+    : m_lang(eLanguageTypeUnknown), m_capping(eTypeSummaryCapped) {}
+
+TypeSummaryOptions::TypeSummaryOptions(const TypeSummaryOptions &rhs)
+    : m_lang(rhs.m_lang), m_capping(rhs.m_capping) {}
+
+TypeSummaryOptions &TypeSummaryOptions::
+operator=(const TypeSummaryOptions &rhs) {
+  m_lang = rhs.m_lang;
+  m_capping = rhs.m_capping;
+  return *this;
 }
 
+lldb::LanguageType TypeSummaryOptions::GetLanguage() const { return m_lang; }
 
+lldb::TypeSummaryCapping TypeSummaryOptions::GetCapping() const {
+  return m_capping;
+}
 
-bool
-StringSummaryFormat::FormatObject (ValueObject *valobj,
-                                   std::string& retval,
-                                   const TypeSummaryOptions& options)
-{
-    if (!valobj)
-    {
-        retval.assign("NULL ValueObject");
-        return false;
-    }
-    
-    StreamString s;
-    ExecutionContext exe_ctx (valobj->GetExecutionContextRef());
-    SymbolContext sc;
-    StackFrame *frame = exe_ctx.GetFramePtr();
-    if (frame)
-        sc = frame->GetSymbolContext(lldb::eSymbolContextEverything);
-    
-    if (IsOneLiner())
-    {
-        ValueObjectPrinter printer(valobj,&s,DumpValueObjectOptions());
-        printer.PrintChildrenOneLiner(HideNames(valobj));
-        retval.assign(s.GetData());
-        return true;
-    }
-    else
-    {
-        if (FormatEntity::Format(m_format, s, &sc, &exe_ctx, &sc.line_entry.range.GetBaseAddress(), valobj, false, false))
-        {
-            retval.assign(s.GetString());
-            return true;
-        }
-        else
-        {
-            retval.assign("error: summary string parsing error");
-            return false;
-        }
-    }
+TypeSummaryOptions &TypeSummaryOptions::SetLanguage(lldb::LanguageType lang) {
+  m_lang = lang;
+  return *this;
 }
 
-std::string
-StringSummaryFormat::GetDescription ()
-{
-    StreamString sstr;
-    
-    sstr.Printf ("`%s`%s%s%s%s%s%s%s%s%s",
-                 m_format_str.c_str(),
-                 m_error.Fail() ? " error: " : "",
-                 m_error.Fail() ? m_error.AsCString() : "",
-                 Cascades() ? "" : " (not cascading)",
-                 !DoesPrintChildren(nullptr) ? "" : " (show children)",
-                 !DoesPrintValue(nullptr) ? " (hide value)" : "",
-                 IsOneLiner() ? " (one-line printout)" : "",
-                 SkipsPointers() ? " (skip pointers)" : "",
-                 SkipsReferences() ? " (skip references)" : "",
-                 HideNames(nullptr) ? " (hide member names)" : "");
-    return sstr.GetString();
-}
-
-CXXFunctionSummaryFormat::CXXFunctionSummaryFormat (const TypeSummaryImpl::Flags& flags,
-                                                    Callback impl,
-                                                    const char* description) :
-    TypeSummaryImpl(Kind::eCallback,flags),
-    m_impl(impl),
-    m_description(description ? description : "")
-{
-}
-
-bool
-CXXFunctionSummaryFormat::FormatObject (ValueObject *valobj,
-                                        std::string& dest,
-                                        const TypeSummaryOptions& options)
-{
-    dest.clear();
-    StreamString stream;
-    if (!m_impl || m_impl(*valobj,stream,options) == false)
-        return false;
-    dest.assign(stream.GetData());
-    return true;
+TypeSummaryOptions &
+TypeSummaryOptions::SetCapping(lldb::TypeSummaryCapping cap) {
+  m_capping = cap;
+  return *this;
 }
 
-std::string
-CXXFunctionSummaryFormat::GetDescription ()
-{
-    StreamString sstr;
-    sstr.Printf ("%s%s%s%s%s%s%s %s",
-                 Cascades() ? "" : " (not cascading)",
-                 !DoesPrintChildren(nullptr) ? "" : " (show children)",
-                 !DoesPrintValue(nullptr) ? " (hide value)" : "",
-                 IsOneLiner() ? " (one-line printout)" : "",
-                 SkipsPointers() ? " (skip pointers)" : "",
-                 SkipsReferences() ? " (skip references)" : "",
-                 HideNames(nullptr) ? " (hide member names)" : "",
-                 m_description.c_str());
-    return sstr.GetString();
-}
-
-ScriptSummaryFormat::ScriptSummaryFormat (const TypeSummaryImpl::Flags& flags,
-                                          const char * function_name,
-                                          const char * python_script) :
-    TypeSummaryImpl(Kind::eScript,flags),
-    m_function_name(),
-    m_python_script(),
-    m_script_function_sp()
-{
-    if (function_name)
-        m_function_name.assign(function_name);
-    if (python_script)
-        m_python_script.assign(python_script);
-}
-
-bool
-ScriptSummaryFormat::FormatObject (ValueObject *valobj,
-                                   std::string& retval,
-                                   const TypeSummaryOptions& options)
-{
-    if (!valobj)
-        return false;
-    
-    TargetSP target_sp(valobj->GetTargetSP());
-    
-    if (!target_sp)
-    {
-        retval.assign("error: no target");
-        return false;
-    }
-    
-    ScriptInterpreter *script_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
-    
-    if (!script_interpreter)
-    {
-        retval.assign("error: no ScriptInterpreter");
-        return false;
-    }
-    
-    return script_interpreter->GetScriptedSummary(m_function_name.c_str(),
-                                                  valobj->GetSP(),
-                                                  m_script_function_sp,
-                                                  options,
-                                                  retval);
-    
-}
-
-std::string
-ScriptSummaryFormat::GetDescription ()
-{
-    StreamString sstr;
-    sstr.Printf ("%s%s%s%s%s%s%s\n  ",       Cascades() ? "" : " (not cascading)",
-                 !DoesPrintChildren(nullptr) ? "" : " (show children)",
-                 !DoesPrintValue(nullptr) ? " (hide value)" : "",
-                 IsOneLiner() ? " (one-line printout)" : "",
-                 SkipsPointers() ? " (skip pointers)" : "",
-                 SkipsReferences() ? " (skip references)" : "",
-                 HideNames(nullptr) ? " (hide member names)" : "");
-    if (m_python_script.empty())
-    {
-        if (m_function_name.empty())
-        {
-            sstr.PutCString("no backing script");
-        }
-        else
-        {
-            sstr.PutCString(m_function_name.c_str());
-        }
-    }
-    else
-    {
-        sstr.PutCString(m_python_script.c_str());
-    }
-    return sstr.GetString();
+TypeSummaryImpl::TypeSummaryImpl(Kind kind, const TypeSummaryImpl::Flags &flags)
+    : m_flags(flags), m_kind(kind) {}
+
+StringSummaryFormat::StringSummaryFormat(const TypeSummaryImpl::Flags &flags,
+                                         const char *format_cstr)
+    : TypeSummaryImpl(Kind::eSummaryString, flags), m_format_str() {
+  SetSummaryString(format_cstr);
+}
+
+void StringSummaryFormat::SetSummaryString(const char *format_cstr) {
+  m_format.Clear();
+  if (format_cstr && format_cstr[0]) {
+    m_format_str = format_cstr;
+    m_error = FormatEntity::Parse(format_cstr, m_format);
+  } else {
+    m_format_str.clear();
+    m_error.Clear();
+  }
+}
+
+bool StringSummaryFormat::FormatObject(ValueObject *valobj, std::string &retval,
+                                       const TypeSummaryOptions &options) {
+  if (!valobj) {
+    retval.assign("NULL ValueObject");
+    return false;
+  }
+
+  StreamString s;
+  ExecutionContext exe_ctx(valobj->GetExecutionContextRef());
+  SymbolContext sc;
+  StackFrame *frame = exe_ctx.GetFramePtr();
+  if (frame)
+    sc = frame->GetSymbolContext(lldb::eSymbolContextEverything);
+
+  if (IsOneLiner()) {
+    ValueObjectPrinter printer(valobj, &s, DumpValueObjectOptions());
+    printer.PrintChildrenOneLiner(HideNames(valobj));
+    retval.assign(s.GetData());
+    return true;
+  } else {
+    if (FormatEntity::Format(m_format, s, &sc, &exe_ctx,
+                             &sc.line_entry.range.GetBaseAddress(), valobj,
+                             false, false)) {
+      retval.assign(s.GetString());
+      return true;
+    } else {
+      retval.assign("error: summary string parsing error");
+      return false;
+    }
+  }
+}
+
+std::string StringSummaryFormat::GetDescription() {
+  StreamString sstr;
+
+  sstr.Printf("`%s`%s%s%s%s%s%s%s%s%s", m_format_str.c_str(),
+              m_error.Fail() ? " error: " : "",
+              m_error.Fail() ? m_error.AsCString() : "",
+              Cascades() ? "" : " (not cascading)",
+              !DoesPrintChildren(nullptr) ? "" : " (show children)",
+              !DoesPrintValue(nullptr) ? " (hide value)" : "",
+              IsOneLiner() ? " (one-line printout)" : "",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "",
+              HideNames(nullptr) ? " (hide member names)" : "");
+  return sstr.GetString();
+}
+
+CXXFunctionSummaryFormat::CXXFunctionSummaryFormat(
+    const TypeSummaryImpl::Flags &flags, Callback impl, const char *description)
+    : TypeSummaryImpl(Kind::eCallback, flags), m_impl(impl),
+      m_description(description ? description : "") {}
+
+bool CXXFunctionSummaryFormat::FormatObject(ValueObject *valobj,
+                                            std::string &dest,
+                                            const TypeSummaryOptions &options) {
+  dest.clear();
+  StreamString stream;
+  if (!m_impl || m_impl(*valobj, stream, options) == false)
+    return false;
+  dest.assign(stream.GetData());
+  return true;
+}
+
+std::string CXXFunctionSummaryFormat::GetDescription() {
+  StreamString sstr;
+  sstr.Printf("%s%s%s%s%s%s%s %s", Cascades() ? "" : " (not cascading)",
+              !DoesPrintChildren(nullptr) ? "" : " (show children)",
+              !DoesPrintValue(nullptr) ? " (hide value)" : "",
+              IsOneLiner() ? " (one-line printout)" : "",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "",
+              HideNames(nullptr) ? " (hide member names)" : "",
+              m_description.c_str());
+  return sstr.GetString();
+}
+
+ScriptSummaryFormat::ScriptSummaryFormat(const TypeSummaryImpl::Flags &flags,
+                                         const char *function_name,
+                                         const char *python_script)
+    : TypeSummaryImpl(Kind::eScript, flags), m_function_name(),
+      m_python_script(), m_script_function_sp() {
+  if (function_name)
+    m_function_name.assign(function_name);
+  if (python_script)
+    m_python_script.assign(python_script);
+}
+
+bool ScriptSummaryFormat::FormatObject(ValueObject *valobj, std::string &retval,
+                                       const TypeSummaryOptions &options) {
+  if (!valobj)
+    return false;
+
+  TargetSP target_sp(valobj->GetTargetSP());
+
+  if (!target_sp) {
+    retval.assign("error: no target");
+    return false;
+  }
+
+  ScriptInterpreter *script_interpreter =
+      target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+
+  if (!script_interpreter) {
+    retval.assign("error: no ScriptInterpreter");
+    return false;
+  }
+
+  return script_interpreter->GetScriptedSummary(
+      m_function_name.c_str(), valobj->GetSP(), m_script_function_sp, options,
+      retval);
+}
+
+std::string ScriptSummaryFormat::GetDescription() {
+  StreamString sstr;
+  sstr.Printf("%s%s%s%s%s%s%s\n  ", Cascades() ? "" : " (not cascading)",
+              !DoesPrintChildren(nullptr) ? "" : " (show children)",
+              !DoesPrintValue(nullptr) ? " (hide value)" : "",
+              IsOneLiner() ? " (one-line printout)" : "",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "",
+              HideNames(nullptr) ? " (hide member names)" : "");
+  if (m_python_script.empty()) {
+    if (m_function_name.empty()) {
+      sstr.PutCString("no backing script");
+    } else {
+      sstr.PutCString(m_function_name.c_str());
+    }
+  } else {
+    sstr.PutCString(m_python_script.c_str());
+  }
+  return sstr.GetString();
 }

Modified: lldb/trunk/source/DataFormatters/TypeSynthetic.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeSynthetic.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeSynthetic.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeSynthetic.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- TypeSynthetic.cpp ----------------------------------------*- C++ -*-===//
+//===-- TypeSynthetic.cpp ----------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,8 +15,8 @@
 // Other libraries and framework includes
 
 // Project includes
-#include "lldb/lldb-public.h"
 #include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
 
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/StreamString.h"
@@ -28,244 +29,198 @@
 using namespace lldb;
 using namespace lldb_private;
 
-void
-TypeFilterImpl::AddExpressionPath (const std::string& path)
-{
-    bool need_add_dot = true;
-    if (path[0] == '.' ||
-        (path[0] == '-' && path[1] == '>') ||
-        path[0] == '[')
-        need_add_dot = false;
-    // add a '.' symbol to help forgetful users
-    if(!need_add_dot)
-        m_expression_paths.push_back(path);
-    else
-        m_expression_paths.push_back(std::string(".") + path);
-}
-
-bool
-TypeFilterImpl::SetExpressionPathAtIndex (size_t i, const std::string& path)
-{
-    if (i >= GetCount())
-        return false;
-    bool need_add_dot = true;
-    if (path[0] == '.' ||
-        (path[0] == '-' && path[1] == '>') ||
-        path[0] == '[')
-        need_add_dot = false;
-    // add a '.' symbol to help forgetful users
-    if(!need_add_dot)
-        m_expression_paths[i] = path;
-    else
-        m_expression_paths[i] = std::string(".") + path;
-    return true;
+void TypeFilterImpl::AddExpressionPath(const std::string &path) {
+  bool need_add_dot = true;
+  if (path[0] == '.' || (path[0] == '-' && path[1] == '>') || path[0] == '[')
+    need_add_dot = false;
+  // add a '.' symbol to help forgetful users
+  if (!need_add_dot)
+    m_expression_paths.push_back(path);
+  else
+    m_expression_paths.push_back(std::string(".") + path);
+}
+
+bool TypeFilterImpl::SetExpressionPathAtIndex(size_t i,
+                                              const std::string &path) {
+  if (i >= GetCount())
+    return false;
+  bool need_add_dot = true;
+  if (path[0] == '.' || (path[0] == '-' && path[1] == '>') || path[0] == '[')
+    need_add_dot = false;
+  // add a '.' symbol to help forgetful users
+  if (!need_add_dot)
+    m_expression_paths[i] = path;
+  else
+    m_expression_paths[i] = std::string(".") + path;
+  return true;
 }
 
 size_t
-TypeFilterImpl::FrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    const char* name_cstr = name.GetCString();
-    if (name_cstr)
-    {
-        for (size_t i = 0; i < filter->GetCount(); i++)
-        {
-            const char* expr_cstr = filter->GetExpressionPathAtIndex(i);
-            if (expr_cstr)
-            {
-                if (*expr_cstr == '.')
-                    expr_cstr++;
-                else if (*expr_cstr == '-' && *(expr_cstr+1) == '>')
-                    expr_cstr += 2;
-            }
-            if (expr_cstr)
-            {
-                if (!::strcmp(name_cstr, expr_cstr))
-                    return i;
-            }
-        }
+TypeFilterImpl::FrontEnd::GetIndexOfChildWithName(const ConstString &name) {
+  const char *name_cstr = name.GetCString();
+  if (name_cstr) {
+    for (size_t i = 0; i < filter->GetCount(); i++) {
+      const char *expr_cstr = filter->GetExpressionPathAtIndex(i);
+      if (expr_cstr) {
+        if (*expr_cstr == '.')
+          expr_cstr++;
+        else if (*expr_cstr == '-' && *(expr_cstr + 1) == '>')
+          expr_cstr += 2;
+      }
+      if (expr_cstr) {
+        if (!::strcmp(name_cstr, expr_cstr))
+          return i;
+      }
     }
-    return UINT32_MAX;
+  }
+  return UINT32_MAX;
 }
 
-std::string
-TypeFilterImpl::GetDescription()
-{
-    StreamString sstr;
-    sstr.Printf("%s%s%s {\n",
-                Cascades() ? "" : " (not cascading)",
-                SkipsPointers() ? " (skip pointers)" : "",
-                SkipsReferences() ? " (skip references)" : "");
-    
-    for (size_t i = 0; i < GetCount(); i++)
-    {
-        sstr.Printf("    %s\n",
-                    GetExpressionPathAtIndex(i));
-    }
-    
-    sstr.Printf("}");
-    return sstr.GetString();
-}
-
-std::string
-CXXSyntheticChildren::GetDescription()
-{
-    StreamString sstr;
-    sstr.Printf("%s%s%s %s",
-                Cascades() ? "" : " (not cascading)",
-                SkipsPointers() ? " (skip pointers)" : "",
-                SkipsReferences() ? " (skip references)" : "",
-                m_description.c_str());
-
-    return sstr.GetString();
+std::string TypeFilterImpl::GetDescription() {
+  StreamString sstr;
+  sstr.Printf("%s%s%s {\n", Cascades() ? "" : " (not cascading)",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "");
+
+  for (size_t i = 0; i < GetCount(); i++) {
+    sstr.Printf("    %s\n", GetExpressionPathAtIndex(i));
+  }
+
+  sstr.Printf("}");
+  return sstr.GetString();
+}
+
+std::string CXXSyntheticChildren::GetDescription() {
+  StreamString sstr;
+  sstr.Printf("%s%s%s %s", Cascades() ? "" : " (not cascading)",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "",
+              m_description.c_str());
+
+  return sstr.GetString();
+}
+
+lldb::ValueObjectSP SyntheticChildrenFrontEnd::CreateValueObjectFromExpression(
+    const char *name, const char *expression, const ExecutionContext &exe_ctx) {
+  ValueObjectSP valobj_sp(
+      ValueObject::CreateValueObjectFromExpression(name, expression, exe_ctx));
+  if (valobj_sp)
+    valobj_sp->SetSyntheticChildrenGenerated(true);
+  return valobj_sp;
+}
+
+lldb::ValueObjectSP SyntheticChildrenFrontEnd::CreateValueObjectFromAddress(
+    const char *name, uint64_t address, const ExecutionContext &exe_ctx,
+    CompilerType type) {
+  ValueObjectSP valobj_sp(
+      ValueObject::CreateValueObjectFromAddress(name, address, exe_ctx, type));
+  if (valobj_sp)
+    valobj_sp->SetSyntheticChildrenGenerated(true);
+  return valobj_sp;
+}
+
+lldb::ValueObjectSP SyntheticChildrenFrontEnd::CreateValueObjectFromData(
+    const char *name, const DataExtractor &data,
+    const ExecutionContext &exe_ctx, CompilerType type) {
+  ValueObjectSP valobj_sp(
+      ValueObject::CreateValueObjectFromData(name, data, exe_ctx, type));
+  if (valobj_sp)
+    valobj_sp->SetSyntheticChildrenGenerated(true);
+  return valobj_sp;
 }
 
-lldb::ValueObjectSP
-SyntheticChildrenFrontEnd::CreateValueObjectFromExpression (const char* name,
-                                                            const char* expression,
-                                                            const ExecutionContext& exe_ctx)
-{
-    ValueObjectSP valobj_sp(ValueObject::CreateValueObjectFromExpression(name, expression, exe_ctx));
-    if (valobj_sp)
-        valobj_sp->SetSyntheticChildrenGenerated(true);
-    return valobj_sp;
-}
+#ifndef LLDB_DISABLE_PYTHON
 
-lldb::ValueObjectSP
-SyntheticChildrenFrontEnd::CreateValueObjectFromAddress (const char* name,
-                                                         uint64_t address,
-                                                         const ExecutionContext& exe_ctx,
-                                                         CompilerType type)
-{
-    ValueObjectSP valobj_sp(ValueObject::CreateValueObjectFromAddress(name, address, exe_ctx, type));
-    if (valobj_sp)
-        valobj_sp->SetSyntheticChildrenGenerated(true);
-    return valobj_sp;
+ScriptedSyntheticChildren::FrontEnd::FrontEnd(std::string pclass,
+                                              ValueObject &backend)
+    : SyntheticChildrenFrontEnd(backend), m_python_class(pclass),
+      m_wrapper_sp(), m_interpreter(NULL) {
+  if (backend == LLDB_INVALID_UID)
+    return;
+
+  TargetSP target_sp = backend.GetTargetSP();
+
+  if (!target_sp)
+    return;
+
+  m_interpreter =
+      target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
+
+  if (m_interpreter != NULL)
+    m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(
+        m_python_class.c_str(), backend.GetSP());
 }
 
+ScriptedSyntheticChildren::FrontEnd::~FrontEnd() {}
+
 lldb::ValueObjectSP
-SyntheticChildrenFrontEnd::CreateValueObjectFromData (const char* name,
-                                                      const DataExtractor& data,
-                                                      const ExecutionContext& exe_ctx,
-                                                      CompilerType type)
-{
-    ValueObjectSP valobj_sp(ValueObject::CreateValueObjectFromData(name, data, exe_ctx, type));
-    if (valobj_sp)
-        valobj_sp->SetSyntheticChildrenGenerated(true);
-    return valobj_sp;
+ScriptedSyntheticChildren::FrontEnd::GetChildAtIndex(size_t idx) {
+  if (!m_wrapper_sp || !m_interpreter)
+    return lldb::ValueObjectSP();
+
+  return m_interpreter->GetChildAtIndex(m_wrapper_sp, idx);
 }
 
-#ifndef LLDB_DISABLE_PYTHON
+bool ScriptedSyntheticChildren::FrontEnd::IsValid() {
+  return (m_wrapper_sp && m_wrapper_sp->IsValid() && m_interpreter);
+}
 
-ScriptedSyntheticChildren::FrontEnd::FrontEnd(std::string pclass, ValueObject &backend) :
-SyntheticChildrenFrontEnd(backend),
-m_python_class(pclass),
-m_wrapper_sp(),
-m_interpreter(NULL)
-{
-    if (backend == LLDB_INVALID_UID)
-        return;
-    
-    TargetSP target_sp = backend.GetTargetSP();
-    
-    if (!target_sp)
-        return;
-    
-    m_interpreter = target_sp->GetDebugger().GetCommandInterpreter().GetScriptInterpreter();
-    
-    if (m_interpreter != NULL)
-        m_wrapper_sp = m_interpreter->CreateSyntheticScriptedProvider(m_python_class.c_str(), backend.GetSP());
+size_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren() {
+  if (!m_wrapper_sp || m_interpreter == NULL)
+    return 0;
+  return m_interpreter->CalculateNumChildren(m_wrapper_sp, UINT32_MAX);
 }
 
-ScriptedSyntheticChildren::FrontEnd::~FrontEnd()
-{
+size_t ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren(uint32_t max) {
+  if (!m_wrapper_sp || m_interpreter == NULL)
+    return 0;
+  return m_interpreter->CalculateNumChildren(m_wrapper_sp, max);
 }
 
-lldb::ValueObjectSP
-ScriptedSyntheticChildren::FrontEnd::GetChildAtIndex (size_t idx)
-{
-    if (!m_wrapper_sp || !m_interpreter)
-        return lldb::ValueObjectSP();
-    
-    return m_interpreter->GetChildAtIndex(m_wrapper_sp, idx);
+bool ScriptedSyntheticChildren::FrontEnd::Update() {
+  if (!m_wrapper_sp || m_interpreter == NULL)
+    return false;
+
+  return m_interpreter->UpdateSynthProviderInstance(m_wrapper_sp);
 }
 
-bool
-ScriptedSyntheticChildren::FrontEnd::IsValid ()
-{
-    return (m_wrapper_sp && m_wrapper_sp->IsValid() && m_interpreter);
+bool ScriptedSyntheticChildren::FrontEnd::MightHaveChildren() {
+  if (!m_wrapper_sp || m_interpreter == NULL)
+    return false;
+
+  return m_interpreter->MightHaveChildrenSynthProviderInstance(m_wrapper_sp);
 }
 
-size_t
-ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren ()
-{
-    if (!m_wrapper_sp || m_interpreter == NULL)
-        return 0;
-    return m_interpreter->CalculateNumChildren(m_wrapper_sp, UINT32_MAX);
+size_t ScriptedSyntheticChildren::FrontEnd::GetIndexOfChildWithName(
+    const ConstString &name) {
+  if (!m_wrapper_sp || m_interpreter == NULL)
+    return UINT32_MAX;
+  return m_interpreter->GetIndexOfChildWithName(m_wrapper_sp,
+                                                name.GetCString());
 }
 
-size_t
-ScriptedSyntheticChildren::FrontEnd::CalculateNumChildren (uint32_t max)
-{
-    if (!m_wrapper_sp || m_interpreter == NULL)
-        return 0;
-    return m_interpreter->CalculateNumChildren(m_wrapper_sp, max);
-}
-
-bool
-ScriptedSyntheticChildren::FrontEnd::Update ()
-{
-    if (!m_wrapper_sp || m_interpreter == NULL)
-        return false;
-    
-    return m_interpreter->UpdateSynthProviderInstance(m_wrapper_sp);
-}
-
-bool
-ScriptedSyntheticChildren::FrontEnd::MightHaveChildren ()
-{
-    if (!m_wrapper_sp || m_interpreter == NULL)
-        return false;
-    
-    return m_interpreter->MightHaveChildrenSynthProviderInstance(m_wrapper_sp);
+lldb::ValueObjectSP ScriptedSyntheticChildren::FrontEnd::GetSyntheticValue() {
+  if (!m_wrapper_sp || m_interpreter == NULL)
+    return nullptr;
+
+  return m_interpreter->GetSyntheticValue(m_wrapper_sp);
 }
 
-size_t
-ScriptedSyntheticChildren::FrontEnd::GetIndexOfChildWithName (const ConstString &name)
-{
-    if (!m_wrapper_sp || m_interpreter == NULL)
-        return UINT32_MAX;
-    return m_interpreter->GetIndexOfChildWithName(m_wrapper_sp, name.GetCString());
+ConstString ScriptedSyntheticChildren::FrontEnd::GetSyntheticTypeName() {
+  if (!m_wrapper_sp || m_interpreter == NULL)
+    return ConstString();
+
+  return m_interpreter->GetSyntheticTypeName(m_wrapper_sp);
 }
 
-lldb::ValueObjectSP
-ScriptedSyntheticChildren::FrontEnd::GetSyntheticValue ()
-{
-    if (!m_wrapper_sp || m_interpreter == NULL)
-        return nullptr;
-    
-    return m_interpreter->GetSyntheticValue(m_wrapper_sp);
-}
-
-ConstString
-ScriptedSyntheticChildren::FrontEnd::GetSyntheticTypeName ()
-{
-    if (!m_wrapper_sp || m_interpreter == NULL)
-        return ConstString();
-    
-    return m_interpreter->GetSyntheticTypeName(m_wrapper_sp);
-}
-
-std::string
-ScriptedSyntheticChildren::GetDescription()
-{
-    StreamString sstr;
-    sstr.Printf("%s%s%s Python class %s",
-                Cascades() ? "" : " (not cascading)",
-                SkipsPointers() ? " (skip pointers)" : "",
-                SkipsReferences() ? " (skip references)" : "",
-                m_python_class.c_str());
-    
-    return sstr.GetString();
+std::string ScriptedSyntheticChildren::GetDescription() {
+  StreamString sstr;
+  sstr.Printf("%s%s%s Python class %s", Cascades() ? "" : " (not cascading)",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "",
+              m_python_class.c_str());
+
+  return sstr.GetString();
 }
 
 #endif // #ifndef LLDB_DISABLE_PYTHON

Modified: lldb/trunk/source/DataFormatters/TypeValidator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeValidator.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/TypeValidator.cpp (original)
+++ lldb/trunk/source/DataFormatters/TypeValidator.cpp Tue Sep  6 15:57:50 2016
@@ -20,56 +20,39 @@
 using namespace lldb;
 using namespace lldb_private;
 
-TypeValidatorImpl::TypeValidatorImpl(const Flags &flags) :
-    m_flags(flags),
-    m_my_revision(0)
-{
-}
+TypeValidatorImpl::TypeValidatorImpl(const Flags &flags)
+    : m_flags(flags), m_my_revision(0) {}
 
-TypeValidatorImpl::~TypeValidatorImpl()
-{
-}
+TypeValidatorImpl::~TypeValidatorImpl() {}
 
-TypeValidatorImpl::ValidationResult
-TypeValidatorImpl::Success ()
-{
-    return ValidationResult { TypeValidatorResult::Success, "" };
+TypeValidatorImpl::ValidationResult TypeValidatorImpl::Success() {
+  return ValidationResult{TypeValidatorResult::Success, ""};
 }
 
 TypeValidatorImpl::ValidationResult
-TypeValidatorImpl::Failure (std::string message)
-{
-    return ValidationResult { TypeValidatorResult::Failure, message };
+TypeValidatorImpl::Failure(std::string message) {
+  return ValidationResult{TypeValidatorResult::Failure, message};
 }
 
-TypeValidatorImpl_CXX::TypeValidatorImpl_CXX (ValidatorFunction f, std::string d, const TypeValidatorImpl::Flags& flags) :
-    TypeValidatorImpl(flags),
-    m_description(d),
-    m_validator_function(f)
-{
-}
+TypeValidatorImpl_CXX::TypeValidatorImpl_CXX(
+    ValidatorFunction f, std::string d, const TypeValidatorImpl::Flags &flags)
+    : TypeValidatorImpl(flags), m_description(d), m_validator_function(f) {}
 
-TypeValidatorImpl_CXX::~TypeValidatorImpl_CXX()
-{
-}
+TypeValidatorImpl_CXX::~TypeValidatorImpl_CXX() {}
 
 TypeValidatorImpl::ValidationResult
-TypeValidatorImpl_CXX::FormatObject (ValueObject *valobj) const
-{
-    if (!valobj)
-        return Success(); // I guess there's nothing wrong with a null valueobject..
-    
-    return m_validator_function(valobj);
+TypeValidatorImpl_CXX::FormatObject(ValueObject *valobj) const {
+  if (!valobj)
+    return Success(); // I guess there's nothing wrong with a null valueobject..
+
+  return m_validator_function(valobj);
 }
 
-std::string
-TypeValidatorImpl_CXX::GetDescription()
-{
-    StreamString sstr;
-    sstr.Printf ("%s%s%s%s",
-                 m_description.c_str(),
-                 Cascades() ? "" : " (not cascading)",
-                 SkipsPointers() ? " (skip pointers)" : "",
-                 SkipsReferences() ? " (skip references)" : "");
-    return sstr.GetString();
+std::string TypeValidatorImpl_CXX::GetDescription() {
+  StreamString sstr;
+  sstr.Printf("%s%s%s%s", m_description.c_str(),
+              Cascades() ? "" : " (not cascading)",
+              SkipsPointers() ? " (skip pointers)" : "",
+              SkipsReferences() ? " (skip references)" : "");
+  return sstr.GetString();
 }

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- ValueObjectPrinter.cpp -------------------------------------*- C++ -*-===//
+//===-- ValueObjectPrinter.cpp -------------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -23,952 +24,824 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ValueObjectPrinter::ValueObjectPrinter (ValueObject* valobj,
-                                        Stream* s)
-{
-    if (valobj)
-    {
-        DumpValueObjectOptions options(*valobj);
-        Init (valobj,s,options,m_options.m_max_ptr_depth,0, nullptr);
-    }
-    else
-    {
-        DumpValueObjectOptions options;
-        Init (valobj,s,options,m_options.m_max_ptr_depth,0, nullptr);
-    }
+ValueObjectPrinter::ValueObjectPrinter(ValueObject *valobj, Stream *s) {
+  if (valobj) {
+    DumpValueObjectOptions options(*valobj);
+    Init(valobj, s, options, m_options.m_max_ptr_depth, 0, nullptr);
+  } else {
+    DumpValueObjectOptions options;
+    Init(valobj, s, options, m_options.m_max_ptr_depth, 0, nullptr);
+  }
+}
+
+ValueObjectPrinter::ValueObjectPrinter(ValueObject *valobj, Stream *s,
+                                       const DumpValueObjectOptions &options) {
+  Init(valobj, s, options, m_options.m_max_ptr_depth, 0, nullptr);
+}
+
+ValueObjectPrinter::ValueObjectPrinter(
+    ValueObject *valobj, Stream *s, const DumpValueObjectOptions &options,
+    const DumpValueObjectOptions::PointerDepth &ptr_depth, uint32_t curr_depth,
+    InstancePointersSetSP printed_instance_pointers) {
+  Init(valobj, s, options, ptr_depth, curr_depth, printed_instance_pointers);
+}
+
+void ValueObjectPrinter::Init(
+    ValueObject *valobj, Stream *s, const DumpValueObjectOptions &options,
+    const DumpValueObjectOptions::PointerDepth &ptr_depth, uint32_t curr_depth,
+    InstancePointersSetSP printed_instance_pointers) {
+  m_orig_valobj = valobj;
+  m_valobj = nullptr;
+  m_stream = s;
+  m_options = options;
+  m_ptr_depth = ptr_depth;
+  m_curr_depth = curr_depth;
+  assert(m_orig_valobj && "cannot print a NULL ValueObject");
+  assert(m_stream && "cannot print to a NULL Stream");
+  m_should_print = eLazyBoolCalculate;
+  m_is_nil = eLazyBoolCalculate;
+  m_is_uninit = eLazyBoolCalculate;
+  m_is_ptr = eLazyBoolCalculate;
+  m_is_ref = eLazyBoolCalculate;
+  m_is_aggregate = eLazyBoolCalculate;
+  m_is_instance_ptr = eLazyBoolCalculate;
+  m_summary_formatter = {nullptr, false};
+  m_value.assign("");
+  m_summary.assign("");
+  m_error.assign("");
+  m_val_summary_ok = false;
+  m_printed_instance_pointers =
+      printed_instance_pointers
+          ? printed_instance_pointers
+          : InstancePointersSetSP(new InstancePointersSet());
 }
 
-ValueObjectPrinter::ValueObjectPrinter (ValueObject* valobj,
-                                        Stream* s,
-                                        const DumpValueObjectOptions& options)
-{
-    Init(valobj,s,options,m_options.m_max_ptr_depth,0, nullptr);
-}
-
-ValueObjectPrinter::ValueObjectPrinter (ValueObject* valobj,
-                                        Stream* s,
-                                        const DumpValueObjectOptions& options,
-                                        const DumpValueObjectOptions::PointerDepth& ptr_depth,
-                                        uint32_t curr_depth,
-                                        InstancePointersSetSP printed_instance_pointers)
-{
-    Init(valobj,s,options,ptr_depth,curr_depth, printed_instance_pointers);
-}
-
-void
-ValueObjectPrinter::Init (ValueObject* valobj,
-                          Stream* s,
-                          const DumpValueObjectOptions& options,
-                          const DumpValueObjectOptions::PointerDepth& ptr_depth,
-                          uint32_t curr_depth,
-                          InstancePointersSetSP printed_instance_pointers)
-{
-    m_orig_valobj = valobj;
-    m_valobj = nullptr;
-    m_stream = s;
-    m_options = options;
-    m_ptr_depth = ptr_depth;
-    m_curr_depth = curr_depth;
-    assert (m_orig_valobj && "cannot print a NULL ValueObject");
-    assert (m_stream && "cannot print to a NULL Stream");
-    m_should_print = eLazyBoolCalculate;
-    m_is_nil = eLazyBoolCalculate;
-    m_is_uninit = eLazyBoolCalculate;
-    m_is_ptr = eLazyBoolCalculate;
-    m_is_ref = eLazyBoolCalculate;
-    m_is_aggregate = eLazyBoolCalculate;
-    m_is_instance_ptr = eLazyBoolCalculate;
-    m_summary_formatter = {nullptr,false};
-    m_value.assign("");
-    m_summary.assign("");
-    m_error.assign("");
-    m_val_summary_ok = false;
-    m_printed_instance_pointers = printed_instance_pointers ? printed_instance_pointers : InstancePointersSetSP(new InstancePointersSet());
-}
-
-bool
-ValueObjectPrinter::PrintValueObject ()
-{
-    if (!GetMostSpecializedValue () || m_valobj == nullptr)
-        return false;
-    
-    if (ShouldPrintValueObject())
-    {
-        PrintValidationMarkerIfNeeded();
-        
-        PrintLocationIfNeeded();
-        m_stream->Indent();
-        
-        PrintDecl();
-    }
-
-    bool value_printed = false;
-    bool summary_printed = false;
-    
-    m_val_summary_ok = PrintValueAndSummaryIfNeeded (value_printed,summary_printed);
+bool ValueObjectPrinter::PrintValueObject() {
+  if (!GetMostSpecializedValue() || m_valobj == nullptr)
+    return false;
 
-    if (m_val_summary_ok)
-        PrintChildrenIfNeeded (value_printed, summary_printed);
-    else
-        m_stream->EOL();
-    
-    PrintValidationErrorIfNeeded();
-    
-    return true;
+  if (ShouldPrintValueObject()) {
+    PrintValidationMarkerIfNeeded();
+
+    PrintLocationIfNeeded();
+    m_stream->Indent();
+
+    PrintDecl();
+  }
+
+  bool value_printed = false;
+  bool summary_printed = false;
+
+  m_val_summary_ok =
+      PrintValueAndSummaryIfNeeded(value_printed, summary_printed);
+
+  if (m_val_summary_ok)
+    PrintChildrenIfNeeded(value_printed, summary_printed);
+  else
+    m_stream->EOL();
+
+  PrintValidationErrorIfNeeded();
+
+  return true;
 }
 
-bool
-ValueObjectPrinter::GetMostSpecializedValue ()
-{
-    if (m_valobj)
-        return true;
-    bool update_success = m_orig_valobj->UpdateValueIfNeeded (true);
-    if (!update_success)
-    {
-        m_valobj = m_orig_valobj;
-    }
-    else
-    {
-        if (m_orig_valobj->IsDynamic())
-        {
-            if (m_options.m_use_dynamic == eNoDynamicValues)
-            {
-                ValueObject *static_value = m_orig_valobj->GetStaticValue().get();
-                if (static_value)
-                    m_valobj = static_value;
-                else
-                    m_valobj = m_orig_valobj;
-            }
-            else
-                m_valobj = m_orig_valobj;
-        }
+bool ValueObjectPrinter::GetMostSpecializedValue() {
+  if (m_valobj)
+    return true;
+  bool update_success = m_orig_valobj->UpdateValueIfNeeded(true);
+  if (!update_success) {
+    m_valobj = m_orig_valobj;
+  } else {
+    if (m_orig_valobj->IsDynamic()) {
+      if (m_options.m_use_dynamic == eNoDynamicValues) {
+        ValueObject *static_value = m_orig_valobj->GetStaticValue().get();
+        if (static_value)
+          m_valobj = static_value;
         else
-        {
-            if (m_options.m_use_dynamic != eNoDynamicValues)
-            {
-                ValueObject *dynamic_value = m_orig_valobj->GetDynamicValue(m_options.m_use_dynamic).get();
-                if (dynamic_value)
-                    m_valobj = dynamic_value;
-                else
-                    m_valobj = m_orig_valobj;
-            }
-            else
-                m_valobj = m_orig_valobj;
-        }
-        
-        if (m_valobj->IsSynthetic())
-        {
-            if (m_options.m_use_synthetic == false)
-            {
-                ValueObject *non_synthetic = m_valobj->GetNonSyntheticValue().get();
-                if (non_synthetic)
-                    m_valobj = non_synthetic;
-            }
-        }
+          m_valobj = m_orig_valobj;
+      } else
+        m_valobj = m_orig_valobj;
+    } else {
+      if (m_options.m_use_dynamic != eNoDynamicValues) {
+        ValueObject *dynamic_value =
+            m_orig_valobj->GetDynamicValue(m_options.m_use_dynamic).get();
+        if (dynamic_value)
+          m_valobj = dynamic_value;
         else
-        {
-            if (m_options.m_use_synthetic == true)
-            {
-                ValueObject *synthetic = m_valobj->GetSyntheticValue().get();
-                if (synthetic)
-                    m_valobj = synthetic;
-            }
-        }
+          m_valobj = m_orig_valobj;
+      } else
+        m_valobj = m_orig_valobj;
     }
-    m_compiler_type = m_valobj->GetCompilerType();
-    m_type_flags = m_compiler_type.GetTypeInfo ();
+
+    if (m_valobj->IsSynthetic()) {
+      if (m_options.m_use_synthetic == false) {
+        ValueObject *non_synthetic = m_valobj->GetNonSyntheticValue().get();
+        if (non_synthetic)
+          m_valobj = non_synthetic;
+      }
+    } else {
+      if (m_options.m_use_synthetic == true) {
+        ValueObject *synthetic = m_valobj->GetSyntheticValue().get();
+        if (synthetic)
+          m_valobj = synthetic;
+      }
+    }
+  }
+  m_compiler_type = m_valobj->GetCompilerType();
+  m_type_flags = m_compiler_type.GetTypeInfo();
+  return true;
+}
+
+const char *ValueObjectPrinter::GetDescriptionForDisplay() {
+  const char *str = m_valobj->GetObjectDescription();
+  if (!str)
+    str = m_valobj->GetSummaryAsCString();
+  if (!str)
+    str = m_valobj->GetValueAsCString();
+  return str;
+}
+
+const char *ValueObjectPrinter::GetRootNameForDisplay(const char *if_fail) {
+  const char *root_valobj_name = m_options.m_root_valobj_name.empty()
+                                     ? m_valobj->GetName().AsCString()
+                                     : m_options.m_root_valobj_name.c_str();
+  return root_valobj_name ? root_valobj_name : if_fail;
+}
+
+bool ValueObjectPrinter::ShouldPrintValueObject() {
+  if (m_should_print == eLazyBoolCalculate)
+    m_should_print =
+        (m_options.m_flat_output == false || m_type_flags.Test(eTypeHasValue))
+            ? eLazyBoolYes
+            : eLazyBoolNo;
+  return m_should_print == eLazyBoolYes;
+}
+
+bool ValueObjectPrinter::IsNil() {
+  if (m_is_nil == eLazyBoolCalculate)
+    m_is_nil = m_valobj->IsNilReference() ? eLazyBoolYes : eLazyBoolNo;
+  return m_is_nil == eLazyBoolYes;
+}
+
+bool ValueObjectPrinter::IsUninitialized() {
+  if (m_is_uninit == eLazyBoolCalculate)
+    m_is_uninit =
+        m_valobj->IsUninitializedReference() ? eLazyBoolYes : eLazyBoolNo;
+  return m_is_uninit == eLazyBoolYes;
+}
+
+bool ValueObjectPrinter::IsPtr() {
+  if (m_is_ptr == eLazyBoolCalculate)
+    m_is_ptr = m_type_flags.Test(eTypeIsPointer) ? eLazyBoolYes : eLazyBoolNo;
+  return m_is_ptr == eLazyBoolYes;
+}
+
+bool ValueObjectPrinter::IsRef() {
+  if (m_is_ref == eLazyBoolCalculate)
+    m_is_ref = m_type_flags.Test(eTypeIsReference) ? eLazyBoolYes : eLazyBoolNo;
+  return m_is_ref == eLazyBoolYes;
+}
+
+bool ValueObjectPrinter::IsAggregate() {
+  if (m_is_aggregate == eLazyBoolCalculate)
+    m_is_aggregate =
+        m_type_flags.Test(eTypeHasChildren) ? eLazyBoolYes : eLazyBoolNo;
+  return m_is_aggregate == eLazyBoolYes;
+}
+
+bool ValueObjectPrinter::IsInstancePointer() {
+  // you need to do this check on the value's clang type
+  if (m_is_instance_ptr == eLazyBoolCalculate)
+    m_is_instance_ptr = (m_valobj->GetValue().GetCompilerType().GetTypeInfo() &
+                         eTypeInstanceIsPointer) != 0
+                            ? eLazyBoolYes
+                            : eLazyBoolNo;
+  if ((eLazyBoolYes == m_is_instance_ptr) && m_valobj->IsBaseClass())
+    m_is_instance_ptr = eLazyBoolNo;
+  return m_is_instance_ptr == eLazyBoolYes;
+}
+
+bool ValueObjectPrinter::PrintLocationIfNeeded() {
+  if (m_options.m_show_location) {
+    m_stream->Printf("%s: ", m_valobj->GetLocationAsCString());
     return true;
+  }
+  return false;
 }
 
-const char*
-ValueObjectPrinter::GetDescriptionForDisplay ()
-{
-    const char* str = m_valobj->GetObjectDescription();
-    if (!str)
-        str = m_valobj->GetSummaryAsCString();
-    if (!str)
-        str = m_valobj->GetValueAsCString();
-    return str;
-}
-
-const char*
-ValueObjectPrinter::GetRootNameForDisplay (const char* if_fail)
-{
-    const char *root_valobj_name = m_options.m_root_valobj_name.empty() ?
-        m_valobj->GetName().AsCString() :
-        m_options.m_root_valobj_name.c_str();
-    return root_valobj_name ? root_valobj_name : if_fail;
-}
-
-bool
-ValueObjectPrinter::ShouldPrintValueObject ()
-{
-    if (m_should_print == eLazyBoolCalculate)
-        m_should_print = (m_options.m_flat_output == false || m_type_flags.Test (eTypeHasValue)) ? eLazyBoolYes : eLazyBoolNo;
-    return m_should_print == eLazyBoolYes;
-}
-
-bool
-ValueObjectPrinter::IsNil ()
-{
-    if (m_is_nil == eLazyBoolCalculate)
-        m_is_nil = m_valobj->IsNilReference() ? eLazyBoolYes : eLazyBoolNo;
-    return m_is_nil == eLazyBoolYes;
-}
-
-bool
-ValueObjectPrinter::IsUninitialized ()
-{
-    if (m_is_uninit == eLazyBoolCalculate)
-        m_is_uninit = m_valobj->IsUninitializedReference() ? eLazyBoolYes : eLazyBoolNo;
-    return m_is_uninit == eLazyBoolYes;
-}
-
-bool
-ValueObjectPrinter::IsPtr ()
-{
-    if (m_is_ptr == eLazyBoolCalculate)
-        m_is_ptr = m_type_flags.Test (eTypeIsPointer) ? eLazyBoolYes : eLazyBoolNo;
-    return m_is_ptr == eLazyBoolYes;
-}
-
-bool
-ValueObjectPrinter::IsRef ()
-{
-    if (m_is_ref == eLazyBoolCalculate)
-        m_is_ref = m_type_flags.Test (eTypeIsReference) ? eLazyBoolYes : eLazyBoolNo;
-    return m_is_ref == eLazyBoolYes;
-}
-
-bool
-ValueObjectPrinter::IsAggregate ()
-{
-    if (m_is_aggregate == eLazyBoolCalculate)
-        m_is_aggregate = m_type_flags.Test (eTypeHasChildren) ? eLazyBoolYes : eLazyBoolNo;
-    return m_is_aggregate == eLazyBoolYes;
-}
-
-bool
-ValueObjectPrinter::IsInstancePointer ()
-{
-    // you need to do this check on the value's clang type
-    if (m_is_instance_ptr == eLazyBoolCalculate)
-        m_is_instance_ptr = (m_valobj->GetValue().GetCompilerType().GetTypeInfo() & eTypeInstanceIsPointer) != 0 ? eLazyBoolYes : eLazyBoolNo;
-    if ((eLazyBoolYes == m_is_instance_ptr) && m_valobj->IsBaseClass())
-        m_is_instance_ptr = eLazyBoolNo;
-    return m_is_instance_ptr == eLazyBoolYes;
-}
-
-bool
-ValueObjectPrinter::PrintLocationIfNeeded ()
-{
-    if (m_options.m_show_location)
-    {
-        m_stream->Printf("%s: ", m_valobj->GetLocationAsCString());
-        return true;
-    }
-    return false;
+void ValueObjectPrinter::PrintDecl() {
+  bool show_type = true;
+  // if we are at the root-level and been asked to hide the root's type, then
+  // hide it
+  if (m_curr_depth == 0 && m_options.m_hide_root_type)
+    show_type = false;
+  else
+    // otherwise decide according to the usual rules (asked to show types -
+    // always at the root level)
+    show_type = m_options.m_show_types ||
+                (m_curr_depth == 0 && !m_options.m_flat_output);
+
+  StreamString typeName;
+
+  // always show the type at the root level if it is invalid
+  if (show_type) {
+    // Some ValueObjects don't have types (like registers sets). Only print
+    // the type if there is one to print
+    ConstString type_name;
+    if (m_compiler_type.IsValid()) {
+      if (m_options.m_use_type_display_name)
+        type_name = m_valobj->GetDisplayTypeName();
+      else
+        type_name = m_valobj->GetQualifiedTypeName();
+    } else {
+      // only show an invalid type name if the user explicitly triggered
+      // show_type
+      if (m_options.m_show_types)
+        type_name = ConstString("<invalid type>");
+      else
+        type_name.Clear();
+    }
+
+    if (type_name) {
+      std::string type_name_str(type_name.GetCString());
+      if (m_options.m_hide_pointer_value) {
+        for (auto iter = type_name_str.find(" *"); iter != std::string::npos;
+             iter = type_name_str.find(" *")) {
+          type_name_str.erase(iter, 2);
+        }
+      }
+      typeName.Printf("%s", type_name_str.c_str());
+    }
+  }
+
+  StreamString varName;
+
+  if (m_options.m_flat_output) {
+    // If we are showing types, also qualify the C++ base classes
+    const bool qualify_cxx_base_classes = show_type;
+    if (!m_options.m_hide_name) {
+      m_valobj->GetExpressionPath(varName, qualify_cxx_base_classes);
+    }
+  } else if (!m_options.m_hide_name) {
+    const char *name_cstr = GetRootNameForDisplay("");
+    varName.Printf("%s", name_cstr);
+  }
+
+  bool decl_printed = false;
+  if (!m_options.m_decl_printing_helper) {
+    // if the user didn't give us a custom helper, pick one based upon the
+    // language, either the one that this printer is bound to, or the preferred
+    // one for the ValueObject
+    lldb::LanguageType lang_type =
+        (m_options.m_varformat_language == lldb::eLanguageTypeUnknown)
+            ? m_valobj->GetPreferredDisplayLanguage()
+            : m_options.m_varformat_language;
+    if (Language *lang_plugin = Language::FindPlugin(lang_type)) {
+      m_options.m_decl_printing_helper = lang_plugin->GetDeclPrintingHelper();
+    }
+  }
+
+  if (m_options.m_decl_printing_helper) {
+    ConstString type_name_cstr(typeName.GetData());
+    ConstString var_name_cstr(varName.GetData());
+
+    StreamString dest_stream;
+    if (m_options.m_decl_printing_helper(type_name_cstr, var_name_cstr,
+                                         m_options, dest_stream)) {
+      decl_printed = true;
+      m_stream->Printf("%s", dest_stream.GetData());
+    }
+  }
+
+  // if the helper failed, or there is none, do a default thing
+  if (!decl_printed) {
+    if (typeName.GetSize())
+      m_stream->Printf("(%s) ", typeName.GetData());
+    if (varName.GetSize())
+      m_stream->Printf("%s =", varName.GetData());
+    else if (!m_options.m_hide_name)
+      m_stream->Printf(" =");
+  }
 }
 
-void
-ValueObjectPrinter::PrintDecl ()
-{
-    bool show_type = true;
-    // if we are at the root-level and been asked to hide the root's type, then hide it
-    if (m_curr_depth == 0 && m_options.m_hide_root_type)
-        show_type = false;
-    else
-        // otherwise decide according to the usual rules (asked to show types - always at the root level)
-        show_type = m_options.m_show_types || (m_curr_depth == 0 && !m_options.m_flat_output);
-    
-    StreamString typeName;
-    
-    // always show the type at the root level if it is invalid
-    if (show_type)
-    {
-        // Some ValueObjects don't have types (like registers sets). Only print
-        // the type if there is one to print
-        ConstString type_name;
-        if (m_compiler_type.IsValid())
-        {
-            if (m_options.m_use_type_display_name)
-                type_name = m_valobj->GetDisplayTypeName();
-            else
-                type_name = m_valobj->GetQualifiedTypeName();
-        }
-        else
-        {
-            // only show an invalid type name if the user explicitly triggered show_type
-            if (m_options.m_show_types)
-                type_name = ConstString("<invalid type>");
-            else
-                type_name.Clear();
-        }
-        
-        if (type_name)
-        {
-            std::string type_name_str(type_name.GetCString());
-            if (m_options.m_hide_pointer_value)
-            {
-                for(auto iter = type_name_str.find(" *");
-                    iter != std::string::npos;
-                    iter = type_name_str.find(" *"))
-                {
-                    type_name_str.erase(iter, 2);
-                }
-            }
-            typeName.Printf("%s", type_name_str.c_str());
-        }
-    }
-    
-    StreamString varName;
-    
-    if (m_options.m_flat_output)
-    {
-        // If we are showing types, also qualify the C++ base classes
-        const bool qualify_cxx_base_classes = show_type;
-        if (!m_options.m_hide_name)
-        {
-            m_valobj->GetExpressionPath(varName, qualify_cxx_base_classes);
-        }
-    }
-    else if (!m_options.m_hide_name)
-    {
-        const char *name_cstr = GetRootNameForDisplay("");
-        varName.Printf ("%s", name_cstr);
-    }
-    
-    bool decl_printed = false;
-    if (!m_options.m_decl_printing_helper)
-    {
-        // if the user didn't give us a custom helper, pick one based upon the language, either the one that this printer is bound to, or the preferred one for the ValueObject
-        lldb::LanguageType lang_type = (m_options.m_varformat_language == lldb::eLanguageTypeUnknown) ? m_valobj->GetPreferredDisplayLanguage() : m_options.m_varformat_language;
-        if (Language *lang_plugin = Language::FindPlugin(lang_type))
-        {
-            m_options.m_decl_printing_helper = lang_plugin->GetDeclPrintingHelper();
-        }
-    }
-    
-    if (m_options.m_decl_printing_helper)
-    {
-        ConstString type_name_cstr(typeName.GetData());
-        ConstString var_name_cstr(varName.GetData());
-        
-        StreamString dest_stream;
-        if (m_options.m_decl_printing_helper (type_name_cstr,
-                                              var_name_cstr,
-                                              m_options,
-                                              dest_stream))
-        {
-            decl_printed = true;
-            m_stream->Printf("%s", dest_stream.GetData());
-        }
-    }
-    
-    // if the helper failed, or there is none, do a default thing
-    if (!decl_printed)
-    {
-        if (typeName.GetSize())
-            m_stream->Printf("(%s) ", typeName.GetData());
-        if (varName.GetSize())
-            m_stream->Printf("%s =", varName.GetData());
-        else if (!m_options.m_hide_name)
-            m_stream->Printf(" =");
-    }
+bool ValueObjectPrinter::CheckScopeIfNeeded() {
+  if (m_options.m_scope_already_checked)
+    return true;
+  return m_valobj->IsInScope();
 }
 
-bool
-ValueObjectPrinter::CheckScopeIfNeeded ()
-{
-    if (m_options.m_scope_already_checked)
+TypeSummaryImpl *ValueObjectPrinter::GetSummaryFormatter(bool null_if_omitted) {
+  if (m_summary_formatter.second == false) {
+    TypeSummaryImpl *entry = m_options.m_summary_sp
+                                 ? m_options.m_summary_sp.get()
+                                 : m_valobj->GetSummaryFormat().get();
+
+    if (m_options.m_omit_summary_depth > 0)
+      entry = NULL;
+    m_summary_formatter.first = entry;
+    m_summary_formatter.second = true;
+  }
+  if (m_options.m_omit_summary_depth > 0 && null_if_omitted)
+    return nullptr;
+  return m_summary_formatter.first;
+}
+
+static bool IsPointerValue(const CompilerType &type) {
+  Flags type_flags(type.GetTypeInfo());
+  if (type_flags.AnySet(eTypeInstanceIsPointer | eTypeIsPointer))
+    return type_flags.AllClear(eTypeIsBuiltIn);
+  return false;
+}
+
+void ValueObjectPrinter::GetValueSummaryError(std::string &value,
+                                              std::string &summary,
+                                              std::string &error) {
+  lldb::Format format = m_options.m_format;
+  // if I am printing synthetized elements, apply the format to those elements
+  // only
+  if (m_options.m_element_count > 0)
+    m_valobj->GetValueAsCString(lldb::eFormatDefault, value);
+  else if (format != eFormatDefault && format != m_valobj->GetFormat())
+    m_valobj->GetValueAsCString(format, value);
+  else {
+    const char *val_cstr = m_valobj->GetValueAsCString();
+    if (val_cstr)
+      value.assign(val_cstr);
+  }
+  const char *err_cstr = m_valobj->GetError().AsCString();
+  if (err_cstr)
+    error.assign(err_cstr);
+
+  if (ShouldPrintValueObject()) {
+    if (IsNil())
+      summary.assign("nil");
+    else if (IsUninitialized())
+      summary.assign("<uninitialized>");
+    else if (m_options.m_omit_summary_depth == 0) {
+      TypeSummaryImpl *entry = GetSummaryFormatter();
+      if (entry)
+        m_valobj->GetSummaryAsCString(entry, summary,
+                                      m_options.m_varformat_language);
+      else {
+        const char *sum_cstr =
+            m_valobj->GetSummaryAsCString(m_options.m_varformat_language);
+        if (sum_cstr)
+          summary.assign(sum_cstr);
+      }
+    }
+  }
+}
+
+bool ValueObjectPrinter::PrintValueAndSummaryIfNeeded(bool &value_printed,
+                                                      bool &summary_printed) {
+  bool error_printed = false;
+  if (ShouldPrintValueObject()) {
+    if (!CheckScopeIfNeeded())
+      m_error.assign("out of scope");
+    if (m_error.empty()) {
+      GetValueSummaryError(m_value, m_summary, m_error);
+    }
+    if (m_error.size()) {
+      // we need to support scenarios in which it is actually fine for a value
+      // to have no type
+      // but - on the other hand - if we get an error *AND* have no type, we try
+      // to get out
+      // gracefully, since most often that combination means "could not resolve
+      // a type"
+      // and the default failure mode is quite ugly
+      if (!m_compiler_type.IsValid()) {
+        m_stream->Printf(" <could not resolve type>");
+        return false;
+      }
+
+      error_printed = true;
+      m_stream->Printf(" <%s>\n", m_error.c_str());
+    } else {
+      // Make sure we have a value and make sure the summary didn't
+      // specify that the value should not be printed - and do not print
+      // the value if this thing is nil
+      // (but show the value if the user passes a format explicitly)
+      TypeSummaryImpl *entry = GetSummaryFormatter();
+      if (!IsNil() && !IsUninitialized() && !m_value.empty() &&
+          (entry == NULL || (entry->DoesPrintValue(m_valobj) ||
+                             m_options.m_format != eFormatDefault) ||
+           m_summary.empty()) &&
+          !m_options.m_hide_value) {
+        if (m_options.m_hide_pointer_value &&
+            IsPointerValue(m_valobj->GetCompilerType())) {
+        } else {
+          m_stream->Printf(" %s", m_value.c_str());
+          value_printed = true;
+        }
+      }
+
+      if (m_summary.size()) {
+        m_stream->Printf(" %s", m_summary.c_str());
+        summary_printed = true;
+      }
+    }
+  }
+  return !error_printed;
+}
+
+bool ValueObjectPrinter::PrintObjectDescriptionIfNeeded(bool value_printed,
+                                                        bool summary_printed) {
+  if (ShouldPrintValueObject()) {
+    // let's avoid the overly verbose no description error for a nil thing
+    if (m_options.m_use_objc && !IsNil() && !IsUninitialized() &&
+        (m_options.m_element_count == 0)) {
+      if (!m_options.m_hide_value || !m_options.m_hide_name)
+        m_stream->Printf(" ");
+      const char *object_desc = nullptr;
+      if (value_printed || summary_printed)
+        object_desc = m_valobj->GetObjectDescription();
+      else
+        object_desc = GetDescriptionForDisplay();
+      if (object_desc && *object_desc) {
+        m_stream->Printf("%s\n", object_desc);
         return true;
-    return m_valobj->IsInScope();
+      } else if (value_printed == false && summary_printed == false)
+        return true;
+      else
+        return false;
+    }
+  }
+  return true;
 }
 
-TypeSummaryImpl*
-ValueObjectPrinter::GetSummaryFormatter (bool null_if_omitted)
-{
-    if (m_summary_formatter.second == false)
-    {
-        TypeSummaryImpl* entry = m_options.m_summary_sp ? m_options.m_summary_sp.get() : m_valobj->GetSummaryFormat().get();
-        
-        if (m_options.m_omit_summary_depth > 0)
-            entry = NULL;
-        m_summary_formatter.first = entry;
-        m_summary_formatter.second = true;
-    }
-    if (m_options.m_omit_summary_depth > 0 && null_if_omitted)
-        return nullptr;
-    return m_summary_formatter.first;
-}
-
-static bool
-IsPointerValue (const CompilerType &type)
-{
-    Flags type_flags(type.GetTypeInfo());
-    if (type_flags.AnySet(eTypeInstanceIsPointer | eTypeIsPointer))
-        return type_flags.AllClear(eTypeIsBuiltIn);
+bool DumpValueObjectOptions::PointerDepth::CanAllowExpansion(
+    bool is_root, TypeSummaryImpl *entry, ValueObject *valobj,
+    const std::string &summary) {
+  switch (m_mode) {
+  case Mode::Always:
+    return (m_count > 0);
+  case Mode::Never:
     return false;
+  case Mode::Default:
+    if (is_root)
+      m_count = std::min<decltype(m_count)>(m_count, 1);
+    return m_count > 0;
+  case Mode::Formatters:
+    if (!entry || entry->DoesPrintChildren(valobj) || summary.empty())
+      return m_count > 0;
+    return false;
+  }
+  return false;
 }
 
-void
-ValueObjectPrinter::GetValueSummaryError (std::string& value,
-                                          std::string& summary,
-                                          std::string& error)
-{
-    lldb::Format format = m_options.m_format;
-    // if I am printing synthetized elements, apply the format to those elements only
-    if (m_options.m_element_count > 0)
-        m_valobj->GetValueAsCString(lldb::eFormatDefault, value);
-    else if (format != eFormatDefault && format != m_valobj->GetFormat())
-        m_valobj->GetValueAsCString(format, value);
-    else
-    {
-        const char* val_cstr = m_valobj->GetValueAsCString();
-        if (val_cstr)
-            value.assign(val_cstr);
-    }
-    const char* err_cstr = m_valobj->GetError().AsCString();
-    if (err_cstr)
-        error.assign(err_cstr);
-    
-    if (ShouldPrintValueObject())
-    {
-        if (IsNil())
-            summary.assign("nil");
-        else if (IsUninitialized())
-            summary.assign("<uninitialized>");
-        else if (m_options.m_omit_summary_depth == 0)
-        {
-            TypeSummaryImpl* entry = GetSummaryFormatter();
-            if (entry)
-                m_valobj->GetSummaryAsCString(entry, summary, m_options.m_varformat_language);
-            else
-            {
-                const char* sum_cstr = m_valobj->GetSummaryAsCString(m_options.m_varformat_language);
-                if (sum_cstr)
-                    summary.assign(sum_cstr);
-            }
-        }
-    }
+bool DumpValueObjectOptions::PointerDepth::CanAllowExpansion() const {
+  switch (m_mode) {
+  case Mode::Always:
+  case Mode::Default:
+  case Mode::Formatters:
+    return (m_count > 0);
+  case Mode::Never:
+    return false;
+  }
+  return false;
 }
 
-bool
-ValueObjectPrinter::PrintValueAndSummaryIfNeeded (bool& value_printed,
-                                                  bool& summary_printed)
-{
-    bool error_printed = false;
-    if (ShouldPrintValueObject())
-    {
-        if (!CheckScopeIfNeeded())
-            m_error.assign("out of scope");
-        if (m_error.empty())
-        {
-            GetValueSummaryError(m_value, m_summary, m_error);
-        }
-        if (m_error.size())
-        {
-            // we need to support scenarios in which it is actually fine for a value to have no type
-            // but - on the other hand - if we get an error *AND* have no type, we try to get out
-            // gracefully, since most often that combination means "could not resolve a type"
-            // and the default failure mode is quite ugly
-            if (!m_compiler_type.IsValid())
-            {
-                m_stream->Printf(" <could not resolve type>");
-                return false;
-            }
-            
-            error_printed = true;
-            m_stream->Printf (" <%s>\n", m_error.c_str());
-        }
-        else
-        {
-            // Make sure we have a value and make sure the summary didn't
-            // specify that the value should not be printed - and do not print
-            // the value if this thing is nil
-            // (but show the value if the user passes a format explicitly)
-            TypeSummaryImpl* entry = GetSummaryFormatter();
-            if (!IsNil() && !IsUninitialized() && !m_value.empty() && (entry == NULL || (entry->DoesPrintValue(m_valobj) || m_options.m_format != eFormatDefault) || m_summary.empty()) && !m_options.m_hide_value)
-            {
-                if (m_options.m_hide_pointer_value && IsPointerValue(m_valobj->GetCompilerType())) {}
-                else
-                {
-                    m_stream->Printf(" %s", m_value.c_str());
-                    value_printed = true;
-                }
-            }
-            
-            if (m_summary.size())
-            {
-                m_stream->Printf(" %s", m_summary.c_str());
-                summary_printed = true;
-            }
-        }
-    }
-    return !error_printed;
-}
+bool ValueObjectPrinter::ShouldPrintChildren(
+    bool is_failed_description,
+    DumpValueObjectOptions::PointerDepth &curr_ptr_depth) {
+  const bool is_ref = IsRef();
+  const bool is_ptr = IsPtr();
+  const bool is_uninit = IsUninitialized();
 
-bool
-ValueObjectPrinter::PrintObjectDescriptionIfNeeded (bool value_printed,
-                                                    bool summary_printed)
-{
-    if (ShouldPrintValueObject())
-    {
-        // let's avoid the overly verbose no description error for a nil thing
-        if (m_options.m_use_objc && !IsNil() && !IsUninitialized() && (m_options.m_element_count == 0))
-        {
-            if (!m_options.m_hide_value || !m_options.m_hide_name)
-                m_stream->Printf(" ");
-            const char *object_desc = nullptr;
-            if (value_printed || summary_printed)
-                object_desc = m_valobj->GetObjectDescription();
-            else
-                object_desc = GetDescriptionForDisplay();
-            if (object_desc && *object_desc)
-            {
-                m_stream->Printf("%s\n", object_desc);
-                return true;
-            }
-            else if (value_printed == false && summary_printed == false)
-                return true;
-            else
-                return false;
-        }
-    }
+  if (is_uninit)
+    return false;
+
+  // if the user has specified an element count, always print children
+  // as it is explicit user demand being honored
+  if (m_options.m_element_count > 0)
     return true;
-}
 
-bool
-DumpValueObjectOptions::PointerDepth::CanAllowExpansion (bool is_root,
-                                                         TypeSummaryImpl* entry,
-                                                         ValueObject *valobj,
-                                                         const std::string& summary)
-{
-    switch (m_mode)
-    {
-        case Mode::Always:
-            return (m_count > 0);
-        case Mode::Never:
-            return false;
-        case Mode::Default:
-            if (is_root)
-                m_count = std::min<decltype(m_count)>(m_count,1);
-            return m_count > 0;
-        case Mode::Formatters:
-            if (!entry || entry->DoesPrintChildren(valobj) || summary.empty())
-                return m_count > 0;
-            return false;
-    }
-    return false;
-}
+  TypeSummaryImpl *entry = GetSummaryFormatter();
 
-bool
-DumpValueObjectOptions::PointerDepth::CanAllowExpansion () const
-{
-    switch (m_mode)
-    {
-        case Mode::Always:
-        case Mode::Default:
-        case Mode::Formatters:
-            return (m_count > 0);
-        case Mode::Never:
-            return false;
-    }
+  if (m_options.m_use_objc)
     return false;
-}
 
-bool
-ValueObjectPrinter::ShouldPrintChildren (bool is_failed_description,
-                                         DumpValueObjectOptions::PointerDepth& curr_ptr_depth)
-{
-    const bool is_ref = IsRef ();
-    const bool is_ptr = IsPtr ();
-    const bool is_uninit = IsUninitialized();
-    
-    if (is_uninit)
+  if (is_failed_description || m_curr_depth < m_options.m_max_depth) {
+    // We will show children for all concrete types. We won't show
+    // pointer contents unless a pointer depth has been specified.
+    // We won't reference contents unless the reference is the
+    // root object (depth of zero).
+
+    // Use a new temporary pointer depth in case we override the
+    // current pointer depth below...
+
+    if (is_ptr || is_ref) {
+      // We have a pointer or reference whose value is an address.
+      // Make sure that address is not NULL
+      AddressType ptr_address_type;
+      if (m_valobj->GetPointerValue(&ptr_address_type) == 0)
         return false;
-    
-    // if the user has specified an element count, always print children
-    // as it is explicit user demand being honored
-    if (m_options.m_element_count > 0)
+
+      const bool is_root_level = m_curr_depth == 0;
+
+      if (is_ref && is_root_level) {
+        // If this is the root object (depth is zero) that we are showing
+        // and it is a reference, and no pointer depth has been supplied
+        // print out what it references. Don't do this at deeper depths
+        // otherwise we can end up with infinite recursion...
         return true;
-    
-    TypeSummaryImpl* entry = GetSummaryFormatter();
-    
-    if (m_options.m_use_objc)
-        return false;
-    
-    if (is_failed_description || m_curr_depth < m_options.m_max_depth)
-    {
-        // We will show children for all concrete types. We won't show
-        // pointer contents unless a pointer depth has been specified.
-        // We won't reference contents unless the reference is the
-        // root object (depth of zero).
-        
-        // Use a new temporary pointer depth in case we override the
-        // current pointer depth below...
-        
-        if (is_ptr || is_ref)
-        {
-            // We have a pointer or reference whose value is an address.
-            // Make sure that address is not NULL
-            AddressType ptr_address_type;
-            if (m_valobj->GetPointerValue (&ptr_address_type) == 0)
-                return false;
-            
-            const bool is_root_level = m_curr_depth == 0;
-            
-            if (is_ref &&
-                is_root_level)
-            {
-                // If this is the root object (depth is zero) that we are showing
-                // and it is a reference, and no pointer depth has been supplied
-                // print out what it references. Don't do this at deeper depths
-                // otherwise we can end up with infinite recursion...
-                return true;
-            }
-            
-            return curr_ptr_depth.CanAllowExpansion(false, entry, m_valobj, m_summary);
-        }
-        
-        return (!entry || entry->DoesPrintChildren(m_valobj) || m_summary.empty());
+      }
+
+      return curr_ptr_depth.CanAllowExpansion(false, entry, m_valobj,
+                                              m_summary);
     }
-    return false;
-}
 
-bool
-ValueObjectPrinter::ShouldExpandEmptyAggregates ()
-{
-    TypeSummaryImpl* entry = GetSummaryFormatter();
-    
-    if (!entry)
-        return true;
-    
-    return entry->DoesPrintEmptyAggregates();
+    return (!entry || entry->DoesPrintChildren(m_valobj) || m_summary.empty());
+  }
+  return false;
 }
 
-ValueObject*
-ValueObjectPrinter::GetValueObjectForChildrenGeneration ()
-{
-    return m_valobj;
-}
+bool ValueObjectPrinter::ShouldExpandEmptyAggregates() {
+  TypeSummaryImpl *entry = GetSummaryFormatter();
 
-void
-ValueObjectPrinter::PrintChildrenPreamble ()
-{
-    if (m_options.m_flat_output)
-    {
-        if (ShouldPrintValueObject())
-            m_stream->EOL();
-    }
-    else
-    {
-        if (ShouldPrintValueObject())
-            m_stream->PutCString(IsRef () ? ": {\n" : " {\n");
-        m_stream->IndentMore();
-    }
-}
+  if (!entry)
+    return true;
 
-void
-ValueObjectPrinter::PrintChild (ValueObjectSP child_sp,
-                                const DumpValueObjectOptions::PointerDepth& curr_ptr_depth)
-{
-    const uint32_t consumed_depth = (m_options.m_element_count == 0) ? 1 : 0;
-    const bool does_consume_ptr_depth = ((IsPtr() && m_options.m_element_count == 0) || IsRef());
-
-    DumpValueObjectOptions child_options(m_options);
-    child_options.SetFormat(m_options.m_format).SetSummary().SetRootValueObjectName();
-    child_options.SetScopeChecked(true).SetHideName(m_options.m_hide_name).SetHideValue(m_options.m_hide_value)
-    .SetOmitSummaryDepth(child_options.m_omit_summary_depth > 1 ? child_options.m_omit_summary_depth - consumed_depth : 0)
-    .SetElementCount(0);
-    
-    if (child_sp.get())
-    {
-        ValueObjectPrinter child_printer(child_sp.get(),
-                                         m_stream,
-                                         child_options,
-                                         does_consume_ptr_depth ? --curr_ptr_depth : curr_ptr_depth,
-                                         m_curr_depth + consumed_depth,
-                                         m_printed_instance_pointers);
-        child_printer.PrintValueObject();
-    }
+  return entry->DoesPrintEmptyAggregates();
 }
 
-uint32_t
-ValueObjectPrinter::GetMaxNumChildrenToPrint (bool& print_dotdotdot)
-{
-    ValueObject* synth_m_valobj = GetValueObjectForChildrenGeneration();
-    
-    if (m_options.m_element_count > 0)
-        return m_options.m_element_count;
-    
-    size_t num_children = synth_m_valobj->GetNumChildren();
-    print_dotdotdot = false;
-    if (num_children)
-    {
-        const size_t max_num_children = m_valobj->GetTargetSP()->GetMaximumNumberOfChildrenToDisplay();
-        
-        if (num_children > max_num_children && !m_options.m_ignore_cap)
-        {
-            print_dotdotdot = true;
-            return max_num_children;
-        }
-    }
-    return num_children;
+ValueObject *ValueObjectPrinter::GetValueObjectForChildrenGeneration() {
+  return m_valobj;
 }
 
-void
-ValueObjectPrinter::PrintChildrenPostamble (bool print_dotdotdot)
-{
-    if (!m_options.m_flat_output)
-    {
-        if (print_dotdotdot)
-        {
-            m_valobj->GetTargetSP()->GetDebugger().GetCommandInterpreter().ChildrenTruncated();
-            m_stream->Indent("...\n");
-        }
-        m_stream->IndentLess();
-        m_stream->Indent("}\n");
-    }
-}
+void ValueObjectPrinter::PrintChildrenPreamble() {
+  if (m_options.m_flat_output) {
+    if (ShouldPrintValueObject())
+      m_stream->EOL();
+  } else {
+    if (ShouldPrintValueObject())
+      m_stream->PutCString(IsRef() ? ": {\n" : " {\n");
+    m_stream->IndentMore();
+  }
+}
+
+void ValueObjectPrinter::PrintChild(
+    ValueObjectSP child_sp,
+    const DumpValueObjectOptions::PointerDepth &curr_ptr_depth) {
+  const uint32_t consumed_depth = (m_options.m_element_count == 0) ? 1 : 0;
+  const bool does_consume_ptr_depth =
+      ((IsPtr() && m_options.m_element_count == 0) || IsRef());
+
+  DumpValueObjectOptions child_options(m_options);
+  child_options.SetFormat(m_options.m_format)
+      .SetSummary()
+      .SetRootValueObjectName();
+  child_options.SetScopeChecked(true)
+      .SetHideName(m_options.m_hide_name)
+      .SetHideValue(m_options.m_hide_value)
+      .SetOmitSummaryDepth(child_options.m_omit_summary_depth > 1
+                               ? child_options.m_omit_summary_depth -
+                                     consumed_depth
+                               : 0)
+      .SetElementCount(0);
+
+  if (child_sp.get()) {
+    ValueObjectPrinter child_printer(
+        child_sp.get(), m_stream, child_options,
+        does_consume_ptr_depth ? --curr_ptr_depth : curr_ptr_depth,
+        m_curr_depth + consumed_depth, m_printed_instance_pointers);
+    child_printer.PrintValueObject();
+  }
+}
+
+uint32_t ValueObjectPrinter::GetMaxNumChildrenToPrint(bool &print_dotdotdot) {
+  ValueObject *synth_m_valobj = GetValueObjectForChildrenGeneration();
+
+  if (m_options.m_element_count > 0)
+    return m_options.m_element_count;
+
+  size_t num_children = synth_m_valobj->GetNumChildren();
+  print_dotdotdot = false;
+  if (num_children) {
+    const size_t max_num_children =
+        m_valobj->GetTargetSP()->GetMaximumNumberOfChildrenToDisplay();
+
+    if (num_children > max_num_children && !m_options.m_ignore_cap) {
+      print_dotdotdot = true;
+      return max_num_children;
+    }
+  }
+  return num_children;
+}
+
+void ValueObjectPrinter::PrintChildrenPostamble(bool print_dotdotdot) {
+  if (!m_options.m_flat_output) {
+    if (print_dotdotdot) {
+      m_valobj->GetTargetSP()
+          ->GetDebugger()
+          .GetCommandInterpreter()
+          .ChildrenTruncated();
+      m_stream->Indent("...\n");
+    }
+    m_stream->IndentLess();
+    m_stream->Indent("}\n");
+  }
+}
+
+bool ValueObjectPrinter::ShouldPrintEmptyBrackets(bool value_printed,
+                                                  bool summary_printed) {
+  ValueObject *synth_m_valobj = GetValueObjectForChildrenGeneration();
 
-bool
-ValueObjectPrinter::ShouldPrintEmptyBrackets (bool value_printed,
-                                              bool summary_printed)
-{
-    ValueObject* synth_m_valobj = GetValueObjectForChildrenGeneration();
-    
-    if (!IsAggregate())
-        return false;
-    
-    if (m_options.m_reveal_empty_aggregates == false)
-    {
-        if (value_printed || summary_printed)
-            return false;
-    }
-    
-    if (synth_m_valobj->MightHaveChildren())
-        return true;
-    
-    if (m_val_summary_ok)
-        return false;
-    
+  if (!IsAggregate())
+    return false;
+
+  if (m_options.m_reveal_empty_aggregates == false) {
+    if (value_printed || summary_printed)
+      return false;
+  }
+
+  if (synth_m_valobj->MightHaveChildren())
     return true;
-}
 
-ValueObjectSP
-ValueObjectPrinter::GenerateChild (ValueObject* synth_valobj, size_t idx)
-{
-    if (m_options.m_element_count > 0)
-    {
-        // if generating pointer-as-array children, use GetSyntheticArrayMember
-        return synth_valobj->GetSyntheticArrayMember(idx, true);
-    }
-    else
-    {
-        // otherwise, do the usual thing
-        return synth_valobj->GetChildAtIndex(idx, true);
-    }
+  if (m_val_summary_ok)
+    return false;
+
+  return true;
 }
 
-void
-ValueObjectPrinter::PrintChildren (bool value_printed,
-                                   bool summary_printed,
-                                   const DumpValueObjectOptions::PointerDepth& curr_ptr_depth)
-{
-    ValueObject* synth_m_valobj = GetValueObjectForChildrenGeneration();
-    
-    bool print_dotdotdot = false;
-    size_t num_children = GetMaxNumChildrenToPrint(print_dotdotdot);
-    if (num_children)
-    {
-        bool any_children_printed = false;
-        
-        for (size_t idx=0; idx<num_children; ++idx)
-        {
-            if (ValueObjectSP child_sp = GenerateChild(synth_m_valobj, idx))
-            {
-                if (!any_children_printed)
-                {
-                    PrintChildrenPreamble ();
-                    any_children_printed = true;
-                }
-                PrintChild (child_sp, curr_ptr_depth);
-            }
-        }
-        
-        if (any_children_printed)
-            PrintChildrenPostamble (print_dotdotdot);
-        else
-        {
-            if (ShouldPrintEmptyBrackets(value_printed, summary_printed))
-            {
-                if (ShouldPrintValueObject())
-                    m_stream->PutCString(" {}\n");
-                else
-                    m_stream->EOL();
-            }
-            else
-                m_stream->EOL();
-        }
-    }
-    else if (ShouldPrintEmptyBrackets(value_printed, summary_printed))
-    {
-        // Aggregate, no children...
+ValueObjectSP ValueObjectPrinter::GenerateChild(ValueObject *synth_valobj,
+                                                size_t idx) {
+  if (m_options.m_element_count > 0) {
+    // if generating pointer-as-array children, use GetSyntheticArrayMember
+    return synth_valobj->GetSyntheticArrayMember(idx, true);
+  } else {
+    // otherwise, do the usual thing
+    return synth_valobj->GetChildAtIndex(idx, true);
+  }
+}
+
+void ValueObjectPrinter::PrintChildren(
+    bool value_printed, bool summary_printed,
+    const DumpValueObjectOptions::PointerDepth &curr_ptr_depth) {
+  ValueObject *synth_m_valobj = GetValueObjectForChildrenGeneration();
+
+  bool print_dotdotdot = false;
+  size_t num_children = GetMaxNumChildrenToPrint(print_dotdotdot);
+  if (num_children) {
+    bool any_children_printed = false;
+
+    for (size_t idx = 0; idx < num_children; ++idx) {
+      if (ValueObjectSP child_sp = GenerateChild(synth_m_valobj, idx)) {
+        if (!any_children_printed) {
+          PrintChildrenPreamble();
+          any_children_printed = true;
+        }
+        PrintChild(child_sp, curr_ptr_depth);
+      }
+    }
+
+    if (any_children_printed)
+      PrintChildrenPostamble(print_dotdotdot);
+    else {
+      if (ShouldPrintEmptyBrackets(value_printed, summary_printed)) {
         if (ShouldPrintValueObject())
-        {
-            // if it has a synthetic value, then don't print {}, the synthetic children are probably only being used to vend a value
-            if (m_valobj->DoesProvideSyntheticValue() || !ShouldExpandEmptyAggregates())
-                m_stream->PutCString( "\n");
-            else
-                m_stream->PutCString(" {}\n");
-        }
+          m_stream->PutCString(" {}\n");
+        else
+          m_stream->EOL();
+      } else
+        m_stream->EOL();
     }
-    else
-    {
-        if (ShouldPrintValueObject())
-            m_stream->EOL();
+  } else if (ShouldPrintEmptyBrackets(value_printed, summary_printed)) {
+    // Aggregate, no children...
+    if (ShouldPrintValueObject()) {
+      // if it has a synthetic value, then don't print {}, the synthetic
+      // children are probably only being used to vend a value
+      if (m_valobj->DoesProvideSyntheticValue() ||
+          !ShouldExpandEmptyAggregates())
+        m_stream->PutCString("\n");
+      else
+        m_stream->PutCString(" {}\n");
     }
+  } else {
+    if (ShouldPrintValueObject())
+      m_stream->EOL();
+  }
 }
 
-bool
-ValueObjectPrinter::PrintChildrenOneLiner (bool hide_names)
-{
-    if (!GetMostSpecializedValue () || m_valobj == nullptr)
-        return false;
-    
-    ValueObject* synth_m_valobj = GetValueObjectForChildrenGeneration();
-    
-    bool print_dotdotdot = false;
-    size_t num_children = GetMaxNumChildrenToPrint(print_dotdotdot);
-    
-    if (num_children)
-    {
-        m_stream->PutChar('(');
-        
-        for (uint32_t idx=0; idx<num_children; ++idx)
-        {
-            lldb::ValueObjectSP child_sp(synth_m_valobj->GetChildAtIndex(idx, true));
-            if (child_sp)
-                child_sp = child_sp->GetQualifiedRepresentationIfAvailable(m_options.m_use_dynamic, m_options.m_use_synthetic);
-            if (child_sp)
-            {
-                if (idx)
-                    m_stream->PutCString(", ");
-                if (!hide_names)
-                {
-                    const char* name = child_sp.get()->GetName().AsCString();
-                    if (name && *name)
-                    {
-                        m_stream->PutCString(name);
-                        m_stream->PutCString(" = ");
-                    }
-                }
-                child_sp->DumpPrintableRepresentation(*m_stream,
-                                                      ValueObject::eValueObjectRepresentationStyleSummary,
-                                                      m_options.m_format,
-                                                      ValueObject::ePrintableRepresentationSpecialCasesDisable);
-            }
-        }
-        
-        if (print_dotdotdot)
-            m_stream->PutCString(", ...)");
-        else
-            m_stream->PutChar(')');
-    }
-    return true;
-}
+bool ValueObjectPrinter::PrintChildrenOneLiner(bool hide_names) {
+  if (!GetMostSpecializedValue() || m_valobj == nullptr)
+    return false;
 
-void
-ValueObjectPrinter::PrintChildrenIfNeeded (bool value_printed,
-                                           bool summary_printed)
-{
-    // this flag controls whether we tried to display a description for this object and failed
-    // if that happens, we want to display the children, if any
-    bool is_failed_description = !PrintObjectDescriptionIfNeeded(value_printed, summary_printed);
-    
-    auto curr_ptr_depth = m_ptr_depth;
-    bool print_children = ShouldPrintChildren (is_failed_description,curr_ptr_depth);
-    bool print_oneline = (curr_ptr_depth.CanAllowExpansion() ||
-                          m_options.m_show_types ||
-                          !m_options.m_allow_oneliner_mode ||
-                          m_options.m_flat_output ||
-                          (m_options.m_element_count > 0) ||
-                          m_options.m_show_location) ? false : DataVisualization::ShouldPrintAsOneLiner(*m_valobj);
-    bool is_instance_ptr = IsInstancePointer();
-    uint64_t instance_ptr_value = LLDB_INVALID_ADDRESS;
-    
-    if (print_children && is_instance_ptr)
-    {
-        instance_ptr_value = m_valobj->GetValueAsUnsigned(0);
-        if (m_printed_instance_pointers->count(instance_ptr_value))
-        {
-            // we already printed this instance-is-pointer thing, so don't expand it
-            m_stream->PutCString(" {...}\n");
-            
-            // we're done here - get out fast
-            return;
-        }
-        else
-            m_printed_instance_pointers->emplace(instance_ptr_value); // remember this guy for future reference
-    }
-    
-    if (print_children)
-    {
-        if (print_oneline)
-        {
-            m_stream->PutChar(' ');
-            PrintChildrenOneLiner (false);
-            m_stream->EOL();
-        }
-        else
-            PrintChildren (value_printed, summary_printed, curr_ptr_depth);
-    }
-    else if (m_curr_depth >= m_options.m_max_depth && IsAggregate() && ShouldPrintValueObject())
-    {
-        m_stream->PutCString("{...}\n");
+  ValueObject *synth_m_valobj = GetValueObjectForChildrenGeneration();
+
+  bool print_dotdotdot = false;
+  size_t num_children = GetMaxNumChildrenToPrint(print_dotdotdot);
+
+  if (num_children) {
+    m_stream->PutChar('(');
+
+    for (uint32_t idx = 0; idx < num_children; ++idx) {
+      lldb::ValueObjectSP child_sp(synth_m_valobj->GetChildAtIndex(idx, true));
+      if (child_sp)
+        child_sp = child_sp->GetQualifiedRepresentationIfAvailable(
+            m_options.m_use_dynamic, m_options.m_use_synthetic);
+      if (child_sp) {
+        if (idx)
+          m_stream->PutCString(", ");
+        if (!hide_names) {
+          const char *name = child_sp.get()->GetName().AsCString();
+          if (name && *name) {
+            m_stream->PutCString(name);
+            m_stream->PutCString(" = ");
+          }
+        }
+        child_sp->DumpPrintableRepresentation(
+            *m_stream, ValueObject::eValueObjectRepresentationStyleSummary,
+            m_options.m_format,
+            ValueObject::ePrintableRepresentationSpecialCasesDisable);
+      }
     }
+
+    if (print_dotdotdot)
+      m_stream->PutCString(", ...)");
     else
-        m_stream->EOL();
+      m_stream->PutChar(')');
+  }
+  return true;
+}
+
+void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed,
+                                               bool summary_printed) {
+  // this flag controls whether we tried to display a description for this
+  // object and failed
+  // if that happens, we want to display the children, if any
+  bool is_failed_description =
+      !PrintObjectDescriptionIfNeeded(value_printed, summary_printed);
+
+  auto curr_ptr_depth = m_ptr_depth;
+  bool print_children =
+      ShouldPrintChildren(is_failed_description, curr_ptr_depth);
+  bool print_oneline =
+      (curr_ptr_depth.CanAllowExpansion() || m_options.m_show_types ||
+       !m_options.m_allow_oneliner_mode || m_options.m_flat_output ||
+       (m_options.m_element_count > 0) || m_options.m_show_location)
+          ? false
+          : DataVisualization::ShouldPrintAsOneLiner(*m_valobj);
+  bool is_instance_ptr = IsInstancePointer();
+  uint64_t instance_ptr_value = LLDB_INVALID_ADDRESS;
+
+  if (print_children && is_instance_ptr) {
+    instance_ptr_value = m_valobj->GetValueAsUnsigned(0);
+    if (m_printed_instance_pointers->count(instance_ptr_value)) {
+      // we already printed this instance-is-pointer thing, so don't expand it
+      m_stream->PutCString(" {...}\n");
+
+      // we're done here - get out fast
+      return;
+    } else
+      m_printed_instance_pointers->emplace(
+          instance_ptr_value); // remember this guy for future reference
+  }
+
+  if (print_children) {
+    if (print_oneline) {
+      m_stream->PutChar(' ');
+      PrintChildrenOneLiner(false);
+      m_stream->EOL();
+    } else
+      PrintChildren(value_printed, summary_printed, curr_ptr_depth);
+  } else if (m_curr_depth >= m_options.m_max_depth && IsAggregate() &&
+             ShouldPrintValueObject()) {
+    m_stream->PutCString("{...}\n");
+  } else
+    m_stream->EOL();
 }
 
-bool
-ValueObjectPrinter::ShouldPrintValidation ()
-{
-    return m_options.m_run_validator;
+bool ValueObjectPrinter::ShouldPrintValidation() {
+  return m_options.m_run_validator;
 }
 
-bool
-ValueObjectPrinter::PrintValidationMarkerIfNeeded ()
-{
-    if (!ShouldPrintValidation())
-        return false;
-    
-    m_validation = m_valobj->GetValidationStatus();
-    
-    if (TypeValidatorResult::Failure == m_validation.first)
-    {
-        m_stream->Printf("! ");
-        return true;
-    }
-    
+bool ValueObjectPrinter::PrintValidationMarkerIfNeeded() {
+  if (!ShouldPrintValidation())
     return false;
-}
 
-bool
-ValueObjectPrinter::PrintValidationErrorIfNeeded ()
-{
-    if (!ShouldPrintValidation())
-        return false;
-    
-    if (TypeValidatorResult::Success == m_validation.first)
-        return false;
-    
-    if (m_validation.second.empty())
-        m_validation.second.assign("unknown error");
-    
-    m_stream->Printf(" ! validation error: %s", m_validation.second.c_str());
-    m_stream->EOL();
-    
+  m_validation = m_valobj->GetValidationStatus();
+
+  if (TypeValidatorResult::Failure == m_validation.first) {
+    m_stream->Printf("! ");
     return true;
+  }
+
+  return false;
+}
+
+bool ValueObjectPrinter::PrintValidationErrorIfNeeded() {
+  if (!ShouldPrintValidation())
+    return false;
+
+  if (TypeValidatorResult::Success == m_validation.first)
+    return false;
+
+  if (m_validation.second.empty())
+    m_validation.second.assign("unknown error");
+
+  m_stream->Printf(" ! validation error: %s", m_validation.second.c_str());
+  m_stream->EOL();
+
+  return true;
 }

Modified: lldb/trunk/source/DataFormatters/VectorType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/VectorType.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/VectorType.cpp (original)
+++ lldb/trunk/source/DataFormatters/VectorType.cpp Tue Sep  6 15:57:50 2016
@@ -25,306 +25,277 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
 
-static CompilerType
-GetCompilerTypeForFormat (lldb::Format format,
-                          CompilerType element_type,
-                          TypeSystem *type_system)
-{
-    lldbassert(type_system && "type_system needs to be not NULL");
-    
-    switch (format)
-    {
-        case lldb::eFormatAddressInfo:
-        case lldb::eFormatPointer:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 8*type_system->GetPointerByteSize());
-            
-        case lldb::eFormatBoolean:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeBool);
-            
-        case lldb::eFormatBytes:
-        case lldb::eFormatBytesWithASCII:
-        case lldb::eFormatChar:
-        case lldb::eFormatCharArray:
-        case lldb::eFormatCharPrintable:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar);
-
-        case lldb::eFormatComplex /* lldb::eFormatComplexFloat */:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeFloatComplex);
-
-        case lldb::eFormatCString:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar).GetPointerType();
-
-        case lldb::eFormatFloat:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeFloat);
-            
-        case lldb::eFormatHex:
-        case lldb::eFormatHexUppercase:
-        case lldb::eFormatOctal:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeInt);
-
-        case lldb::eFormatHexFloat:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeFloat);
-
-        case lldb::eFormatUnicode16:
-        case lldb::eFormatUnicode32:
-
-        case lldb::eFormatUnsigned:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeUnsignedInt);
-
-        case lldb::eFormatVectorOfChar:
-            return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar);
-            
-        case lldb::eFormatVectorOfFloat32:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingIEEE754, 32);
-            
-        case lldb::eFormatVectorOfFloat64:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingIEEE754, 64);
-            
-        case lldb::eFormatVectorOfSInt16:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingSint, 16);
-            
-        case lldb::eFormatVectorOfSInt32:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingSint, 32);
-
-        case lldb::eFormatVectorOfSInt64:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingSint, 64);
-            
-        case lldb::eFormatVectorOfSInt8:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingSint, 8);
-
-        case lldb::eFormatVectorOfUInt128:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 128);
-
-        case lldb::eFormatVectorOfUInt16:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 16);
-
-        case lldb::eFormatVectorOfUInt32:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 32);
-
-        case lldb::eFormatVectorOfUInt64:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 64);
-
-        case lldb::eFormatVectorOfUInt8:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 8);
-            
-        case lldb::eFormatDefault:
-            return element_type;
-        
-        case lldb::eFormatBinary:
-        case lldb::eFormatComplexInteger:
-        case lldb::eFormatDecimal:
-        case lldb::eFormatEnum:
-        case lldb::eFormatInstruction:
-        case lldb::eFormatOSType:
-        case lldb::eFormatVoid:
-        default:
-            return type_system->GetBuiltinTypeForEncodingAndBitSize (eEncodingUint, 8);
-    }
+static CompilerType GetCompilerTypeForFormat(lldb::Format format,
+                                             CompilerType element_type,
+                                             TypeSystem *type_system) {
+  lldbassert(type_system && "type_system needs to be not NULL");
+
+  switch (format) {
+  case lldb::eFormatAddressInfo:
+  case lldb::eFormatPointer:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(
+        eEncodingUint, 8 * type_system->GetPointerByteSize());
+
+  case lldb::eFormatBoolean:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeBool);
+
+  case lldb::eFormatBytes:
+  case lldb::eFormatBytesWithASCII:
+  case lldb::eFormatChar:
+  case lldb::eFormatCharArray:
+  case lldb::eFormatCharPrintable:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar);
+
+  case lldb::eFormatComplex /* lldb::eFormatComplexFloat */:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeFloatComplex);
+
+  case lldb::eFormatCString:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar)
+        .GetPointerType();
+
+  case lldb::eFormatFloat:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeFloat);
+
+  case lldb::eFormatHex:
+  case lldb::eFormatHexUppercase:
+  case lldb::eFormatOctal:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeInt);
+
+  case lldb::eFormatHexFloat:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeFloat);
+
+  case lldb::eFormatUnicode16:
+  case lldb::eFormatUnicode32:
+
+  case lldb::eFormatUnsigned:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeUnsignedInt);
+
+  case lldb::eFormatVectorOfChar:
+    return type_system->GetBasicTypeFromAST(lldb::eBasicTypeChar);
+
+  case lldb::eFormatVectorOfFloat32:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingIEEE754,
+                                                            32);
+
+  case lldb::eFormatVectorOfFloat64:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingIEEE754,
+                                                            64);
+
+  case lldb::eFormatVectorOfSInt16:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 16);
+
+  case lldb::eFormatVectorOfSInt32:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 32);
+
+  case lldb::eFormatVectorOfSInt64:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 64);
+
+  case lldb::eFormatVectorOfSInt8:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingSint, 8);
+
+  case lldb::eFormatVectorOfUInt128:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 128);
+
+  case lldb::eFormatVectorOfUInt16:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 16);
+
+  case lldb::eFormatVectorOfUInt32:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 32);
+
+  case lldb::eFormatVectorOfUInt64:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 64);
+
+  case lldb::eFormatVectorOfUInt8:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 8);
+
+  case lldb::eFormatDefault:
+    return element_type;
+
+  case lldb::eFormatBinary:
+  case lldb::eFormatComplexInteger:
+  case lldb::eFormatDecimal:
+  case lldb::eFormatEnum:
+  case lldb::eFormatInstruction:
+  case lldb::eFormatOSType:
+  case lldb::eFormatVoid:
+  default:
+    return type_system->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 8);
+  }
 }
 
-static lldb::Format
-GetItemFormatForFormat (lldb::Format format,
-                        CompilerType element_type)
-{
-    switch (format)
-    {
-        case lldb::eFormatVectorOfChar:
-            return lldb::eFormatChar;
-            
-        case lldb::eFormatVectorOfFloat32:
-        case lldb::eFormatVectorOfFloat64:
-            return lldb::eFormatFloat;
-            
-        case lldb::eFormatVectorOfSInt16:
-        case lldb::eFormatVectorOfSInt32:
-        case lldb::eFormatVectorOfSInt64:
-        case lldb::eFormatVectorOfSInt8:
-            return lldb::eFormatDecimal;
-            
-        case lldb::eFormatVectorOfUInt128:
-        case lldb::eFormatVectorOfUInt16:
-        case lldb::eFormatVectorOfUInt32:
-        case lldb::eFormatVectorOfUInt64:
-        case lldb::eFormatVectorOfUInt8:
-            return lldb::eFormatUnsigned;
-            
-        case lldb::eFormatBinary:
-        case lldb::eFormatComplexInteger:
-        case lldb::eFormatDecimal:
-        case lldb::eFormatEnum:
-        case lldb::eFormatInstruction:
-        case lldb::eFormatOSType:
-        case lldb::eFormatVoid:
-            return eFormatHex;
-
-        case lldb::eFormatDefault:
-        {
-            // special case the (default, char) combination to actually display as an integer value
-            // most often, you won't want to see the ASCII characters... (and if you do, eFormatChar is a keystroke away)
-            bool is_char = element_type.IsCharType();
-            bool is_signed = false;
-            element_type.IsIntegerType(is_signed);
-            return is_char ? (is_signed ? lldb::eFormatDecimal : eFormatHex) : format;
-        }
-            break;
-            
-        default:
-            return format;
-    }
+static lldb::Format GetItemFormatForFormat(lldb::Format format,
+                                           CompilerType element_type) {
+  switch (format) {
+  case lldb::eFormatVectorOfChar:
+    return lldb::eFormatChar;
+
+  case lldb::eFormatVectorOfFloat32:
+  case lldb::eFormatVectorOfFloat64:
+    return lldb::eFormatFloat;
+
+  case lldb::eFormatVectorOfSInt16:
+  case lldb::eFormatVectorOfSInt32:
+  case lldb::eFormatVectorOfSInt64:
+  case lldb::eFormatVectorOfSInt8:
+    return lldb::eFormatDecimal;
+
+  case lldb::eFormatVectorOfUInt128:
+  case lldb::eFormatVectorOfUInt16:
+  case lldb::eFormatVectorOfUInt32:
+  case lldb::eFormatVectorOfUInt64:
+  case lldb::eFormatVectorOfUInt8:
+    return lldb::eFormatUnsigned;
+
+  case lldb::eFormatBinary:
+  case lldb::eFormatComplexInteger:
+  case lldb::eFormatDecimal:
+  case lldb::eFormatEnum:
+  case lldb::eFormatInstruction:
+  case lldb::eFormatOSType:
+  case lldb::eFormatVoid:
+    return eFormatHex;
+
+  case lldb::eFormatDefault: {
+    // special case the (default, char) combination to actually display as an
+    // integer value
+    // most often, you won't want to see the ASCII characters... (and if you do,
+    // eFormatChar is a keystroke away)
+    bool is_char = element_type.IsCharType();
+    bool is_signed = false;
+    element_type.IsIntegerType(is_signed);
+    return is_char ? (is_signed ? lldb::eFormatDecimal : eFormatHex) : format;
+  } break;
+
+  default:
+    return format;
+  }
 }
 
-static size_t
-CalculateNumChildren (CompilerType container_type,
-                      CompilerType element_type,
-                      lldb_private::ExecutionContextScope *exe_scope = nullptr // does not matter here because all we trade in are basic types
-                      )
-{
-    auto container_size = container_type.GetByteSize(exe_scope);
-    auto element_size = element_type.GetByteSize(exe_scope);
-    
-    if (element_size)
-    {
-        if (container_size % element_size)
-            return 0;
-        return container_size / element_size;
-    }
-    return 0;
+static size_t CalculateNumChildren(
+    CompilerType container_type, CompilerType element_type,
+    lldb_private::ExecutionContextScope *exe_scope =
+        nullptr // does not matter here because all we trade in are basic types
+    ) {
+  auto container_size = container_type.GetByteSize(exe_scope);
+  auto element_size = element_type.GetByteSize(exe_scope);
+
+  if (element_size) {
+    if (container_size % element_size)
+      return 0;
+    return container_size / element_size;
+  }
+  return 0;
 }
 
 namespace lldb_private {
-    namespace formatters {
+namespace formatters {
 
-        class VectorTypeSyntheticFrontEnd : public SyntheticChildrenFrontEnd
-        {
-        public:
-            VectorTypeSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
-            SyntheticChildrenFrontEnd(*valobj_sp),
-            m_parent_format (eFormatInvalid),
-            m_item_format(eFormatInvalid),
-            m_child_type(),
-            m_num_children(0)
-            {}
-
-            ~VectorTypeSyntheticFrontEnd() override = default;
-
-            size_t
-            CalculateNumChildren() override
-            {
-                return m_num_children;
-            }
-
-            lldb::ValueObjectSP
-            GetChildAtIndex(size_t idx) override
-            {
-                if (idx >= CalculateNumChildren())
-                    return lldb::ValueObjectSP();
-                auto offset = idx * m_child_type.GetByteSize(nullptr);
-                ValueObjectSP child_sp(m_backend.GetSyntheticChildAtOffset(offset, m_child_type, true));
-                if (!child_sp)
-                    return child_sp;
-                
-                StreamString idx_name;
-                idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
-                child_sp->SetName( ConstString( idx_name.GetData() ) );
-                
-                child_sp->SetFormat(m_item_format);
-                
-                return child_sp;
-            }
-
-            bool
-            Update() override
-            {
-                m_parent_format = m_backend.GetFormat();
-                CompilerType parent_type(m_backend.GetCompilerType());
-                CompilerType element_type;
-                parent_type.IsVectorType(&element_type, nullptr);
-                TargetSP target_sp(m_backend.GetTargetSP());
-                m_child_type = ::GetCompilerTypeForFormat(m_parent_format,
-                                                          element_type,
-                                                          target_sp ? target_sp->GetScratchTypeSystemForLanguage(nullptr, lldb::eLanguageTypeC) : nullptr);
-                m_num_children = ::CalculateNumChildren(parent_type,
-                                                        m_child_type);
-                m_item_format = GetItemFormatForFormat(m_parent_format,
-                                                       m_child_type);
-                return false;
-            }
-
-            bool
-            MightHaveChildren() override
-            {
-                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;
-            }
-
-        private:
-            lldb::Format m_parent_format;
-            lldb::Format m_item_format;
-            CompilerType m_child_type;
-            size_t m_num_children;
-        };
+class VectorTypeSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+  VectorTypeSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
+      : SyntheticChildrenFrontEnd(*valobj_sp), m_parent_format(eFormatInvalid),
+        m_item_format(eFormatInvalid), m_child_type(), m_num_children(0) {}
+
+  ~VectorTypeSyntheticFrontEnd() override = default;
+
+  size_t CalculateNumChildren() override { return m_num_children; }
+
+  lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+    if (idx >= CalculateNumChildren())
+      return lldb::ValueObjectSP();
+    auto offset = idx * m_child_type.GetByteSize(nullptr);
+    ValueObjectSP child_sp(
+        m_backend.GetSyntheticChildAtOffset(offset, m_child_type, true));
+    if (!child_sp)
+      return child_sp;
+
+    StreamString idx_name;
+    idx_name.Printf("[%" PRIu64 "]", (uint64_t)idx);
+    child_sp->SetName(ConstString(idx_name.GetData()));
+
+    child_sp->SetFormat(m_item_format);
+
+    return child_sp;
+  }
+
+  bool Update() override {
+    m_parent_format = m_backend.GetFormat();
+    CompilerType parent_type(m_backend.GetCompilerType());
+    CompilerType element_type;
+    parent_type.IsVectorType(&element_type, nullptr);
+    TargetSP target_sp(m_backend.GetTargetSP());
+    m_child_type = ::GetCompilerTypeForFormat(
+        m_parent_format, element_type,
+        target_sp
+            ? target_sp->GetScratchTypeSystemForLanguage(nullptr,
+                                                         lldb::eLanguageTypeC)
+            : nullptr);
+    m_num_children = ::CalculateNumChildren(parent_type, m_child_type);
+    m_item_format = GetItemFormatForFormat(m_parent_format, m_child_type);
+    return false;
+  }
+
+  bool MightHaveChildren() override { 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;
+  }
+
+private:
+  lldb::Format m_parent_format;
+  lldb::Format m_item_format;
+  CompilerType m_child_type;
+  size_t m_num_children;
+};
 
-    } // namespace formatters
+} // namespace formatters
 } // namespace lldb_private
 
-bool
-lldb_private::formatters::VectorTypeSummaryProvider (ValueObject& valobj,
-                                                     Stream& s,
-                                                     const TypeSummaryOptions&)
-{
-    auto synthetic_children = VectorTypeSyntheticFrontEndCreator(nullptr, valobj.GetSP());
-    if (!synthetic_children)
-        return false;
-    
-    synthetic_children->Update();
-    
-    s.PutChar('(');
-    bool first = true;
-    
-    size_t idx = 0, len = synthetic_children->CalculateNumChildren();
-    
-    for (;
-         idx < len;
-         idx++)
-    {
-        auto child_sp = synthetic_children->GetChildAtIndex(idx);
-        if (!child_sp)
-            continue;
-        child_sp = child_sp->GetQualifiedRepresentationIfAvailable(lldb::eDynamicDontRunTarget, true);
-        
-        const char* child_value = child_sp->GetValueAsCString();
-        if (child_value && *child_value)
-        {
-            if (first)
-            {
-                s.Printf("%s", child_value);
-                first = false;
-            }
-            else
-            {
-                s.Printf(", %s", child_value);
-            }
-        }
+bool lldb_private::formatters::VectorTypeSummaryProvider(
+    ValueObject &valobj, Stream &s, const TypeSummaryOptions &) {
+  auto synthetic_children =
+      VectorTypeSyntheticFrontEndCreator(nullptr, valobj.GetSP());
+  if (!synthetic_children)
+    return false;
+
+  synthetic_children->Update();
+
+  s.PutChar('(');
+  bool first = true;
+
+  size_t idx = 0, len = synthetic_children->CalculateNumChildren();
+
+  for (; idx < len; idx++) {
+    auto child_sp = synthetic_children->GetChildAtIndex(idx);
+    if (!child_sp)
+      continue;
+    child_sp = child_sp->GetQualifiedRepresentationIfAvailable(
+        lldb::eDynamicDontRunTarget, true);
+
+    const char *child_value = child_sp->GetValueAsCString();
+    if (child_value && *child_value) {
+      if (first) {
+        s.Printf("%s", child_value);
+        first = false;
+      } else {
+        s.Printf(", %s", child_value);
+      }
     }
-    
-    s.PutChar(')');
-    
-    return true;
+  }
+
+  s.PutChar(')');
+
+  return true;
 }
 
-lldb_private::SyntheticChildrenFrontEnd*
-lldb_private::formatters::VectorTypeSyntheticFrontEndCreator (CXXSyntheticChildren*, lldb::ValueObjectSP valobj_sp)
-{
-    if (!valobj_sp)
-        return nullptr;
-    return new VectorTypeSyntheticFrontEnd(valobj_sp);
+lldb_private::SyntheticChildrenFrontEnd *
+lldb_private::formatters::VectorTypeSyntheticFrontEndCreator(
+    CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) {
+  if (!valobj_sp)
+    return nullptr;
+  return new VectorTypeSyntheticFrontEnd(valobj_sp);
 }




More information about the lldb-commits mailing list