Commit a3c8f042 authored by Enrico Granata's avatar Enrico Granata
Browse files

Add an accessor to ValueObject that determines if the object represents a base...

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

llvm-svn: 216032
parent 3f3d7acb
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -430,6 +430,9 @@ public:
        return false;
    }
    
    bool
    IsBaseClass (uint32_t& depth);
    
    virtual bool
    IsDereferenceOfParent ()
    {
+20 −0
Original line number Diff line number Diff line
@@ -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)
{