]> granicus.if.org Git - clang/commitdiff
Add support for '__is_literal_type' spelling of the existing
authorChandler Carruth <chandlerc@gmail.com>
Sun, 24 Apr 2011 02:49:28 +0000 (02:49 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 24 Apr 2011 02:49:28 +0000 (02:49 +0000)
'__is_literal' type trait for GCC compatibility. At least one relased
version if libstdc++ uses this name for the trait despite it not being
documented anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130078 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/TokenKinds.def
lib/Parse/ParseExpr.cpp
lib/Parse/ParseExprCXX.cpp
lib/Parse/ParseTentative.cpp
test/SemaCXX/literal-type.cpp

index 96f5aa9cada94037f1502cc2c93d9ae4fcc36ef0..ac8e694337e4e27b35d09397fd2a98bbf8ed1c91 100644 (file)
@@ -338,6 +338,9 @@ KEYWORD(__is_empty                  , KEYCXX)
 KEYWORD(__is_enum                   , KEYCXX)
 // Tentative name - there's no implementation of std::is_literal_type yet.
 KEYWORD(__is_literal                , KEYCXX)
+// Name for GCC 4.6 compatibility - people have already written libraries using
+// this name unfortunately.
+KEYWORD(__is_literal_type           , KEYCXX)
 KEYWORD(__is_pod                    , KEYCXX)
 KEYWORD(__is_polymorphic            , KEYCXX)
 KEYWORD(__is_trivial                , KEYCXX)
index d218c7973606f023b65423a811803ceea809a668..0ad153fc572514a6c51cdf814a4e5093ef0e6d64 100644 (file)
@@ -989,6 +989,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
   case tok::kw___is_empty:
   case tok::kw___is_enum:
   case tok::kw___is_literal:
+  case tok::kw___is_literal_type:
   case tok::kw___is_pod:
   case tok::kw___is_polymorphic:
   case tok::kw___is_trivial:
index 38c074d1de6f65d4c7b4433b873c8324a49f10f5..1165ff0978f718f61ad779b2dfb836ab208f2459 100644 (file)
@@ -1927,6 +1927,7 @@ static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) {
   case tok::kw___is_empty:                return UTT_IsEmpty;
   case tok::kw___is_enum:                 return UTT_IsEnum;
   case tok::kw___is_literal:              return UTT_IsLiteral;
+  case tok::kw___is_literal_type:         return UTT_IsLiteral;
   case tok::kw___is_pod:                  return UTT_IsPOD;
   case tok::kw___is_polymorphic:          return UTT_IsPolymorphic;
   case tok::kw___is_trivial:              return UTT_IsTrivial;
index 3e00a8c0db551d5e042c9cd6c44b4bf2803a2530..618c3e2bd4de504194d77c469d7073367981d061 100644 (file)
@@ -660,6 +660,7 @@ Parser::isExpressionOrTypeSpecifierSimple(tok::TokenKind Kind) {
   case tok::kw___is_empty:
   case tok::kw___is_enum:
   case tok::kw___is_literal:
+  case tok::kw___is_literal_type:
   case tok::kw___is_pod:
   case tok::kw___is_polymorphic:
   case tok::kw___is_trivial:
index 142dd756e5a3a55eb99bff36b24a34ea336df22d..8eff677a0f2c149a3c9bda0904b8d5c613102d09 100644 (file)
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
 
 static_assert(__is_literal(int), "fail");
+static_assert(__is_literal_type(int), "fail"); // alternate spelling for GCC
 static_assert(__is_literal(void*), "fail");
 enum E { E1 };
 static_assert(__is_literal(E), "fail");