[Lldb-commits] [lldb] r132354 - /lldb/trunk/source/Core/ValueObjectDynamicValue.cpp

Greg Clayton gclayton at apple.com
Tue May 31 13:18:39 PDT 2011


Author: gclayton
Date: Tue May 31 15:18:39 2011
New Revision: 132354

URL: http://llvm.org/viewvc/llvm-project?rev=132354&view=rev
Log:
Fix dynamic value objects to do the right thing when the
value fails to evaluate.


Modified:
    lldb/trunk/source/Core/ValueObjectDynamicValue.cpp

Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=132354&r1=132353&r2=132354&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Tue May 31 15:18:39 2011
@@ -60,11 +60,8 @@
 ConstString
 ValueObjectDynamicValue::GetTypeName()
 {
-    // FIXME: Maybe cache the name, but have to clear it out if the type changes...
-    if (!UpdateValueIfNeeded())
-        return ConstString("<unknown type>");
-        
-    if (m_type_sp)
+    const bool success = UpdateValueIfNeeded();
+    if (success && m_type_sp)
         return ClangASTType::GetClangTypeName (GetClangType());
     else
         return m_parent->GetTypeName();
@@ -73,10 +70,8 @@
 uint32_t
 ValueObjectDynamicValue::CalculateNumChildren()
 {
-    if (!UpdateValueIfNeeded())
-        return 0;
-        
-    if (m_type_sp)
+    const bool success = UpdateValueIfNeeded();
+    if (success && m_type_sp)
         return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true);
     else
         return m_parent->GetNumChildren();
@@ -85,10 +80,8 @@
 clang::ASTContext *
 ValueObjectDynamicValue::GetClangAST ()
 {
-    if (!UpdateValueIfNeeded())
-        return NULL;
-        
-    if (m_type_sp)
+    const bool success = UpdateValueIfNeeded();
+    if (success && m_type_sp)
         return m_type_sp->GetClangAST();
     else
         return m_parent->GetClangAST ();
@@ -97,10 +90,8 @@
 size_t
 ValueObjectDynamicValue::GetByteSize()
 {
-    if (!UpdateValueIfNeeded())
-        return 0;
-        
-    if (m_type_sp)
+    const bool success = UpdateValueIfNeeded();
+    if (success && m_type_sp)
         return m_value.GetValueByteSize(GetClangAST(), NULL);
     else
         return m_parent->GetByteSize();





More information about the lldb-commits mailing list