diff options
author | John Wiegley <johnw@boostpro.com> | 2011-04-27 23:09:49 +0000 |
---|---|---|
committer | John Wiegley <johnw@boostpro.com> | 2011-04-27 23:09:49 +0000 |
commit | 65497cce201e667d11b436d24afbcc5d7ca786a8 (patch) | |
tree | 748574faf97bcc843108b74247fc8c2210b71c65 /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | 08704349da5aed388fa8694775593f69fd108070 (diff) | |
download | bcm5719-llvm-65497cce201e667d11b436d24afbcc5d7ca786a8.tar.gz bcm5719-llvm-65497cce201e667d11b436d24afbcc5d7ca786a8.zip |
t/clang/type-traits
Patch authored by John Wiegley.
These type traits are used for parsing code that employs certain features of
the Embarcadero C++ compiler. Several of these constructs are also desired by
libc++, according to its project pages (such as __is_standard_layout).
llvm-svn: 130342
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index f59302868b5..c41798e35ee 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -731,22 +731,19 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, // styles of attributes? MaybeParseCXX0XAttributes(attrs); - if (TagType == DeclSpec::TST_struct && Tok.is(tok::kw___is_pod)) { - // GNU libstdc++ 4.2 uses __is_pod as the name of a struct template, but - // __is_pod is a keyword in GCC >= 4.3. Therefore, when we see the - // token sequence "struct __is_pod", make __is_pod into a normal - // identifier rather than a keyword, to allow libstdc++ 4.2 to work - // properly. - Tok.getIdentifierInfo()->RevertTokenIDToIdentifier(); - Tok.setKind(tok::identifier); - } - - if (TagType == DeclSpec::TST_struct && Tok.is(tok::kw___is_empty)) { - // GNU libstdc++ 4.2 uses __is_empty as the name of a struct template, but - // __is_empty is a keyword in GCC >= 4.3. Therefore, when we see the - // token sequence "struct __is_empty", make __is_empty into a normal - // identifier rather than a keyword, to allow libstdc++ 4.2 to work - // properly. + if (TagType == DeclSpec::TST_struct && + (Tok.is(tok::kw___is_pod) || + Tok.is(tok::kw___is_empty) || + Tok.is(tok::kw___is_void) || + Tok.is(tok::kw___is_pointer) || + Tok.is(tok::kw___is_arithmetic) || + Tok.is(tok::kw___is_fundamental) || + Tok.is(tok::kw___is_scalar))) { + // GNU libstdc++ 4.2 uses certain intrinsic names as the name of + // struct templates, but these 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 to work properly. Tok.getIdentifierInfo()->RevertTokenIDToIdentifier(); Tok.setKind(tok::identifier); } |