]> granicus.if.org Git - clang/commitdiff
Replace a literal '8' with getCharWidth().
authorKen Dyck <kd@kendyck.com>
Sat, 29 Jan 2011 17:53:12 +0000 (17:53 +0000)
committerKen Dyck <kd@kendyck.com>
Sat, 29 Jan 2011 17:53:12 +0000 (17:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124536 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp

index d2be432bbf8b259cb69e2c60aa1ecbab6c0f130f..80d0f10c06a73d2f379617eb44a21c5270d3dd73 100644 (file)
@@ -1717,15 +1717,16 @@ CodeGenModule::GetAddrOfConstantString(const StringLiteral *Literal) {
 /// GetStringForStringLiteral - Return the appropriate bytes for a
 /// string literal, properly padded to match the literal type.
 std::string CodeGenModule::GetStringForStringLiteral(const StringLiteral *E) {
+  const ASTContext &Context = getContext();
   const ConstantArrayType *CAT =
-    getContext().getAsConstantArrayType(E->getType());
+    Context.getAsConstantArrayType(E->getType());
   assert(CAT && "String isn't pointer or array!");
 
   // Resize the string to the right size.
   uint64_t RealLen = CAT->getSize().getZExtValue();
 
   if (E->isWide())
-    RealLen *= getContext().Target.getWCharWidth()/8;
+    RealLen *= Context.Target.getWCharWidth() / Context.getCharWidth();
 
   std::string Str = E->getString().str();
   Str.resize(RealLen, '\0');