[cfe-commits] r51586 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Sema/wchar_size.c

Eli Friedman eli.friedman at gmail.com
Tue May 27 00:57:15 PDT 2008


Author: efriedma
Date: Tue May 27 02:57:14 2008
New Revision: 51586

URL: http://llvm.org/viewvc/llvm-project?rev=51586&view=rev
Log:
Get the type right for wide string literals; it's wchar_t, not char.


Added:
    cfe/trunk/test/Sema/wchar_size.c
Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=51586&r1=51585&r2=51586&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue May 27 02:57:14 2008
@@ -51,7 +51,7 @@
                             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

Added: cfe/trunk/test/Sema/wchar_size.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/wchar_size.c?rev=51586&view=auto

==============================================================================
--- cfe/trunk/test/Sema/wchar_size.c (added)
+++ cfe/trunk/test/Sema/wchar_size.c Tue May 27 02:57:14 2008
@@ -0,0 +1,3 @@
+// RUN: clang %s -fsyntax-only -verify -triple=i686-apple-darwin9
+
+int check_wchar_size[sizeof(*L"") == 4 ? 1 : -1];





More information about the cfe-commits mailing list