diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-09-23 04:09:56 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-09-23 04:09:56 +0000 |
commit | 7c3c5bec07b9523a704bc7ba4bbb4e7995511b1c (patch) | |
tree | b3862175c27c98e98e899b9369c7d72f4fc62678 /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | f6a42580207fd25b6642eaa3aa2a638c2d3f21f2 (diff) | |
download | bcm5719-llvm-7c3c5bec07b9523a704bc7ba4bbb4e7995511b1c.tar.gz bcm5719-llvm-7c3c5bec07b9523a704bc7ba4bbb4e7995511b1c.zip |
Revert r197496, as it broke REVERTIBLE_TYPE_TRAITs from PCH files.
Also add a test to make sure that this doesn't break again. Fixes PR21036.
llvm-svn: 218292
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index b252ed5865c..8ea53966946 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -1226,17 +1226,31 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, // C++11 attributes SourceLocation AttrFixitLoc = Tok.getLocation(); - // GNU libstdc++ and libc++ use certain intrinsic names as the - // name of struct templates, but some are keywords in GCC >= 4.3 - // MSVC and Clang. For compatibility, convert the token to an identifier - // and issue a warning diagnostic. - if (TagType == DeclSpec::TST_struct && !Tok.is(tok::identifier) && - !Tok.isAnnotation()) { - const IdentifierInfo *II = Tok.getIdentifierInfo(); - // We rarely end up here so the following check is efficient. - if (II && II->getName().startswith("__is_")) - TryKeywordIdentFallback(true); - } + if (TagType == DeclSpec::TST_struct && + !Tok.is(tok::identifier) && + Tok.getIdentifierInfo() && + (Tok.is(tok::kw___is_arithmetic) || + Tok.is(tok::kw___is_convertible) || + Tok.is(tok::kw___is_empty) || + Tok.is(tok::kw___is_floating_point) || + Tok.is(tok::kw___is_function) || + Tok.is(tok::kw___is_fundamental) || + Tok.is(tok::kw___is_integral) || + Tok.is(tok::kw___is_member_function_pointer) || + Tok.is(tok::kw___is_member_pointer) || + Tok.is(tok::kw___is_pod) || + Tok.is(tok::kw___is_pointer) || + Tok.is(tok::kw___is_same) || + Tok.is(tok::kw___is_scalar) || + Tok.is(tok::kw___is_signed) || + Tok.is(tok::kw___is_unsigned) || + Tok.is(tok::kw___is_void))) + // 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 + // allow libstdc++ 4.2 and libc++ to work properly. + TryKeywordIdentFallback(true); // Parse the (optional) nested-name-specifier. CXXScopeSpec &SS = DS.getTypeSpecScope(); |