aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorKen Dyck <kd@kendyck.com>2011-01-29 17:53:12 +0000
committerKen Dyck <kd@kendyck.com>2011-01-29 17:53:12 +0000
commit3b8037a8c6f462e51f75c82b3d7fe1b8dbcf06c0 (patch)
treed1ec32af714ba17efce27172965dec34b84e7ca2 /lib/CodeGen/CodeGenModule.cpp
parentc93a776c89bd0820813e5c7c87af2c820d9bbd27 (diff)
Replace a literal '8' with getCharWidth().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124536 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index d2be432bbf..80d0f10c06 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -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');