This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
vtable origin in class information
- From: Enes Goktas <enes dot goktas at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 10 Jan 2015 22:55:13 +0100
- Subject: vtable origin in class information
- Authentication-results: sourceware.org; auth=none
Dear GCC supporters,
I would like to ask a question regarding the vtable information a
class has during compilation.
Assume that we have the following classes:
------------------------------
class A {
public:
virtual int virtFuncA(){ return 0xA; }
};
class B {
public:
virtual int virtFuncB(){ return 0xB; }
};
class C: public A, public B{
public:
int virtFuncA(){ return 0xCA; }
int virtFuncB(){ return 0xCB; }
virtual int virtFuncC(){ return 0xC; }
};
class D{
public:
virtual int virtFuncD(){ return 0xD; }
};
class E: public C, public D{
public:
int virtFuncA(){ return 0xEA; }
int virtFuncB(){ return 0xEB; }
int virtFuncC(){ return 0xEC; }
int virtFuncD(){ return 0xED; }
};
------------------------------
---
In the end class E will have three vtables. First two originate from
class C and third one originate from class D.
When we have the tree object of class E during compilation, could we
tell that its first two vtables originate from class C and third one
from class D?
Class C will have two vtables. The first one is a vtable originating
from class A merged with the vtable of class C itself, and the second
one is a vtable originating from class B.
During compilation, could we tell that the first vtable originates
from both class A and C itself?
If this is possible, could you please tell with which functions of gcc
this can be done?
I really appreciate any help you can provide.
Best, Enes