From: Ken Dyck Date: Tue, 26 Jan 2010 18:35:11 +0000 (+0000) Subject: Use CharUnits for alignment in EmitNullInitializationLValue(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3228f42b12c24c76f5d5ae4ebf80837b752d1683;p=clang Use CharUnits for alignment in EmitNullInitializationLValue(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94563 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 2358bb3592..b2ecd55f44 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1648,8 +1648,8 @@ LValue CodeGenFunction::EmitNullInitializationLValue( QualType Ty = E->getType(); const llvm::Type *LTy = ConvertTypeForMem(Ty); llvm::AllocaInst *Alloc = CreateTempAlloca(LTy); - unsigned Align = getContext().getTypeAlign(Ty)/8; - Alloc->setAlignment(Align); + CharUnits Align = getContext().getTypeAlignInChars(Ty); + Alloc->setAlignment(Align.getQuantity()); LValue lvalue = LValue::MakeAddr(Alloc, Qualifiers()); EmitMemSetToZero(lvalue.getAddress(), Ty); return lvalue;