diff options
| author | Enrico Granata <egranata@apple.com> | 2015-10-20 00:13:19 +0000 |
|---|---|---|
| committer | Enrico Granata <egranata@apple.com> | 2015-10-20 00:13:19 +0000 |
| commit | b3f0c3400fa07697f67dafa2ff4720e8668d47be (patch) | |
| tree | bf250f91c51f9cb6fd05a87e848939ba02364254 /lldb | |
| parent | 19d951874a569b6af0676c14462eaecb663c980f (diff) | |
| download | bcm5719-llvm-b3f0c3400fa07697f67dafa2ff4720e8668d47be.tar.gz bcm5719-llvm-b3f0c3400fa07697f67dafa2ff4720e8668d47be.zip | |
Introduce the concept of a type that is meaningless without dynamic resolution, which are essentially placeholder types meant to appease a language's type system but do not offer any actual information to the debugger, unless further resolved
This is currently meant for data formatters to know to ignore such types in caching and lookup
llvm-svn: 250767
Diffstat (limited to 'lldb')
| -rw-r--r-- | lldb/include/lldb/Symbol/CompilerType.h | 3 | ||||
| -rw-r--r-- | lldb/include/lldb/Symbol/TypeSystem.h | 12 | ||||
| -rw-r--r-- | lldb/source/DataFormatters/FormatManager.cpp | 30 | ||||
| -rw-r--r-- | lldb/source/Symbol/CompilerType.cpp | 8 | ||||
| -rw-r--r-- | lldb/source/Symbol/TypeSystem.cpp | 6 |
5 files changed, 41 insertions, 18 deletions
diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 27baa9746e9..1657118b421 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -462,6 +462,9 @@ public: LazyBool ShouldPrintAsOneLiner () const; + bool + IsMeaninglessWithoutDynamicResolution () const; + //------------------------------------------------------------------ // Pointers & References //------------------------------------------------------------------ diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index ae12dce8039..f5b7618f2ec 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -528,6 +528,18 @@ public: virtual LazyBool ShouldPrintAsOneLiner (void* type); + // Type systems can have types that are placeholder types, which are meant to indicate + // the presence of a type, but offer no actual information about said types, and leave + // the burden of actually figuring type information out to dynamic type resolution. For instance + // a language with a generics system, can use placeholder types to indicate "type argument goes here", + // without promising uniqueness of the placeholder, nor attaching any actually idenfiable information + // to said placeholder. This API allows type systems to tell LLDB when such a type has been encountered + // In response, the debugger can react by not using this type as a cache entry in any type-specific way + // For instance, LLDB will currently not cache any formatters that are discovered on such a type as + // attributable to the meaningless type itself, instead preferring to use the dynamic type + virtual bool + IsMeaninglessWithoutDynamicResolution (void* type); + protected: const LLVMCastKind m_kind; // Support for llvm casting SymbolFile *m_sym_file; diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index e41d5eecb32..12e8ef43bfd 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -210,11 +210,15 @@ FormatManager::GetPossibleMatches (ValueObject& valobj, entries.push_back({bitfieldname,0,did_strip_ptr,did_strip_ref,did_strip_typedef}); reason |= lldb_private::eFormatterChoiceCriterionStrippedBitField; } - 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}); + 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) { @@ -641,22 +645,12 @@ ConstString FormatManager::GetTypeForCache (ValueObject& valobj, lldb::DynamicValueType use_dynamic) { - if (use_dynamic == lldb::eNoDynamicValues) + ValueObjectSP valobj_sp = valobj.GetQualifiedRepresentationIfAvailable(use_dynamic, valobj.IsSynthetic()); + if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) { - if (valobj.IsDynamic()) - { - if (valobj.GetStaticValue()) - return valobj.GetStaticValue()->GetQualifiedTypeName(); - else - return ConstString(); - } - else - return valobj.GetQualifiedTypeName(); + if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution()) + return valobj_sp->GetQualifiedTypeName(); } - if (valobj.IsDynamic()) - return valobj.GetQualifiedTypeName(); - if (valobj.GetDynamicValue(use_dynamic)) - return valobj.GetDynamicValue(use_dynamic)->GetQualifiedTypeName(); return ConstString(); } diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index 84e446b3b93..061539a0310 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -867,6 +867,14 @@ CompilerType::ShouldPrintAsOneLiner () const return eLazyBoolCalculate; } +bool +CompilerType::IsMeaninglessWithoutDynamicResolution () const +{ + if (IsValid()) + return m_type_system->IsMeaninglessWithoutDynamicResolution(m_type); + return false; +} + // Get the index of the child of "clang_type" whose name matches. This function // doesn't descend into the children, but only looks one level deep and name // matches can include base class names. diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp index cd0ceb76aae..eb44b292603 100644 --- a/lldb/source/Symbol/TypeSystem.cpp +++ b/lldb/source/Symbol/TypeSystem.cpp @@ -109,6 +109,12 @@ TypeSystem::ShouldPrintAsOneLiner (void* type) return eLazyBoolCalculate; } +bool +TypeSystem::IsMeaninglessWithoutDynamicResolution (void* type) +{ + return false; +} + #pragma mark TypeSystemMap TypeSystemMap::TypeSystemMap() : |

