]> granicus.if.org Git - clang/commitdiff
Add support for parsing the optional attribute-specifier-seq at the
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 29 Sep 2011 18:03:57 +0000 (18:03 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 29 Sep 2011 18:03:57 +0000 (18:03 +0000)
end of a decl-specifier-seq

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

lib/Parse/ParseDecl.cpp
test/Parser/cxx0x-attributes.cpp

index d4b5a2b5bfe75f10b0a89e95be3ba68f416f32be..d904bcc8073b7694388b97e513d78b6f6b027598 100644 (file)
@@ -1541,6 +1541,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
     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);
index 0285ee1e9ac5bb69dd0871101e80d1fa6f5f0912..75f23c657c6a397a2e0121765134f181104e2acd 100644 (file)
@@ -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 @@ template <typename T> [[]] void template_attr ();
 
 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'}}