[Lldb-commits] [lldb] r192013 - Cleaner way to work around the lack of delegating constructors on some versions of GCC

Enrico Granata egranata at apple.com
Fri Oct 4 17:20:27 PDT 2013


Author: enrico
Date: Fri Oct  4 19:20:27 2013
New Revision: 192013

URL: http://llvm.org/viewvc/llvm-project?rev=192013&view=rev
Log:
Cleaner way to work around the lack of delegating constructors on some versions of GCC


Modified:
    lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
    lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp

Modified: lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h?rev=192013&r1=192012&r2=192013&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/ValueObjectPrinter.h Fri Oct  4 19:20:27 2013
@@ -273,6 +273,15 @@ protected:
                         uint32_t ptr_depth,
                         uint32_t curr_depth);
     
+    // we should actually be using delegating constructors here
+    // but some versions of GCC still have trouble with those
+    void
+    Init (ValueObject* valobj,
+          Stream* s,
+          const DumpValueObjectOptions& options,
+          uint32_t ptr_depth,
+          uint32_t curr_depth);
+    
     bool
     GetDynamicValueIfNeeded ();
     

Modified: lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp?rev=192013&r1=192012&r2=192013&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp (original)
+++ lldb/trunk/source/DataFormatters/ValueObjectPrinter.cpp Fri Oct  4 19:20:27 2013
@@ -23,48 +23,45 @@ using namespace lldb_private;
 
 ValueObjectPrinter::ValueObjectPrinter (ValueObject* valobj,
                                         Stream* s,
-                                        const DumpValueObjectOptions& options) :
-    m_orig_valobj(valobj),
-    m_valobj(nullptr),
-    m_stream(s),
-    options(options),
-    m_ptr_depth(options.m_max_ptr_depth),
-    m_curr_depth(0),
-    m_should_print(eLazyBoolCalculate),
-    m_is_nil(eLazyBoolCalculate),
-    m_is_ptr(eLazyBoolCalculate),
-    m_is_ref(eLazyBoolCalculate),
-    m_is_aggregate(eLazyBoolCalculate),
-    m_summary_formatter({nullptr,false}),
-    m_value(),
-    m_summary(),
-    m_error()
+                                        const DumpValueObjectOptions& options)
 {
-    assert (m_orig_valobj && "cannot print a NULL ValueObject");
-    assert (m_stream && "cannot print to a NULL Stream");
+    Init(valobj,s,options,options.m_max_ptr_depth,0);
 }
 
 ValueObjectPrinter::ValueObjectPrinter (ValueObject* valobj,
                                         Stream* s,
                                         const DumpValueObjectOptions& options,
                                         uint32_t ptr_depth,
-                                        uint32_t curr_depth) :
-    m_orig_valobj(valobj),
-    m_valobj(nullptr),
-    m_stream(s),
-    options(options),
-    m_ptr_depth(ptr_depth),
-    m_curr_depth(curr_depth),
-    m_should_print(eLazyBoolCalculate),
-    m_is_nil(eLazyBoolCalculate),
-    m_is_ptr(eLazyBoolCalculate),
-    m_is_ref(eLazyBoolCalculate),
-    m_is_aggregate(eLazyBoolCalculate),
-    m_summary_formatter({nullptr,false}),
-    m_value(),
-    m_summary(),
-    m_error()
-{ }
+                                        uint32_t curr_depth)
+{
+    Init(valobj,s,options,ptr_depth,curr_depth);
+}
+
+void
+ValueObjectPrinter::Init (ValueObject* valobj,
+                          Stream* s,
+                          const DumpValueObjectOptions& options,
+                          uint32_t ptr_depth,
+                          uint32_t curr_depth)
+{
+    m_orig_valobj = valobj;
+    m_valobj = nullptr;
+    m_stream = s;
+    this->options = options;
+    m_ptr_depth = ptr_depth;
+    m_curr_depth = curr_depth;
+    assert (m_orig_valobj && "cannot print a NULL ValueObject");
+    assert (m_stream && "cannot print to a NULL Stream");
+    m_should_print = eLazyBoolCalculate;
+    m_is_nil = eLazyBoolCalculate;
+    m_is_ptr = eLazyBoolCalculate;
+    m_is_ref = eLazyBoolCalculate;
+    m_is_aggregate = eLazyBoolCalculate;
+    m_summary_formatter = {nullptr,false};
+    m_value.assign("");
+    m_summary.assign("");
+    m_error.assign("");
+}
 
 bool
 ValueObjectPrinter::PrintValueObject ()





More information about the lldb-commits mailing list