aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-05-27 07:57:14 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-05-27 07:57:14 +0000
commit8ef1f26775cae95d202d8d90d92d39add685af3e (patch)
tree293cddd41f1f68aac54ce5c815edfe5e04ad8e9d
parent3e4177f23326305e206e6b7134c66f681e59f9d6 (diff)
Get the type right for wide string literals; it's wchar_t, not char.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51586 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/Sema/wchar_size.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index e85ad03694..7dda9b141d 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -51,7 +51,7 @@ Sema::ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks) {
StringToks[NumStringToks-1].getLocation()));
QualType StrTy = Context.CharTy;
- // FIXME: handle wchar_t
+ if (Literal.AnyWide) StrTy = Context.getWcharType();
if (Literal.Pascal) StrTy = Context.UnsignedCharTy;
// Get an array type for the string, according to C99 6.4.5. This includes
diff --git a/test/Sema/wchar_size.c b/test/Sema/wchar_size.c
new file mode 100644
index 0000000000..a4041b976d
--- /dev/null
+++ b/test/Sema/wchar_size.c
@@ -0,0 +1,3 @@
+// RUN: clang %s -fsyntax-only -verify -triple=i686-apple-darwin9
+
+int check_wchar_size[sizeof(*L"") == 4 ? 1 : -1];