summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-04-28 15:48:45 +0000
committerDouglas Gregor <dgregor@apple.com>2011-04-28 15:48:45 +0000
commit068730992cf08d7d7e82e7bb147d85f429fc3ddd (patch)
tree4138757526cf883ca3d329ada33f23ea518793c9 /clang/lib/Parse/ParseDecl.cpp
parent4af23c81592ce67b1aecde8e58ab1c49a04b3307 (diff)
downloadbcm5719-llvm-068730992cf08d7d7e82e7bb147d85f429fc3ddd.tar.gz
bcm5719-llvm-068730992cf08d7d7e82e7bb147d85f429fc3ddd.zip
libstdc++ 4.4 uses __is_signed as an identifier, while Clang treats it
as a keyword for the __is_signed type trait. Cope with this conflict via some hackish recovery: if we see a declaration of the form static const bool __is_signed then we stop treating __is_signed as a keyword and instead treat it as an identifier. It's ugly, but it's better than making the __is_signed type trait conditional on some language flag. Fixes PR9804. llvm-svn: 130399
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 24a487c89c3..a20e90bd0ea 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -1479,6 +1479,24 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
continue;
}
+ case tok::kw___is_signed:
+ // GNU libstdc++ 4.4 uses __is_signed as an identifier, but Clang
+ // typically treats it as a trait. If we see __is_signed as it appears
+ // in libstdc++, e.g.,
+ //
+ // static const bool __is_signed;
+ //
+ // then treat __is_signed as an identifier rather than as a keyword.
+ if (DS.getTypeSpecType() == TST_bool &&
+ DS.getTypeQualifiers() == DeclSpec::TQ_const &&
+ DS.getStorageClassSpec() == DeclSpec::SCS_static) {
+ Tok.getIdentifierInfo()->RevertTokenIDToIdentifier();
+ Tok.setKind(tok::identifier);
+ }
+
+ // We're done with the declaration-specifiers.
+ goto DoneWithDeclSpec;
+
// typedef-name
case tok::identifier: {
// In C++, check to see if this is a scope specifier like foo::bar::, if
OpenPOWER on IntegriCloud