[cfe-commits] r163476 - in /cfe/trunk: lib/AST/ASTContext.cpp test/SemaCXX/no-wchar.cpp
Abramo Bagnara
abramo.bagnara at bugseng.com
Sun Sep 9 03:13:32 PDT 2012
Author: abramo
Date: Sun Sep 9 05:13:32 2012
New Revision: 163476
URL: http://llvm.org/viewvc/llvm-project?rev=163476&view=rev
Log:
Fixed support for disabled wchar_t and added an appropriate test.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/SemaCXX/no-wchar.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=163476&r1=163475&r2=163476&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Sep 9 05:13:32 2012
@@ -761,12 +761,12 @@
InitBuiltinType(Int128Ty, BuiltinType::Int128);
InitBuiltinType(UnsignedInt128Ty, BuiltinType::UInt128);
- if (LangOpts.CPlusPlus) { // C++ 3.9.1p5
+ if (LangOpts.CPlusPlus && LangOpts.WChar) { // C++ 3.9.1p5
if (TargetInfo::isTypeSigned(Target.getWCharType()))
InitBuiltinType(WCharTy, BuiltinType::WChar_S);
else // -fshort-wchar makes wchar_t be unsigned.
InitBuiltinType(WCharTy, BuiltinType::WChar_U);
- } else // C99
+ } else // C99 (or C++ using -fno-wchar)
WCharTy = getFromTargetType(Target.getWCharType());
WIntTy = getFromTargetType(Target.getWIntType());
Modified: cfe/trunk/test/SemaCXX/no-wchar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/no-wchar.cpp?rev=163476&r1=163475&r2=163476&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/no-wchar.cpp (original)
+++ cfe/trunk/test/SemaCXX/no-wchar.cpp Sun Sep 9 05:13:32 2012
@@ -1,2 +1,9 @@
-// RUN: %clang_cc1 -fsyntax-only -fno-wchar -verify %s
+// RUN: %clang_cc1 -triple i386-pc-win32 -fsyntax-only -fno-wchar -verify %s
wchar_t x; // expected-error {{unknown type name 'wchar_t'}}
+
+typedef unsigned short wchar_t;
+void foo(const wchar_t* x);
+
+void bar() {
+ foo(L"wide string literal");
+}
More information about the cfe-commits
mailing list