]> granicus.if.org Git - clang/commitdiff
Use CharUnits for alignment in EmitNullInitializationLValue().
authorKen Dyck <ken.dyck@onsemi.com>
Tue, 26 Jan 2010 18:35:11 +0000 (18:35 +0000)
committerKen Dyck <ken.dyck@onsemi.com>
Tue, 26 Jan 2010 18:35:11 +0000 (18:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94563 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExpr.cpp

index 2358bb35923afc434a6e0fd705640611021ca6cb..b2ecd55f441507468061386d8fb8ae6a9abae57c 100644 (file)
@@ -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;