]> granicus.if.org Git - clang/commitdiff
Handle parameter attributes when tentative parsing for function/variable disambiguation.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 8 Dec 2010 02:02:46 +0000 (02:02 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 8 Dec 2010 02:02:46 +0000 (02:02 +0000)
Fixes rdar://8739801.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121228 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseTentative.cpp
test/SemaCXX/dcl_ambig_res.cpp

index 997d01076b90ba87048ad7499e012f0bee576471..81abdb884abdc92bbf7d3fcc7a2b7f814aaed053 100644 (file)
@@ -1119,10 +1119,11 @@ bool Parser::isCXXFunctionDeclarator(bool warnIfAmbiguous) {
 ///   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 @@ Parser::TPResult Parser::TryParseParameterDeclarationClause() {
     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.
index f0ba2978e8d73ab5fe535b3756db69bdb98a9d18..fa71b11ba160e7dc6992f76df50d4bf91738132b 100644 (file)
@@ -71,3 +71,6 @@ struct S5 {
 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)) );