[Lldb-commits] [lldb] r216032 - Add an accessor to ValueObject that determines if the object represents a base class, and also returns the depth of base-class-ness. For instance if one has class C : public B {} class B : public A {}, the value for A nested in B nested in C would be a base class of depth 2

Enrico Granata egranata at apple.com
Tue Aug 19 15:29:08 PDT 2014


Author: enrico
Date: Tue Aug 19 17:29:08 2014
New Revision: 216032

URL: http://llvm.org/viewvc/llvm-project?rev=216032&view=rev
Log:
Add an accessor to ValueObject that determines if the object represents a base class, and also returns the depth of base-class-ness. For instance if one has class C : public B {} class B : public A {}, the value for A nested in B nested in C would be a base class of depth 2

Modified:
    lldb/trunk/include/lldb/Core/ValueObject.h
    lldb/trunk/source/Core/ValueObject.cpp

Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=216032&r1=216031&r2=216032&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Tue Aug 19 17:29:08 2014
@@ -430,6 +430,9 @@ public:
         return false;
     }
     
+    bool
+    IsBaseClass (uint32_t& depth);
+    
     virtual bool
     IsDereferenceOfParent ()
     {

Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=216032&r1=216031&r2=216032&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Tue Aug 19 17:29:08 2014
@@ -2396,6 +2396,26 @@ ValueObject::GetNonBaseClassParent()
     return NULL;
 }
 
+
+bool
+ValueObject::IsBaseClass (uint32_t& depth)
+{
+    if (!IsBaseClass())
+    {
+        depth = 0;
+        return false;
+    }
+    if (GetParent())
+    {
+        GetParent()->IsBaseClass(depth);
+        depth = depth + 1;
+        return true;
+    }
+    // TODO: a base of no parent? weird..
+    depth = 1;
+    return true;
+}
+
 void
 ValueObject::GetExpressionPath (Stream &s, bool qualify_cxx_base_classes, GetExpressionPathFormat epformat)
 {





More information about the lldb-commits mailing list