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

Anders Carlsson andersca at mac.com
Wed Jul 29 08:59:54 PDT 2009


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?

> -  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?

Also, does this handle multi-level inheritence?

class A { }; class B : A { }; class C : B { };

Anders




More information about the cfe-commits mailing list