[cfe-commits] r140793 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Parser/cxx0x-attributes.cpp
Peter Collingbourne
peter at pcc.me.uk
Thu Sep 29 11:03:58 PDT 2011
Author: pcc
Date: Thu Sep 29 13:03:57 2011
New Revision: 140793
URL: http://llvm.org/viewvc/llvm-project?rev=140793&view=rev
Log:
Add support for parsing the optional attribute-specifier-seq at the
end of a decl-specifier-seq
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/cxx0x-attributes.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=140793&r1=140792&r2=140793&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Thu Sep 29 13:03:57 2011
@@ -1541,6 +1541,9 @@
switch (Tok.getKind()) {
default:
DoneWithDeclSpec:
+ // [C++0x] decl-specifier-seq: decl-specifier attribute-specifier-seq[opt]
+ MaybeParseCXX0XAttributes(DS.getAttributes());
+
// If this is not a declaration specifier token, we're done reading decl
// specifiers. First verify that DeclSpec's are consistent.
DS.Finish(Diags, PP);
Modified: cfe/trunk/test/Parser/cxx0x-attributes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-attributes.cpp?rev=140793&r1=140792&r2=140793&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-attributes.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-attributes.cpp Thu Sep 29 13:03:57 2011
@@ -2,6 +2,7 @@
// Declaration syntax checks
[[]] int before_attr;
+int [[]] between_attr;
int after_attr [[]];
int * [[]] ptr_attr;
int array_attr [1] [[]];
@@ -15,6 +16,7 @@
int comma_attr [[,]]; // expected-error {{expected identifier}}
int scope_attr [[foo::]]; // expected-error {{expected identifier}}
+unsigned [[]] int attr_in_decl_spec; // expected-error {{expected unqualified-id}}
int & [[]] ref_attr = after_attr; // expected-error {{an attribute list cannot appear here}}
class foo {
void after_const_attr () const [[]]; // expected-error {{expected body of lambda expression}} expected-error {{array has incomplete element type 'void'}}
More information about the cfe-commits
mailing list