summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-04-15 19:40:02 +0000
committerDouglas Gregor <dgregor@apple.com>2011-04-15 19:40:02 +0000
commita3a020ae0be814f26c5b2e08751b6a14f91c0994 (patch)
tree63f750905565e36e3631bb88d5eb717e8c912859 /clang/lib/Parse/ParseExprCXX.cpp
parenta2e61292f06051adb1bfd853aeecafae1ea15c4d (diff)
downloadbcm5719-llvm-a3a020ae0be814f26c5b2e08751b6a14f91c0994.tar.gz
bcm5719-llvm-a3a020ae0be814f26c5b2e08751b6a14f91c0994.zip
Parse GNU-style attributes prior to the type-id/new-type-id in a C++
"new" expression. This matches GCC's parser. Test is forthcoming. llvm-svn: 129592
Diffstat (limited to 'clang/lib/Parse/ParseExprCXX.cpp')
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index c8f674175bd..acfe83a79bb 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -1707,6 +1707,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
///
/// new-type-id:
/// type-specifier-seq new-declarator[opt]
+/// [GNU] attributes type-specifier-seq new-declarator[opt]
///
/// new-declarator:
/// ptr-operator new-declarator[opt]
@@ -1752,12 +1753,14 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {
// We still need the type.
if (Tok.is(tok::l_paren)) {
TypeIdParens.setBegin(ConsumeParen());
+ MaybeParseGNUAttributes(DeclaratorInfo);
ParseSpecifierQualifierList(DS);
DeclaratorInfo.SetSourceRange(DS.getSourceRange());
ParseDeclarator(DeclaratorInfo);
TypeIdParens.setEnd(MatchRHSPunctuation(tok::r_paren,
TypeIdParens.getBegin()));
} else {
+ MaybeParseGNUAttributes(DeclaratorInfo);
if (ParseCXXTypeSpecifierSeq(DS))
DeclaratorInfo.setInvalidType(true);
else {
@@ -1770,6 +1773,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) {
} else {
// A new-type-id is a simplified type-id, where essentially the
// direct-declarator is replaced by a direct-new-declarator.
+ MaybeParseGNUAttributes(DeclaratorInfo);
if (ParseCXXTypeSpecifierSeq(DS))
DeclaratorInfo.setInvalidType(true);
else {
OpenPOWER on IntegriCloud