Do some cleanup of DumpValueObjectOptions. The whole concept of raw printing was...
authorEnrico Granata <egranata@apple.com>
Fri, 21 Nov 2014 18:47:26 +0000 (18:47 +0000)
committerEnrico Granata <egranata@apple.com>
Fri, 21 Nov 2014 18:47:26 +0000 (18:47 +0000)
llvm-svn: 222548

lldb/include/lldb/DataFormatters/ValueObjectPrinter.h
lldb/source/DataFormatters/ValueObjectPrinter.cpp
lldb/source/Interpreter/OptionGroupValueObjectDisplay.cpp

index cc8b198..235d538 100644 (file)
@@ -26,46 +26,43 @@ namespace lldb_private {
 
 struct DumpValueObjectOptions
 {
-    uint32_t m_max_ptr_depth;
-    uint32_t m_max_depth;
-    bool m_show_types;
-    bool m_show_location;
-    bool m_use_objc;
-    lldb::DynamicValueType m_use_dynamic;
-    bool m_use_synthetic;
-    bool m_scope_already_checked;
-    bool m_flat_output;
-    uint32_t m_omit_summary_depth;
-    bool m_ignore_cap;
-    lldb::Format m_format;
+    uint32_t m_max_ptr_depth = 0;
+    uint32_t m_max_depth = UINT32_MAX;
+    lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
+    uint32_t m_omit_summary_depth = 0;
+    lldb::Format m_format = lldb::eFormatDefault;
     lldb::TypeSummaryImplSP m_summary_sp;
     std::string m_root_valobj_name;
-    bool m_hide_root_type;
-    bool m_hide_name;
-    bool m_hide_value;
-    bool m_be_raw;
-    bool m_run_validator;
+    bool m_use_synthetic : 1;
+    bool m_scope_already_checked : 1;
+    bool m_flat_output : 1;
+    bool m_ignore_cap : 1;
+    bool m_show_types : 1;
+    bool m_show_location : 1;
+    bool m_use_objc : 1;
+    bool m_hide_root_type : 1;
+    bool m_hide_name : 1;
+    bool m_hide_value : 1;
+    bool m_run_validator : 1;
+    bool m_use_type_display_name : 1;
+    bool m_allow_oneliner_mode : 1;
     
     DumpValueObjectOptions() :
-    m_max_ptr_depth(0),
-    m_max_depth(UINT32_MAX),
-    m_show_types(false),
-    m_show_location(false),
-    m_use_objc(false),
-    m_use_dynamic(lldb::eNoDynamicValues),
+    m_summary_sp(),
+    m_root_valobj_name(),
     m_use_synthetic(true),
     m_scope_already_checked(false),
     m_flat_output(false),
-    m_omit_summary_depth(0),
     m_ignore_cap(false),
-    m_format (lldb::eFormatDefault),
-    m_summary_sp(),
-    m_root_valobj_name(),
-    m_hide_root_type(false),  // provide a special compact display for "po"
-    m_hide_name(false), // provide a special compact display for "po"
-    m_hide_value(false), // provide a special compact display for "po"
-    m_be_raw(false),
-    m_run_validator(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)
     {}
     
     static const DumpValueObjectOptions
@@ -76,27 +73,7 @@ struct DumpValueObjectOptions
         return g_default_options;
     }
     
-    DumpValueObjectOptions (const DumpValueObjectOptions& rhs) :
-    m_max_ptr_depth(rhs.m_max_ptr_depth),
-    m_max_depth(rhs.m_max_depth),
-    m_show_types(rhs.m_show_types),
-    m_show_location(rhs.m_show_location),
-    m_use_objc(rhs.m_use_objc),
-    m_use_dynamic(rhs.m_use_dynamic),
-    m_use_synthetic(rhs.m_use_synthetic),
-    m_scope_already_checked(rhs.m_scope_already_checked),
-    m_flat_output(rhs.m_flat_output),
-    m_omit_summary_depth(rhs.m_omit_summary_depth),
-    m_ignore_cap(rhs.m_ignore_cap),
-    m_format(rhs.m_format),
-    m_summary_sp(rhs.m_summary_sp),
-    m_root_valobj_name(rhs.m_root_valobj_name),
-    m_hide_root_type(rhs.m_hide_root_type),
-    m_hide_name(rhs.m_hide_name),
-    m_hide_value(rhs.m_hide_value),
-    m_be_raw(rhs.m_be_raw),
-    m_run_validator(rhs.m_run_validator)
-    {}
+    DumpValueObjectOptions (const DumpValueObjectOptions& rhs) = default;
     
     DumpValueObjectOptions&
     SetMaximumPointerDepth(uint32_t depth = 0)
@@ -186,26 +163,15 @@ struct DumpValueObjectOptions
     }
     
     DumpValueObjectOptions&
