[cfe-commits] r129017 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/pascal-wchar-strings.cpp

Anders Carlsson andersca at mac.com
Wed Apr 6 11:42:48 PDT 2011


Author: andersca
Date: Wed Apr  6 13:42:48 2011
New Revision: 129017

URL: http://llvm.org/viewvc/llvm-project?rev=129017&view=rev
Log:
Wide Pascal strings should be of type wchar_t[] and not unsigned char[].

Added:
    cfe/trunk/test/SemaCXX/pascal-wchar-strings.cpp
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=129017&r1=129016&r2=129017&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Apr  6 13:42:48 2011
@@ -744,8 +744,10 @@
     StringTokLocs.push_back(StringToks[i].getLocation());
 
   QualType StrTy = Context.CharTy;
-  if (Literal.AnyWide) StrTy = Context.getWCharType();
-  if (Literal.Pascal) StrTy = Context.UnsignedCharTy;
+  if (Literal.AnyWide) 
+    StrTy = Context.getWCharType();
+  else if (Literal.Pascal)
+    StrTy = Context.UnsignedCharTy;
 
   // A C++ string literal has a const-qualified element type (C++ 2.13.4p1).
   if (getLangOptions().CPlusPlus || getLangOptions().ConstStrings)

Added: cfe/trunk/test/SemaCXX/pascal-wchar-strings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/pascal-wchar-strings.cpp?rev=129017&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/pascal-wchar-strings.cpp (added)
+++ cfe/trunk/test/SemaCXX/pascal-wchar-strings.cpp Wed Apr  6 13:42:48 2011
@@ -0,0 +1,2 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s -fpascal-strings
+const wchar_t *pascalString = L"\pThis is a Pascal string";





More information about the cfe-commits mailing list