From: Ken Dyck Date: Tue, 26 Jan 2010 18:46:23 +0000 (+0000) Subject: Use CharUnits for alignment of UTF16 string in GetAddrOfConstantCFString(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4da244c23d6093adbbbc41654aa5c5111b38f431;p=clang Use CharUnits for alignment of UTF16 string in GetAddrOfConstantCFString(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94564 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index ebd3df1cf9..dc66f04c5e 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1501,8 +1501,8 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { if (Sect) GV->setSection(Sect); if (isUTF16) { - unsigned Align = getContext().getTypeAlign(getContext().ShortTy)/8; - GV->setAlignment(Align); + CharUnits Align = getContext().getTypeAlignInChars(getContext().ShortTy); + GV->setAlignment(Align.getQuantity()); } Fields[2] = llvm::ConstantExpr::getGetElementPtr(GV, Zeros, 2);