[cfe-commits] r121228 - in /cfe/trunk: lib/Parse/ParseTentative.cpp test/SemaCXX/dcl_ambig_res.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Dec 7 18:02:46 PST 2010
Author: akirtzidis
Date: Tue Dec 7 20:02:46 2010
New Revision: 121228
URL: http://llvm.org/viewvc/llvm-project?rev=121228&view=rev
Log:
Handle parameter attributes when tentative parsing for function/variable disambiguation.
Fixes rdar://8739801.
Modified:
cfe/trunk/lib/Parse/ParseTentative.cpp
cfe/trunk/test/SemaCXX/dcl_ambig_res.cpp
Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=121228&r1=121227&r2=121228&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Tue Dec 7 20:02:46 2010
@@ -1119,10 +1119,11 @@
/// parameter-declaration-list ',' parameter-declaration
///
/// parameter-declaration:
-/// decl-specifier-seq declarator
-/// decl-specifier-seq declarator '=' assignment-expression
-/// decl-specifier-seq abstract-declarator[opt]
-/// decl-specifier-seq abstract-declarator[opt] '=' assignment-expression
+/// decl-specifier-seq declarator attributes[opt]
+/// decl-specifier-seq declarator attributes[opt] '=' assignment-expression
+/// decl-specifier-seq abstract-declarator[opt] attributes[opt]
+/// decl-specifier-seq abstract-declarator[opt] attributes[opt]
+/// '=' assignment-expression
///
Parser::TPResult Parser::TryParseParameterDeclarationClause() {
@@ -1157,6 +1158,10 @@
if (TPR != TPResult::Ambiguous())
return TPR;
+ // [GNU] attributes[opt]
+ if (Tok.is(tok::kw___attribute))
+ return TPResult::True();
+
if (Tok.is(tok::equal)) {
// '=' assignment-expression
// Parse through assignment-expression.
Modified: cfe/trunk/test/SemaCXX/dcl_ambig_res.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/dcl_ambig_res.cpp?rev=121228&r1=121227&r2=121228&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/dcl_ambig_res.cpp (original)
+++ cfe/trunk/test/SemaCXX/dcl_ambig_res.cpp Tue Dec 7 20:02:46 2010
@@ -71,3 +71,6 @@
int foo8() {
int v(int(S5::value)); // expected-warning{{disambiguated}} expected-error{{parameter declarator cannot be qualified}}
}
+
+template<typename T>
+void rdar8739801( void (T::*)( void ) __attribute__((unused)) );
More information about the cfe-commits
mailing list