diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-26 23:01:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-26 23:01:51 +0000 |
commit | d42c29f9a238967a18d73d628c9c871cdc548550 (patch) | |
tree | 49daa95dfd2157ae9122615edbce92587088fdc6 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 26d5f05bf5ec9c22dee6c7bd4057ccdf48b22432 (diff) | |
download | bcm5719-llvm-d42c29f9a238967a18d73d628c9c871cdc548550.tar.gz bcm5719-llvm-d42c29f9a238967a18d73d628c9c871cdc548550.zip |
fix some sema problems with wide strings and hook up basic codegen for them.
llvm-svn: 65582
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 95490df46ba..75a8302792a 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1069,11 +1069,6 @@ GetAddrOfConstantCFString(const std::string &str) { /// GetStringForStringLiteral - Return the appropriate bytes for a /// string literal, properly padded to match the literal type. std::string CodeGenModule::GetStringForStringLiteral(const StringLiteral *E) { - if (E->isWide()) { - ErrorUnsupported(E, "wide string"); - return "FIXME"; - } - const char *StrData = E->getStrData(); unsigned Len = E->getByteLength(); @@ -1081,10 +1076,13 @@ std::string CodeGenModule::GetStringForStringLiteral(const StringLiteral *E) { getContext().getAsConstantArrayType(E->getType()); assert(CAT && "String isn't pointer or array!"); - // Resize the string to the right size - // FIXME: What about wchar_t strings? + // Resize the string to the right size. std::string Str(StrData, StrData+Len); uint64_t RealLen = CAT->getSize().getZExtValue(); + + if (E->isWide()) + RealLen *= getContext().Target.getWCharWidth()/8; + Str.resize(RealLen, '\0'); return Str; |