From d428ff46fe7f6b2ac05436be6abb7d7da43cd8b9 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Sat, 4 May 2013 16:56:22 +0000 Subject: [PATCH] Reverting r181004 since it has broken test/Sema/wchar.c. llvm-svn: 181122 --- clang/include/clang/AST/PrettyPrinter.h | 7 +------ clang/include/clang/Basic/TokenKinds.def | 1 - clang/lib/AST/ASTContext.cpp | 5 ++--- clang/lib/AST/Type.cpp | 2 +- clang/test/Lexer/ms-compatibility-wchar.c | 12 ------------ clang/test/Lexer/ms-extensions-wchar.c | 12 ------------ 6 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 clang/test/Lexer/ms-compatibility-wchar.c delete mode 100644 clang/test/Lexer/ms-extensions-wchar.c diff --git a/clang/include/clang/AST/PrettyPrinter.h b/clang/include/clang/AST/PrettyPrinter.h index 36e90724d9f5..e3c09e7b418f 100644 --- a/clang/include/clang/AST/PrettyPrinter.h +++ b/clang/include/clang/AST/PrettyPrinter.h @@ -40,8 +40,7 @@ struct PrintingPolicy { SuppressUnwrittenScope(false), SuppressInitializers(false), ConstantArraySizeAsWritten(false), AnonymousTagLocations(true), SuppressStrongLifetime(false), Bool(LO.Bool), - TerseOutput(false), PolishForDeclaration(false), - MSWChar(LO.MicrosoftMode && !LO.WChar) { } + TerseOutput(false), PolishForDeclaration(false) { } /// \brief What language we're printing. LangOptions LangOpts; @@ -147,10 +146,6 @@ struct PrintingPolicy { /// declaration tag; such as, do not print attributes attached to the declaration. /// unsigned PolishForDeclaration : 1; - - /// \brief When true, print the built-in wchar_t type as __wchar_t. For use in - /// Microsoft mode when wchar_t is not available. - unsigned MSWChar : 1; }; } // end namespace clang diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def index 0dbff81d3423..bcf0f31dcbf6 100644 --- a/clang/include/clang/Basic/TokenKinds.def +++ b/clang/include/clang/Basic/TokenKinds.def @@ -524,7 +524,6 @@ KEYWORD(__interface , KEYMS) ALIAS("__int8" , char , KEYMS) ALIAS("__int16" , short , KEYMS) ALIAS("__int32" , int , KEYMS) -ALIAS("__wchar_t" , wchar_t , KEYMS) ALIAS("_asm" , asm , KEYMS) ALIAS("_alignof" , __alignof , KEYMS) ALIAS("__builtin_alignof", __alignof , KEYMS) diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index b827dc1080ae..e6dfd445adf2 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -897,13 +897,12 @@ void ASTContext::InitBuiltinTypes(const TargetInfo &Target) { InitBuiltinType(Int128Ty, BuiltinType::Int128); InitBuiltinType(UnsignedInt128Ty, BuiltinType::UInt128); - if ((LangOpts.CPlusPlus && LangOpts.WChar) || LangOpts.MicrosoftMode) { - // C++ 3.9.1p5 or -fms-compatibility. + 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 (or C++ using -fno-wchar) in non-MicrosoftMode. + } else // C99 (or C++ using -fno-wchar) WCharTy = getFromTargetType(Target.getWCharType()); WIntTy = getFromTargetType(Target.getWIntType()); diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index a1f0b08494b0..fa16facb634f 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -1521,7 +1521,7 @@ StringRef BuiltinType::getName(const PrintingPolicy &Policy) const { case Double: return "double"; case LongDouble: return "long double"; case WChar_S: - case WChar_U: return Policy.MSWChar ? "__wchar_t" : "wchar_t"; + case WChar_U: return "wchar_t"; case Char16: return "char16_t"; case Char32: return "char32_t"; case NullPtr: return "nullptr_t"; diff --git a/clang/test/Lexer/ms-compatibility-wchar.c b/clang/test/Lexer/ms-compatibility-wchar.c deleted file mode 100644 index 966292eeb1dc..000000000000 --- a/clang/test/Lexer/ms-compatibility-wchar.c +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -fms-compatibility -triple i386-pc-win32 %s - -// C++ mode with -fno-wchar works the same as C mode for wchar_t. -// RUN: %clang_cc1 -x c++ -fno-wchar -fsyntax-only -verify -fms-compatibility -triple i386-pc-win32 %s - -wchar_t f(); // expected-error{{unknown type name 'wchar_t'}} - -// __wchar_t is available as an MS extension. -__wchar_t g; // expected-note {{previous}} - -// __wchar_t is a distinct type, separate from the target's integer type for wide chars. -unsigned short g; // expected-error {{redefinition of 'g' with a different type: 'unsigned short' vs '__wchar_t'}} diff --git a/clang/test/Lexer/ms-extensions-wchar.c b/clang/test/Lexer/ms-extensions-wchar.c deleted file mode 100644 index 9321c3a91499..000000000000 --- a/clang/test/Lexer/ms-extensions-wchar.c +++ /dev/null @@ -1,12 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions -triple i386-pc-win32 %s - -// C++ mode with -fno-wchar works the same as C mode for wchar_t. -// RUN: %clang_cc1 -x c++ -fno-wchar -fsyntax-only -verify -fms-extensions -triple i386-pc-win32 %s - -wchar_t f(); // expected-error{{unknown type name 'wchar_t'}} - -// __wchar_t is available as an MS extension. -__wchar_t g(); // No error. - -// __wchar_t is the same as the target's integer type for wide chars. -unsigned short g(); // No error.