[cfe-dev] Thunks for MS ABI.

r4start r4start at gmail.com
Fri Feb 3 02:10:25 PST 2012


Hi all.

While I implementing vf-tables for MS ABI I met a problem.
In MS ABI vf-table defines by pair of CXXRecordDecl, for example

class first{
public:
   virtual void asdf() {}
};
class second : public virtual first {
public :
   int q;
     virtual void asdf() { q = 90; }
};
class third : public virtual second {
public:
   virtual void ff(){}
};

Class third has 2 vf-tables

class third    size(24):
          +---
    0    | {vfptr}
    4    | {vbptr}
          +---
          +--- (virtual base first)
    8    | {vfptr}
  12    | s
           +---
           +--- (virtual base second)
   16    | {vbptr}
   20    | q
            +---
third::$vftable at third@:
          | &third_meta
          |  0
    0    | &third::ff

third::$vftable at second@:
          | -8
    0    | &thunk: this+=16; goto second::asdf

I store vf-tables in map<const CXXRecordDecl *, const CXXRecordDecl *>.
If I want emit thunk , then I need to know record class(third) and base 
class(first).
But getThunkInfo function has one parameter CXXMethodDecl and getParent 
function returns first class.
How can I get third class record declaration?

Thanks in advance.




More information about the cfe-dev mailing list