[Lldb-commits] [lldb] r248363 - Allow CompilerType to express a vote on whether oneliner printing should happen

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 22 19:04:35 PDT 2015


Author: enrico
Date: Tue Sep 22 21:04:34 2015
New Revision: 248363

URL: http://llvm.org/viewvc/llvm-project?rev=248363&view=rev
Log:
Allow CompilerType to express a vote on whether oneliner printing should happen


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=248363&r1=248362&r2=248363&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Tue Sep 22 21:04:34 2015
@@ -459,6 +459,9 @@ public:
     CompilerType
     GetTypeForFormatters () const;
     
+    LazyBool
+    ShouldPrintAsOneLiner () const;
+    
     //------------------------------------------------------------------
     // Pointers & References
     //------------------------------------------------------------------

Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=248363&r1=248362&r2=248363&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Tue Sep 22 21:04:34 2015
@@ -507,6 +507,9 @@ public:
     virtual CompilerType
     GetTypeForFormatters (void* type);
     
+    virtual LazyBool
+    ShouldPrintAsOneLiner (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=248363&r1=248362&r2=248363&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/FormatManager.cpp (original)
+++ lldb/trunk/source/DataFormatters/FormatManager.cpp Tue Sep 22 21:04:34 2015
@@ -558,6 +558,23 @@ FormatManager::ShouldPrintAsOneLiner (Va
     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())
+        {
+            case eLazyBoolNo:
+                return false;
+            case eLazyBoolYes:
+                return true;
+            case eLazyBoolCalculate:
+            default:
+                break;
+        }
+    }
+    
     size_t total_children_name_len = 0;
     
     for (size_t idx = 0;

Modified: lldb/trunk/source/Symbol/CompilerType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerType.cpp?rev=248363&r1=248362&r2=248363&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerType.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerType.cpp Tue Sep 22 21:04:34 2015
@@ -859,6 +859,14 @@ CompilerType::GetTypeForFormatters () co
     return CompilerType();
 }
 
+LazyBool
+CompilerType::ShouldPrintAsOneLiner () const
+{
+    if (IsValid())
+        return m_type_system->ShouldPrintAsOneLiner(m_type);
+    return eLazyBoolCalculate;
+}
+
 // 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=248363&r1=248362&r2=248363&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/TypeSystem.cpp (original)
+++ lldb/trunk/source/Symbol/TypeSystem.cpp Tue Sep 22 21:04:34 2015
@@ -85,3 +85,9 @@ TypeSystem::GetTypeForFormatters (void*
 {
     return CompilerType(this, type);
 }
+
+LazyBool
+TypeSystem::ShouldPrintAsOneLiner (void* type)
+{
+    return eLazyBoolCalculate;
+}




More information about the lldb-commits mailing list