<rdar://problem/11814875>
authorEnrico Granata <egranata@apple.com>
Tue, 13 Nov 2012 02:05:45 +0000 (02:05 +0000)
committerEnrico Granata <egranata@apple.com>
Tue, 13 Nov 2012 02:05:45 +0000 (02:05 +0000)
If a ValueObjectDynamic has no formatter, try using its static type to figure one out

llvm-svn: 167803

lldb/include/lldb/Core/FormatNavigator.h
lldb/include/lldb/Core/ValueObjectSyntheticFilter.h
lldb/include/lldb/lldb-private-enumerations.h

index 254662b..76c80bb 100644 (file)
@@ -633,6 +633,25 @@ protected:
                 return true;
             }
         }
+        
+        // if all else fails, go to static type
+        if (valobj.IsDynamic())
+        {
+            if (log)
+                log->Printf("[Get] going to static value");
+            lldb::ValueObjectSP static_value_sp(valobj.GetStaticValue());
+            if (static_value_sp)
+            {
+                if (log)
+                    log->Printf("[Get] has a static value - actually use it");
+                if (Get(*static_value_sp.get(), clang::QualType::getFromOpaquePtr(static_value_sp->GetClangType()) , entry, use_dynamic, reason))
+                {
+                    reason |= lldb_private::eFormatterChoiceCriterionWentToStaticValue;
+                    return true;
+                }
+            }
+        }
+        
         return false;
     }
 };
index f0b1761..bc18aea 100644 (file)
@@ -77,12 +77,9 @@ public:
     virtual bool
     IsDynamic ()
     {
-        if (m_parent)
-            return m_parent->IsDynamic();
-        else
-            return false;
+        return false;
     }
-    
+
     virtual ValueObject *
     GetParent()
     {
index 29e60f9..8839b44 100644 (file)
@@ -213,7 +213,8 @@ typedef enum FormatterChoiceCriterion
     eFormatterChoiceCriterionRegularExpressionSummary =      0x00000004,
     eFormatterChoiceCriterionRegularExpressionFilter =       0x00000004,
     eFormatterChoiceCriterionDynamicObjCDiscovery =          0x00000008,
-    eFormatterChoiceCriterionStrippedBitField =              0x00000010
+    eFormatterChoiceCriterionStrippedBitField =              0x00000010,
+    eFormatterChoiceCriterionWentToStaticValue =             0x00000020
 } FormatterChoiceCriterion;
 
 //----------------------------------------------------------------------