From: Ken Dyck Date: Sun, 24 Apr 2011 17:37:26 +0000 (+0000) Subject: Convert size and alignment variables to CharUnits in EmitAggregateCopy(). No X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1a8c15a8b7f7c6d851e0d3dd1b86d5f78515ffa4;p=clang Convert size and alignment variables to CharUnits in EmitAggregateCopy(). No change in functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130113 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp index 5c2dc7f511..53bc58b69c 100644 --- a/lib/CodeGen/CGExprAgg.cpp +++ b/lib/CodeGen/CGExprAgg.cpp @@ -893,7 +893,8 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, // safely handle this, we can add a target hook. // Get size and alignment info for this aggregate. - std::pair TypeInfo = getContext().getTypeInfo(Ty); + std::pair TypeInfo = + getContext().getTypeInfoInChars(Ty); // FIXME: Handle variable sized types. @@ -923,9 +924,9 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, if (const RecordType *RecordTy = Ty->getAs()) { RecordDecl *Record = RecordTy->getDecl(); if (Record->hasObjectMember()) { - unsigned long size = TypeInfo.first/8; + CharUnits size = TypeInfo.first; const llvm::Type *SizeTy = ConvertType(getContext().getSizeType()); - llvm::Value *SizeVal = llvm::ConstantInt::get(SizeTy, size); + llvm::Value *SizeVal = llvm::ConstantInt::get(SizeTy, size.getQuantity()); CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this, DestPtr, SrcPtr, SizeVal); return; @@ -934,9 +935,10 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, QualType BaseType = getContext().getBaseElementType(Ty); if (const RecordType *RecordTy = BaseType->getAs()) { if (RecordTy->getDecl()->hasObjectMember()) { - unsigned long size = TypeInfo.first/8; + CharUnits size = TypeInfo.first; const llvm::Type *SizeTy = ConvertType(getContext().getSizeType()); - llvm::Value *SizeVal = llvm::ConstantInt::get(SizeTy, size); + llvm::Value *SizeVal = + llvm::ConstantInt::get(SizeTy, size.getQuantity()); CGM.getObjCRuntime().EmitGCMemmoveCollectable(*this, DestPtr, SrcPtr, SizeVal); return; @@ -945,6 +947,7 @@ void CodeGenFunction::EmitAggregateCopy(llvm::Value *DestPtr, } Builder.CreateMemCpy(DestPtr, SrcPtr, - llvm::ConstantInt::get(IntPtrTy, TypeInfo.first/8), - TypeInfo.second/8, isVolatile); + llvm::ConstantInt::get(IntPtrTy, + TypeInfo.first.getQuantity()), + TypeInfo.second.getQuantity(), isVolatile); }