From a0f99ff2308e5d91d37562e04fd66fd1765843d3 Mon Sep 17 00:00:00 2001 From: Ken Dyck Date: Tue, 26 Jan 2010 18:46:23 +0000 Subject: Use CharUnits for alignment of UTF16 string in GetAddrOfConstantCFString(). llvm-svn: 94564 --- clang/lib/CodeGen/CodeGenModule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index ebd3df1cf93e..dc66f04c5ec8 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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); -- cgit v1.2.3