[Lldb-commits] [lldb] r367963 - Revert "[CompilerType] Simplify the interface a bit more.."

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Mon Aug 5 17:42:12 PDT 2019


Author: davide
Date: Mon Aug  5 17:42:11 2019
New Revision: 367963

URL: http://llvm.org/viewvc/llvm-project?rev=367963&view=rev
Log:
Revert "[CompilerType] Simplify the interface a bit more.."

There's actually a test downstream that fails with this.
I think we can still get rid of it, but I need to do some work
there first.

Modified:
    lldb/trunk/include/lldb/Symbol/CompilerType.h
    lldb/trunk/include/lldb/Symbol/TypeSystem.h
    lldb/trunk/source/DataFormatters/FormatManager.cpp
    lldb/trunk/source/Symbol/CompilerType.cpp
    lldb/trunk/source/Symbol/TypeSystem.cpp

Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=367963&r1=367962&r2=367963&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Mon Aug  5 17:42:11 2019
@@ -334,6 +334,8 @@ public:
 
   LazyBool ShouldPrintAsOneLiner(ValueObject *valobj) const;
 
+  bool IsMeaninglessWithoutDynamicResolution() const;
+
   // Dumping types
 
 #ifndef NDEBUG

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=367963&r1=367962&r2=367963&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Mon Aug  5 17:42:11 2019
@@ -454,6 +454,20 @@ public:
 
   virtual LazyBool ShouldPrintAsOneLiner(void *type, ValueObject *valobj);
 
+  // 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;

Modified: lldb/trunk/source/DataFormatters/FormatManager.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/FormatManager.cpp?rev=367963&r1=367962&r2=367963&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Mon Aug  5 17:42:11 2019
@@ -183,13 +183,15 @@ void FormatManager::GetPossibleMatches(
     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) {
@@ -563,8 +565,10 @@ ConstString FormatManager::GetTypeForCac
                                            lldb::DynamicValueType use_dynamic) {
   ValueObjectSP valobj_sp = valobj.GetQualifiedRepresentationIfAvailable(
       use_dynamic, valobj.IsSynthetic());
-  if (valobj_sp && valobj_sp->GetCompilerType().IsValid())
-    return valobj_sp->GetQualifiedTypeName();
+  if (valobj_sp && valobj_sp->GetCompilerType().IsValid()) {
+    if (!valobj_sp->GetCompilerType().IsMeaninglessWithoutDynamicResolution())
+      return valobj_sp->GetQualifiedTypeName();
+  }
   return ConstString();
 }
 

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=367963&r1=367962&r2=367963&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Mon Aug  5 17:42:11 2019
@@ -709,6 +709,12 @@ LazyBool CompilerType::ShouldPrintAsOneL
   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.

Modified: lldb/trunk/source/Symbol/TypeSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeSystem.cpp?rev=367963&r1=367962&r2=367963&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/TypeSystem.cpp (original)
+++ lldb/trunk/source/Symbol/TypeSystem.cpp Mon Aug  5 17:42:11 2019
@@ -125,6 +125,10 @@ LazyBool TypeSystem::ShouldPrintAsOneLin
   return eLazyBoolCalculate;
 }
 
+bool TypeSystem::IsMeaninglessWithoutDynamicResolution(void *type) {
+  return false;
+}
+
 ConstString TypeSystem::DeclGetMangledName(void *opaque_decl) {
   return ConstString();
 }




More information about the lldb-commits mailing list