[cfe-dev] Clang/LLVM Member Function Pointers size and behavior?

John McCall rjmccall at apple.com
Tue Oct 16 11:09:48 PDT 2012


On Oct 16, 2012, at 10:34 AM, Devid wrote:
> Well actually I am using ItaniumCXXABI for now and this work well except
> this problem.

I'm confused.  You need compatibility with MSVC about the size of member
function pointers, but you don't care about compatibility of, say, class layout
or vtables or anything like that?

> So I change ItaniumCXXABI::getMemberPointerSize() to always return 1.
> The only point getMemberPointerSize() will be called is in
> ASTContext::getTypeInfoImpl()
> 
> What need to be done so Member Function will be called in like this ?
> MyMemberFunction(MyClass *ptr, int other_stuff); 

You'll have to also hack code generation so that
  (1) it always uses a this-adjustment of zero and
  (2) it recognizes whatever the pattern for virtual functions is, unless
    it happens to be exactly the same as it is in Itanium.

These are just private changes and you're not hoping to upstream them, right?

>> you need sizeof (which informs struct layout, etc.) to do the right thing
>> as well. 
> Is  ASTContext::getTypeInfoImpl()  not responsible for sizeof() ? 

It is.

John.



More information about the cfe-dev mailing list