diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/API/SBType.cpp | 8 | ||||
-rw-r--r-- | lldb/source/API/SBValue.cpp | 25 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectChild.cpp | 52 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectConstResult.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectDynamicValue.cpp | 18 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectMemory.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectRegister.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectSyntheticFilter.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectVariable.cpp | 9 | ||||
-rw-r--r-- | lldb/source/DataFormatters/FormatManager.cpp | 6 | ||||
-rw-r--r-- | lldb/source/DataFormatters/ValueObjectPrinter.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Symbol/ClangASTType.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Symbol/Type.cpp | 8 |
14 files changed, 137 insertions, 32 deletions
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index 5ca7ddf3d81..1e04841bfad 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -414,6 +414,14 @@ SBType::GetName() return m_opaque_sp->GetName().GetCString(); } +const char * +SBType::GetDisplayTypeName () +{ + if (!IsValid()) + return ""; + return m_opaque_sp->GetDisplayTypeName().GetCString(); +} + lldb::TypeClass SBType::GetTypeClass () { diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index f171d239913..3a9621b1e3b 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -378,6 +378,31 @@ SBValue::GetTypeName () return name; } +const char * +SBValue::GetDisplayTypeName () +{ + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + const char *name = NULL; + ValueLocker locker; + lldb::ValueObjectSP value_sp(GetSP(locker)); + if (value_sp) + { + name = value_sp->GetDisplayTypeName().GetCString(); + } + + if (log) + { + if (name) + log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", + static_cast<void*>(value_sp.get()), name); + else + log->Printf ("SBValue(%p)::GetTypeName () => NULL", + static_cast<void*>(value_sp.get())); + } + + return name; +} + size_t SBValue::GetByteSize () { diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index f6a3d53032b..9fc4167f31b 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -1953,6 +1953,12 @@ ValueObject::GetTypeName() } ConstString +ValueObject::GetDisplayTypeName() +{ + return GetTypeName(); +} + +ConstString ValueObject::GetQualifiedTypeName() { return GetClangType().GetConstQualifiedTypeName(); diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index ccf87cd15b2..33b91f9e30d 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -66,25 +66,29 @@ ValueObjectChild::CalculateNumChildren() return GetClangType().GetNumChildren (true); } +static void +AdjustForBitfieldness(ConstString& name, + uint8_t bitfield_bit_size) +{ + if (name && bitfield_bit_size) + { + const char *clang_type_name = name.AsCString(); + if (clang_type_name) + { + std::vector<char> bitfield_type_name (strlen(clang_type_name) + 32, 0); + ::snprintf (&bitfield_type_name.front(), bitfield_type_name.size(), "%s:%u", clang_type_name, bitfield_bit_size); + name.SetCString(&bitfield_type_name.front()); + } + } +} + ConstString ValueObjectChild::GetTypeName() { if (m_type_name.IsEmpty()) { m_type_name = GetClangType().GetConstTypeName (); - if (m_type_name) - { - if (m_bitfield_bit_size > 0) - { - const char *clang_type_name = m_type_name.AsCString(); - if (clang_type_name) - { - std::vector<char> bitfield_type_name (strlen(clang_type_name) + 32, 0); - ::snprintf (&bitfield_type_name.front(), bitfield_type_name.size(), "%s:%u", clang_type_name, m_bitfield_bit_size); - m_type_name.SetCString(&bitfield_type_name.front()); - } - } - } + AdjustForBitfieldness(m_type_name, m_bitfield_bit_size); } return m_type_name; } @@ -93,22 +97,18 @@ ConstString ValueObjectChild::GetQualifiedTypeName() { ConstString qualified_name = GetClangType().GetConstTypeName(); - if (qualified_name) - { - if (m_bitfield_bit_size > 0) - { - const char *clang_type_name = qualified_name.AsCString(); - if (clang_type_name) - { - std::vector<char> bitfield_type_name (strlen(clang_type_name) + 32, 0); - ::snprintf (&bitfield_type_name.front(), bitfield_type_name.size(), "%s:%u", clang_type_name, m_bitfield_bit_size); - qualified_name.SetCString(&bitfield_type_name.front()); - } - } - } + AdjustForBitfieldness(qualified_name, m_bitfield_bit_size); return qualified_name; } +ConstString +ValueObjectChild::GetDisplayTypeName() +{ + ConstString display_name = GetClangType().GetDisplayTypeName(); + AdjustForBitfieldness(display_name, m_bitfield_bit_size); + return display_name; +} + bool ValueObjectChild::UpdateValue () { diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp index d6d86381358..387e171e352 100644 --- a/lldb/source/Core/ValueObjectConstResult.cpp +++ b/lldb/source/Core/ValueObjectConstResult.cpp @@ -276,6 +276,12 @@ ValueObjectConstResult::GetTypeName() return m_type_name; } +ConstString +ValueObjectConstResult::GetDisplayTypeName() +{ + return GetClangType().GetDisplayTypeName(); +} + bool ValueObjectConstResult::UpdateValue () { diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index a9f2606212c..a6fad7a9b1f 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -71,8 +71,6 @@ ValueObjectDynamicValue::GetTypeName() { if (m_dynamic_type_info.HasName()) return m_dynamic_type_info.GetName(); - if (m_dynamic_type_info.HasType()) - return GetClangType().GetConstTypeName(); } return m_parent->GetTypeName(); } @@ -96,10 +94,22 @@ ValueObjectDynamicValue::GetQualifiedTypeName() { 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 GetClangType().GetConstQualifiedTypeName (); + return GetClangType().GetDisplayTypeName(); + if (m_dynamic_type_info.HasName()) + return m_dynamic_type_info.GetName(); } - return m_parent->GetTypeName(); + return m_parent->GetDisplayTypeName(); } size_t diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp index 42fd0e8fffb..d2cbbfdda24 100644 --- a/lldb/source/Core/ValueObjectMemory.cpp +++ b/lldb/source/Core/ValueObjectMemory.cpp @@ -147,6 +147,14 @@ ValueObjectMemory::GetTypeName() return m_clang_type.GetConstTypeName(); } +ConstString +ValueObjectMemory::GetDisplayTypeName() +{ + if (m_type_sp) + return m_type_sp->GetClangForwardType().GetDisplayTypeName(); + return m_clang_type.GetDisplayTypeName(); +} + size_t ValueObjectMemory::CalculateNumChildren() { diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp index 4f21457519e..0db1f0cd45c 100644 --- a/lldb/source/Core/ValueObjectRegister.cpp +++ b/lldb/source/Core/ValueObjectRegister.cpp @@ -55,6 +55,12 @@ ValueObjectRegisterContext::GetTypeName() } ConstString +ValueObjectRegisterContext::GetDisplayTypeName() +{ + return ConstString(); +} + +ConstString ValueObjectRegisterContext::GetQualifiedTypeName() { return ConstString(); diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index a65b8f63e31..18d36164989 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -101,6 +101,12 @@ ValueObjectSynthetic::GetQualifiedTypeName() return m_parent->GetQualifiedTypeName(); } +ConstString +ValueObjectSynthetic::GetDisplayTypeName() +{ + return m_parent->GetDisplayTypeName(); +} + size_t ValueObjectSynthetic::CalculateNumChildren() { diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 2e5bb22a890..225dc02c8ad 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -73,6 +73,15 @@ ValueObjectVariable::GetTypeName() } ConstString +ValueObjectVariable::GetDisplayTypeName() +{ + Type * var_type = m_variable_sp->GetType(); + if (var_type) + return var_type->GetClangForwardType().GetDisplayTypeName(); + return ConstString(); +} + +ConstString ValueObjectVariable::GetQualifiedTypeName() { Type * var_type = m_variable_sp->GetType(); diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index 9fe89b187bf..f3146b99f0c 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -185,7 +185,11 @@ FormatManager::GetPossibleMatches (ValueObject& valobj, reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField; } entries.push_back({type_name,reason,did_strip_ptr,did_strip_ref,did_strip_typedef}); - + + ConstString display_type_name(clang_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 && clang_type.IsReferenceType(nullptr, &is_rvalue_ref); j = false) { ClangASTType non_ref_type = clang_type.GetNonReferenceType(); diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp index 565d4d419da..65e5e3f4582 100644 --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -222,7 +222,11 @@ ValueObjectPrinter::PrintTypeIfNeeded () { // Some ValueObjects don't have types (like registers sets). Only print // the type if there is one to print - ConstString qualified_type_name(m_valobj->GetQualifiedTypeName()); + ConstString qualified_type_name; + if (options.m_be_raw) + qualified_type_name = m_valobj->GetQualifiedTypeName(); + else + qualified_type_name = m_valobj->GetDisplayTypeName(); if (qualified_type_name) m_stream->Printf("(%s) ", qualified_type_name.GetCString()); else diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp index 20ac65fe323..b864844625b 100644 --- a/lldb/source/Symbol/ClangASTType.cpp +++ b/lldb/source/Symbol/ClangASTType.cpp @@ -1243,6 +1243,11 @@ ClangASTType::GetTypeName () const return ConstString(type_name); } +ConstString +ClangASTType::GetDisplayTypeName () const +{ + return GetTypeName(); +} uint32_t ClangASTType::GetTypeInfo (ClangASTType *pointee_or_element_clang_type) const diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index cabdbbafa71..e58cbc19b36 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -1053,6 +1053,14 @@ TypeImpl::GetName () const return m_static_type.GetName (); } +ConstString +TypeImpl::GetDisplayTypeName () const +{ + if (m_dynamic_type) + return m_dynamic_type.GetDisplayTypeName(); + return m_static_type.GetDisplayTypeName(); +} + TypeImpl TypeImpl::GetPointerType () const { |