-    SetRawDisplay(bool raw = false)
+    SetRawDisplay()
     {
-        if (raw)
-        {
-            SetUseSyntheticValue(false);
-            SetOmitSummaryDepth(UINT32_MAX);
-            SetIgnoreCap(true);
-            SetHideName(false);
-            SetHideValue(false);
-            m_be_raw = true;
-        }
-        else
-        {
-            SetUseSyntheticValue(true);
-            SetOmitSummaryDepth(0);
-            SetIgnoreCap(false);
-            SetHideName(false);
-            SetHideValue(false);
-            m_be_raw = false;
-        }
+        SetUseSyntheticValue(false);
+        SetOmitSummaryDepth(UINT32_MAX);
+        SetIgnoreCap(true);
+        SetHideName(false);
+        SetHideValue(false);
+        SetUseTypeDisplayName(false);
+        SetAllowOnelinerMode(false);
         return *this;
     }
     
@@ -260,8 +226,23 @@ struct DumpValueObjectOptions
         m_run_validator = run;
         return *this;
     }
-};
     
+    DumpValueObjectOptions&
+    SetUseTypeDisplayName (bool dis = false)
+    {
+        m_use_type_display_name = dis;
+        return *this;
+    }
+    
+    DumpValueObjectOptions&
+    SetAllowOnelinerMode (bool oneliner = false)
+    {
+        m_allow_oneliner_mode = oneliner;
+        return *this;
+    }
+    
+};
+
 class ValueObjectPrinter
 {
 public:
index 9e825b3..5560ce2 100644 (file)
@@ -245,13 +245,13 @@ 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;
-        if (options.m_be_raw)
-            qualified_type_name = m_valobj->GetQualifiedTypeName();
+        ConstString type_name;
+        if (options.m_use_type_display_name)
+            type_name = m_valobj->GetDisplayTypeName();
         else
-            qualified_type_name = m_valobj->GetDisplayTypeName();
-        if (qualified_type_name)
-            m_stream->Printf("(%s) ", qualified_type_name.GetCString());
+            type_name = m_valobj->GetQualifiedTypeName();
+        if (type_name)
+            m_stream->Printf("(%s) ", type_name.GetCString());
         else
             show_type = false;
     }
@@ -631,7 +631,7 @@ ValueObjectPrinter::PrintChildrenIfNeeded (bool value_printed,
     
     uint32_t curr_ptr_depth = m_ptr_depth;
     bool print_children = ShouldPrintChildren (is_failed_description,curr_ptr_depth);
-    bool print_oneline = (curr_ptr_depth > 0 || options.m_show_types || options.m_be_raw) ? false : DataVisualization::ShouldPrintAsOneLiner(*m_valobj);
+    bool print_oneline = (curr_ptr_depth > 0 || options.m_show_types || !options.m_allow_oneliner_mode) ? false : DataVisualization::ShouldPrintAsOneLiner(*m_valobj);
     
     if (print_children)
     {
index 6571e98..b6c63fa 100644 (file)
@@ -185,7 +185,7 @@ OptionGroupValueObjectDisplay::GetAsDumpOptions (LanguageRuntimeDescriptionDispl
         .SetHideValue(use_objc);
     
     if (be_raw)
-        options.SetRawDisplay(true);
+        options.SetRawDisplay();
     
     options.SetRunValidator(run_validator);