diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-04-22 08:20:31 +0000 | 
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-22 08:20:31 +0000 | 
| commit | 89623deca10793927d85c2548ead5e3509b69b65 (patch) | |
| tree | eff67fbbe79b51a9a837ce4248ecc677b1bcf74b | |
| parent | bb754826c932aec0b202c254a2c0fc68ff82e362 (diff) | |
| download | bcm5719-llvm-89623deca10793927d85c2548ead5e3509b69b65.tar.gz bcm5719-llvm-89623deca10793927d85c2548ead5e3509b69b65.zip  | |
Use ComputeIvarBaseOffset instead of looking up by hand.
llvm-svn: 69789
| -rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 9 | 
1 files changed, 2 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index b3054cce357..9c3449f5008 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -747,8 +747,6 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {    llvm::SmallVector<llvm::Constant*, 16> IvarNames;    llvm::SmallVector<llvm::Constant*, 16> IvarTypes;    llvm::SmallVector<llvm::Constant*, 16> IvarOffsets; -  const llvm::StructLayout *Layout = -    CGM.getTargetData().getStructLayout(cast<llvm::StructType>(ObjTy));    ObjTy = llvm::PointerType::getUnqual(ObjTy);    for (ObjCInterfaceDecl::ivar_iterator iter = ClassDecl->ivar_begin(),        endIter = ClassDecl->ivar_end() ; iter != endIter ; iter++) { @@ -760,12 +758,9 @@ void CGObjCGNU::GenerateClass(const ObjCImplementationDecl *OID) {        Context.getObjCEncodingForType((*iter)->getType(), TypeStr);        IvarTypes.push_back(CGM.GetAddrOfConstantCString(TypeStr));        // Get the offset -      const FieldDecl *Field =  -        ClassDecl->lookupFieldDeclForIvar(Context, (*iter)); -      int offset = -        (int)Layout->getElementOffset(CGM.getTypes().getLLVMFieldNo(Field)); +      uint64_t Offset = ComputeIvarBaseOffset(CGM, ClassDecl, *iter);        IvarOffsets.push_back( -          llvm::ConstantInt::get(llvm::Type::Int32Ty, offset)); +          llvm::ConstantInt::get(llvm::Type::Int32Ty, Offset));    }    // Collect information about instance methods  | 

