diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-11-08 15:33:35 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-11-08 15:33:35 +0000 |
commit | 730476b50ea63c79e590f91859097e16f88503a1 (patch) | |
tree | 9ef5033ebaba4ae9b953abd08c297d6ea7bd66fb /clang/lib/Parse/ParseDeclCXX.cpp | |
parent | 423978923580a9c262f39a201ab4ee30b8a20a14 (diff) | |
download | bcm5719-llvm-730476b50ea63c79e590f91859097e16f88503a1.tar.gz bcm5719-llvm-730476b50ea63c79e590f91859097e16f88503a1.zip |
[c++1z] Support for attributes on namespaces and enumerators.
llvm-svn: 221580
Diffstat (limited to 'clang/lib/Parse/ParseDeclCXX.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDeclCXX.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 223046c90d9..1f56c8ba3b5 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -73,7 +73,14 @@ Decl *Parser::ParseNamespace(unsigned Context, std::vector<IdentifierInfo*> ExtraIdent; std::vector<SourceLocation> ExtraNamespaceLoc; - Token attrTok; + ParsedAttributesWithRange attrs(AttrFactory); + SourceLocation attrLoc; + if (getLangOpts().CPlusPlus11 && isCXX11AttributeSpecifier()) { + if (!getLangOpts().CPlusPlus1z) + Diag(Tok.getLocation(), diag::warn_cxx14_compat_attribute) << "namespace"; + attrLoc = Tok.getLocation(); + ParseCXX11Attributes(attrs); + } if (Tok.is(tok::identifier)) { Ident = Tok.getIdentifierInfo(); @@ -86,9 +93,8 @@ Decl *Parser::ParseNamespace(unsigned Context, } // Read label attributes, if present. - ParsedAttributes attrs(AttrFactory); if (Tok.is(tok::kw___attribute)) { - attrTok = Tok; + attrLoc = Tok.getLocation(); ParseGNUAttributes(attrs); } @@ -99,8 +105,8 @@ Decl *Parser::ParseNamespace(unsigned Context, SkipUntil(tok::semi); return nullptr; } - if (!attrs.empty()) - Diag(attrTok, diag::err_unexpected_namespace_attributes_alias); + if (attrLoc.isValid()) + Diag(attrLoc, diag::err_unexpected_namespace_attributes_alias); if (InlineLoc.isValid()) Diag(InlineLoc, diag::err_inline_namespace_alias) << FixItHint::CreateRemoval(InlineLoc); |