[cfe-commits] r130078 - in /cfe/trunk: include/clang/Basic/TokenKinds.def lib/Parse/ParseExpr.cpp lib/Parse/ParseExprCXX.cpp lib/Parse/ParseTentative.cpp test/SemaCXX/literal-type.cpp
Chandler Carruth
chandlerc at gmail.com
Sat Apr 23 19:49:28 PDT 2011
Author: chandlerc
Date: Sat Apr 23 21:49:28 2011
New Revision: 130078
URL: http://llvm.org/viewvc/llvm-project?rev=130078&view=rev
Log:
Add support for '__is_literal_type' spelling of the existing
'__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.
Modified:
cfe/trunk/include/clang/Basic/TokenKinds.def
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/test/SemaCXX/literal-type.cpp
Modified: cfe/trunk/include/clang/Basic/TokenKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TokenKinds.def?rev=130078&r1=130077&r2=130078&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/TokenKinds.def (original)
+++ cfe/trunk/include/clang/Basic/TokenKinds.def Sat Apr 23 21:49:28 2011
@@ -338,6 +338,9 @@
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)
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=130078&r1=130077&r2=130078&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Sat Apr 23 21:49:28 2011
@@ -989,6 +989,7 @@
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:
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=130078&r1=130077&r2=130078&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Sat Apr 23 21:49:28 2011
@@ -1927,6 +1927,7 @@
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;
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=130078&r1=130077&r2=130078&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Sat Apr 23 21:49:28 2011
@@ -660,6 +660,7 @@
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:
Modified: cfe/trunk/test/SemaCXX/literal-type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/literal-type.cpp?rev=130078&r1=130077&r2=130078&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/literal-type.cpp (original)
+++ cfe/trunk/test/SemaCXX/literal-type.cpp Sat Apr 23 21:49:28 2011
@@ -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");
More information about the cfe-commits
mailing list