From: Douglas Gregor Date: Wed, 3 Aug 2011 17:01:05 +0000 (+0000) Subject: Comment the weird behavior of __has_feature(is_empty) and __has_feature(is_pod) X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3f8c244a0f193229a6fdbcea1a3615aff5b90dc;p=clang Comment the weird behavior of __has_feature(is_empty) and __has_feature(is_pod) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136788 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 7046c5f2fd..a4b6cc9db8 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -639,6 +639,10 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { .Case("is_base_of", LangOpts.CPlusPlus) .Case("is_class", LangOpts.CPlusPlus) .Case("is_convertible_to", LangOpts.CPlusPlus) + // __is_empty is available only if the horrible + // "struct __is_empty" parsing hack hasn't been needed in this + // translation unit. If it has, __is_empty reverts to a normal + // identifier and __has_feature(is_empty) evaluates false. .Case("is_empty", LangOpts.CPlusPlus && PP.getIdentifierInfo("__is_empty")->getTokenID() @@ -646,6 +650,10 @@ static bool HasFeature(const Preprocessor &PP, const IdentifierInfo *II) { .Case("is_enum", LangOpts.CPlusPlus) .Case("is_literal", LangOpts.CPlusPlus) .Case("is_standard_layout", LangOpts.CPlusPlus) + // __is_pod is available only if the horrible + // "struct __is_pod" parsing hack hasn't been needed in this + // translation unit. If it has, __is_pod reverts to a normal + // identifier and __has_feature(is_pod) evaluates false. .Case("is_pod", LangOpts.CPlusPlus && PP.getIdentifierInfo("__is_pod")->getTokenID()