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

lib/CodeGen/CodeGenModule.cpp

index ebd3df1cf93e26b199df81031760b092ac4725e4..dc66f04c5ec8a9eb78c4dfdf757c01048bd36f67 100644 (file)
@@ -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);