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

Sebastian Redl sebastian.redl at getdesigned.at
Wed Jul 29 10:25:29 PDT 2009


Fariborz Jahanian wrote:
> On Jul 29, 2009, at 8:59 AM, Anders Carlsson wrote:
>
>   
>> 29 jul 2009 kl. 08.54 skrev Fariborz Jahanian:
>>
>>     
>>> Author: fjahanian
>>> Date: Wed Jul 29 10:54:56 2009
>>> New Revision: 77458
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=77458&view=rev
>>> Log:
>>> Use the existing API for base offset. Use suitable llvm type
>>> for offset ir-gen.
>>>
>>>       
>> Great! This means that we can remove the extra field offsets for  
>> base classes now, right?
>>     
>
> Yes, I will clean up today.
>
>   
>>     
>>> -  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.

Sebastian



More information about the cfe-commits mailing list