summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-08-09 16:51:54 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2008-08-09 16:51:54 +0000
commit40e9e4828fe064f9375851e9dba04ec2d2a43a80 (patch)
treeb5c3ef636c241f2feb8f63df7aa8c4776583dc96 /clang/lib/Parse
parent239255d2a6f0c568450aff21c09a4eb91ad10bef (diff)
downloadbcm5719-llvm-40e9e4828fe064f9375851e9dba04ec2d2a43a80.tar.gz
bcm5719-llvm-40e9e4828fe064f9375851e9dba04ec2d2a43a80.zip
Implement support for the 'wchar_t' C++ type.
llvm-svn: 54585
Diffstat (limited to 'clang/lib/Parse')
-rw-r--r--clang/lib/Parse/DeclSpec.cpp6
-rw-r--r--clang/lib/Parse/ParseDecl.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Parse/DeclSpec.cpp b/clang/lib/Parse/DeclSpec.cpp
index 8e6dacb761d..d97dcfac807 100644
--- a/clang/lib/Parse/DeclSpec.cpp
+++ b/clang/lib/Parse/DeclSpec.cpp
@@ -87,6 +87,7 @@ const char *DeclSpec::getSpecifierName(DeclSpec::TST T) {
case DeclSpec::TST_unspecified: return "unspecified";
case DeclSpec::TST_void: return "void";
case DeclSpec::TST_char: return "char";
+ case DeclSpec::TST_wchar: return "wchar_t";
case DeclSpec::TST_int: return "int";
case DeclSpec::TST_float: return "float";
case DeclSpec::TST_double: return "double";
@@ -214,11 +215,12 @@ void DeclSpec::Finish(Diagnostic &D, SourceManager& SrcMgr,
const LangOptions &Lang) {
// Check the type specifier components first.
- // signed/unsigned are only valid with int/char.
+ // signed/unsigned are only valid with int/char/wchar_t.
if (TypeSpecSign != TSS_unspecified) {
if (TypeSpecType == TST_unspecified)
TypeSpecType = TST_int; // unsigned -> unsigned int, signed -> signed int.
- else if (TypeSpecType != TST_int && TypeSpecType != TST_char) {
+ else if (TypeSpecType != TST_int &&
+ TypeSpecType != TST_char && TypeSpecType != TST_wchar) {
Diag(D, TSSLoc, SrcMgr, diag::err_invalid_sign_spec,
getSpecifierName( (TST)TypeSpecType));
// signed double -> double.
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 1cf331702d9..5b4473ea4de 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -376,6 +376,7 @@ void Parser::ParseSpecifierQualifierList(DeclSpec &DS) {
/// struct-or-union-specifier
/// enum-specifier
/// typedef-name
+/// [C++] 'wchar_t'
/// [C++] 'bool'
/// [C99] '_Bool'
/// [C99] '_Complex'
@@ -517,6 +518,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) {
case tok::kw_double:
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_double, Loc, PrevSpec);
break;
+ case tok::kw_wchar_t: // [C++ 2.11p1]
+ isInvalid = DS.SetTypeSpecType(DeclSpec::TST_wchar, Loc, PrevSpec);
+ break;
case tok::kw_bool: // [C++ 2.11p1]
case tok::kw__Bool:
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_bool, Loc, PrevSpec);
@@ -941,6 +945,7 @@ bool Parser::isTypeSpecifierQualifier() const {
case tok::kw__Imaginary:
case tok::kw_void:
case tok::kw_char:
+ case tok::kw_wchar_t:
case tok::kw_int:
case tok::kw_float:
case tok::kw_double:
@@ -992,6 +997,7 @@ bool Parser::isDeclarationSpecifier() const {
case tok::kw__Imaginary:
case tok::kw_void:
case tok::kw_char:
+ case tok::kw_wchar_t:
case tok::kw_int:
case tok::kw_float:
case tok::kw_double:
OpenPOWER on IntegriCloud