[cfe-commits] r77458 - /cfe/trunk/lib/CodeGen/CGCXX.cpp

Anders Carlsson andersca at mac.com
Fri Jul 31 13:35:36 PDT 2009


On Jul 29, 2009, at 10:25 AM, Sebastian Redl wrote:

>>>
>>>> -  if (!DerivedToBaseConversion) {
>>>> -    assert(false && "FIXME - Only derived to imm. base convesion
>>>> is supported");
>>>> -    return BaseValue;
>>>> -  }
>>>> -  uint64_t Offset = Layout.getFieldOffset(Idx) / 8;
>>>> -  llvm::Value *OffsetVal =
>>>> llvm::ConstantInt::get(llvm::Type::Int32Ty, Offset);
>>>> +  uint64_t Offset = Layout.getBaseClassOffset(BaseClassDecl) / 8;
>>>>
>>> I'm thinking now that we should make getBaseClassOffset return the
>>> offset in bytes, it never makes sense to have it in bits. What do
>>> you think?
>>>
>> Agreed.
>>
> What about merging leading bitfields of derived classes into the base
> class if it has trailing padding? You're not actually supposed to do
> that, but GCC does it (see the documentation of the -Wabi switch), and
> if we want to be bug-for-bug compatible with GCC in this area, having
> the offset in bits could be useful.
>

This seems to be target specific - I could not get it to work with gcc  
4.2.1 on OS X. Also, if it violates the Itanium ABI, then I don't  
think it's a good idea to support it. (Or at least not to worry about  
it for now).

Anders



More information about the cfe-commits mailing list