[cfe-commits] r136560 - in /cfe/trunk: lib/Lex/PPMacroExpansion.cpp lib/Parse/ParseDeclCXX.cpp test/SemaCXX/libstdcxx_is_pod_hack.cpp

Douglas Gregor dgregor at apple.com
Sat Jul 30 00:01:49 PDT 2011


Author: dgregor
Date: Sat Jul 30 02:01:49 2011
New Revision: 136560

URL: http://llvm.org/viewvc/llvm-project?rev=136560&view=rev
Log:
Turn off __has_feature(is_empty) and __has_feature(is_pod) if the
libstdc++ hack has reverted these type traits to keywords. Icky, but
fixes <rdar://problem/9836262>.

Modified:
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/test/SemaCXX/libstdcxx_is_pod_hack.cpp

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=136560&r1=136559&r2=136560&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Sat Jul 30 02:01:49 2011
@@ -639,11 +639,13 @@
            .Case("is_base_of", LangOpts.CPlusPlus)
            .Case("is_class", LangOpts.CPlusPlus)
            .Case("is_convertible_to", LangOpts.CPlusPlus)
-           .Case("is_empty", LangOpts.CPlusPlus)
+           .Case("is_empty", 
+                 LangOpts.CPlusPlus && II->getTokenID() != tok::identifier)
            .Case("is_enum", LangOpts.CPlusPlus)
            .Case("is_literal", LangOpts.CPlusPlus)
            .Case("is_standard_layout", LangOpts.CPlusPlus)
-           .Case("is_pod", LangOpts.CPlusPlus)
+           .Case("is_pod", 
+                 LangOpts.CPlusPlus && II->getTokenID() != tok::identifier)
            .Case("is_polymorphic", LangOpts.CPlusPlus)
            .Case("is_trivial", LangOpts.CPlusPlus)
            .Case("is_trivially_copyable", LangOpts.CPlusPlus)

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=136560&r1=136559&r2=136560&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sat Jul 30 02:01:49 2011
@@ -901,7 +901,7 @@
        Tok.is(tok::kw___is_signed) ||
        Tok.is(tok::kw___is_unsigned) ||
        Tok.is(tok::kw___is_void))) {
-    // GNU libstdc++ 4.2 and libc++ uaw certain intrinsic names as the
+    // GNU libstdc++ 4.2 and libc++ use certain intrinsic names as the
     // name of struct templates, but some are keywords in GCC >= 4.3
     // and Clang. Therefore, when we see the token sequence "struct
     // X", make X into a normal identifier rather than a keyword, to

Modified: cfe/trunk/test/SemaCXX/libstdcxx_is_pod_hack.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/libstdcxx_is_pod_hack.cpp?rev=136560&r1=136559&r2=136560&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/libstdcxx_is_pod_hack.cpp (original)
+++ cfe/trunk/test/SemaCXX/libstdcxx_is_pod_hack.cpp Sat Jul 30 02:01:49 2011
@@ -27,3 +27,7 @@
 };
 
 bool check_signed = test_is_signed::__is_signed;
+
+#if __has_feature(is_pod)
+#  error __is_pod won't work now anyway
+#endif





More information about the cfe-commits mailing list