From: Anders Carlsson Date: Sun, 7 Feb 2010 01:09:23 +0000 (+0000) Subject: Add attributes to namespace decls. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2a3503d85374ecc2b8e862a8ed9cec8f10f72e84;p=clang Add attributes to namespace decls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95510 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h index 91854aa480..ec542f08c3 100644 --- a/include/clang/Parse/Action.h +++ b/include/clang/Parse/Action.h @@ -1277,7 +1277,8 @@ public: /// definition. virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, - SourceLocation LBrace) { + SourceLocation LBrace, + AttributeList *AttrList) { return DeclPtrTy(); } diff --git a/lib/Frontend/PrintParserCallbacks.cpp b/lib/Frontend/PrintParserCallbacks.cpp index 6af33c20a6..8d64a64133 100644 --- a/lib/Frontend/PrintParserCallbacks.cpp +++ b/lib/Frontend/PrintParserCallbacks.cpp @@ -684,7 +684,8 @@ namespace { virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, - SourceLocation LBrace) { + SourceLocation LBrace, + AttributeList *AttrList) { Out << __FUNCTION__ << "\n"; return DeclPtrTy(); } diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 07bae1c7a4..c24bafd6d3 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -64,7 +64,7 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context, } // Read label attributes, if present. - Action::AttrTy *AttrList = 0; + AttributeList *AttrList = 0; if (Tok.is(tok::kw___attribute)) { attrTok = Tok; @@ -91,7 +91,7 @@ Parser::DeclPtrTy Parser::ParseNamespace(unsigned Context, ParseScope NamespaceScope(this, Scope::DeclScope); DeclPtrTy NamespcDecl = - Actions.ActOnStartNamespaceDef(CurScope, IdentLoc, Ident, LBrace); + Actions.ActOnStartNamespaceDef(CurScope, IdentLoc, Ident, LBrace, AttrList); PrettyStackTraceActionsDecl CrashInfo(NamespcDecl, NamespaceLoc, Actions, PP.getSourceManager(), diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h index dfd8f3461e..6a3ed3d0b7 100644 --- a/lib/Sema/Sema.h +++ b/lib/Sema/Sema.h @@ -1829,7 +1829,8 @@ public: // Act on C++ namespaces virtual DeclPtrTy ActOnStartNamespaceDef(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, - SourceLocation LBrace); + SourceLocation LBrace, + AttributeList *AttrList); virtual void ActOnFinishNamespaceDef(DeclPtrTy Dcl, SourceLocation RBrace); virtual DeclPtrTy ActOnUsingDirective(Scope *CurScope, diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 7fbbed4089..e156b62fdb 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -2821,13 +2821,16 @@ Sema::DeclPtrTy Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) { Sema::DeclPtrTy Sema::ActOnStartNamespaceDef(Scope *NamespcScope, SourceLocation IdentLoc, IdentifierInfo *II, - SourceLocation LBrace) { + SourceLocation LBrace, + AttributeList *AttrList) { NamespaceDecl *Namespc = NamespaceDecl::Create(Context, CurContext, IdentLoc, II); Namespc->setLBracLoc(LBrace); Scope *DeclRegionScope = NamespcScope->getParent(); + ProcessDeclAttributeList(DeclRegionScope, Namespc, AttrList); + if (II) { // C++ [namespace.def]p2: // The identifier in an original-namespace-definition shall not have been